Commit Graph

17 Commits

Author SHA1 Message Date
Scott Anderson 70745faac4 Enable strictNullChecks, eqeqeq (#436)
## Description:

Improve type safety and runtime correctness by:
1. Enabling TypeScript's
[strictNullChecks](https://www.typescriptlang.org/tsconfig/#strictNullChecks)
compiler option.
2. Replacing all loose equality operators (`==` and `!=`) with strict
equality operators (`===` and `!==`).
3. Cleaning up of type declarations, null handling logic, and equality
expressions throughout the project.

Currently, the code allows implicit assumptions that `null` and
`undefined` are interchangeable, and relies on type-coercing equality
checks that can introduce subtle bugs. These practices make it difficult
to reason about when values may be absent and hinder the effectiveness
of static analysis.

Migrating to strict null checks and enforcing strict equality
comparisons will clarify intent, reduce bugs, and make the codebase
safer and easier to maintain.

Fixes #466 

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
Co-authored-by: evanpelle <openfrontio@gmail.com>
2025-05-15 16:39:40 -07:00
evanpelle 1d0732d3d9 Refactor UnitSpecific info => AllUnitParams type union (#701)
## Description:

By using a type union we get better type safety, enforcing each unit
type have the appropriate params when initializing

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:
evan

---------

Co-authored-by: evan <openfrontio@gmail.com>
2025-05-10 11:40:47 -07:00
evan 8b37cccbc3 cleanup SAMLauncher execution, warheadTargers & target local variable instead of field 2025-04-26 09:31:17 -07:00
Evan 9de072c0c6 fix failing SAM test 2025-04-18 14:26:19 -07:00
Brandon Yi 0995b0a5e3 Increase SAM search radius and cap cost at 3mil (#529)
Fixes https://github.com/openfrontio/OpenFrontIO/issues/515

## Description:

Bumping SAM launcher search range from 75 to 100. Also, decreasing the
max cost of the SAM to 3 mil (down from 4.5mil)

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [X] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

bypie5

---------

Co-authored-by: APuddle210 <david.eskin@gmail.com>
2025-04-17 19:38:37 -07:00
Ilan Schemoul 8925f48ba7 sam protects againt mirv warhead (#376)
Fixes #483 

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors
![Capture d'écran 2025-03-30
174759](https://github.com/user-attachments/assets/8245723d-68de-4b96-ab19-5d85be18e4d9)


## Please put your Discord username so you can be contacted if a bug or
regression is found:
respectful pinguin
2025-04-17 19:02:50 -07:00
Evan da580eaebd sam has 100% chance to hit atom bomb 2025-04-10 14:28:51 -07:00
Evan 8b6895d745 add prettier import plugin 2025-03-31 13:09:27 -07:00
Readixyee 0891637eb2 MissileSilo cooldown (#309)
changed the sam cooldown to be a general cooldown function and added a
missilesilo cooldown

The function either adds the current tick as the starting point of the
cooldown or sets the cooldown to null and updates the unit. That way
getcooldown function can be used to get back the tick the cooldown was
started and can be compared to the cooldown set in the config.

changed the sam test / added a missilesilo test

---------

Co-authored-by: evanpelle <evanpelle@gmail.com>
2025-03-29 15:19:07 -07:00
evanpelle d8fe41de7a teams (#349) 2025-03-27 20:43:56 -07:00
Readixyee 665a8c3823 Executions dont switch owner (#326)
when an building is taken over by another player the execution for it
doesnt change its owner this makes it so when a sam is captured it tries
to intercept your own nukes and doesnt intercept the ones by the
previous player

this change makes executions of buildings automaticly switch their owner
2025-03-27 16:03:15 -07:00
Readixyee 6b07446965 unitgrid instead of defensepostgrid (#265)
added a unitgrid instead of a defensepostgrid for all units to be able
to see if a tile is inside the range of a unit by a custom distance

this is used for the sam launcher to draw a circle around the area it
protects

removed all parts that use the defensepostgrid and made it use the
unitgrid instead
2025-03-26 10:00:37 -07:00
Ilan Schemoul 68621f326a sam do not target twice same nuke (#270) 2025-03-21 10:17:33 -07:00
Ilan Schemoul 26bfb84b7b SAM rebalance (circle radius, faster speed, smaller range) (#266)
see commit
2025-03-18 20:37:49 -07:00
Ilan Schemoul 24f25d677a sam is red when reloading (#268) 2025-03-18 14:16:02 -07:00
Ilan Schemoul b2d9bb670a nerf SAM (#258)
More costly (start at 1.5M), increase cost cap (4.5M), biggest timeout
(5s->10s), much lower chance to stop hydrogen (70%->10%), triple
construction time (10s->30s) otherwise it's trivial to build a SAM right
before a nuke hits
2025-03-15 18:22:14 -07:00
Readixyee 84951fed9f Sam anti nuke missile launcher (#176)
now with better name

---------

Co-authored-by: evanpelle <evanpelle@gmail.com>
2025-03-09 13:25:51 -07:00