Commit Graph

73 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
Léo Kosman 87fd9c3219 Feat : focus unit when clicking on warnings in chat (#699)
## Description:

Enables you to click on the `Naval invasion incoming from X` or `X -
atom bomb inbound` messages to focus the camera on the incoming unit
(boat or nuke). Works for boats, atom bombs, hydrogen bombs and MIRVs.

Nothing changes in looks, only the fact that the messages are clickable.

closes #641 

## 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:

leo21_
2025-05-14 17:18:46 -04:00
DevelopingTom 7c163e2361 Curved nuke trajectory (#734)
## Description:

Change nuke trajectory to follow a curve, and add a trail behind them.


![image](https://github.com/user-attachments/assets/f0fac8a0-d173-4e13-a889-3d19c36f85b8)

### Details:
- Use a look-up table to approximate the distance travelled, so the
speed remains constant along the curve
- The nuke speed is higher than a single pixel, so draw a line behind
for the trail
- Added a new "utility" file for the Bresenham/Bezier algorith: please
tell me if that's ok

### Edge cases (literally the edges):
The control points remains in the map so the curve can never go outside:


![image](https://github.com/user-attachments/assets/bb3a02fd-d76d-4643-a123-8bbc48c0ca87)



## 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:

<DISCORD USERNAME>

---------

Co-authored-by: Scott Anderson <scottanderson@users.noreply.github.com>
2025-05-13 01:30:31 -04: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 b13029591d bugfix: Path.Mini was modified to only pathfinding on water, which broke nukes. Created AirPathfinder class to handle pathfinding for nukes 2025-04-23 13:04:33 -07:00
Evan 53a30899c6 only check break allainces on detonation, not everyt tick 2025-04-05 10:55:39 -07:00
Scott Anderson 729920bdca Avoid sqrt for euclideanDist function (#395)
## Description:

In most cases we do not need to solve for the hypotenuse length and can
do math directly on the square of the hypotenuse. For example, the
common use case for calculating euclidean distance is to check if two
points are within a certain distance of each other. In this case,
`Math.sqrt(x*x + y*y) < d` can be rewritten as `x*x + y*y < d*d`.

## 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:

fake.neo

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
2025-04-05 10:17:29 -07:00
Evan 21752aa214 add perf improvements: don't draw full boat tail, make nukes calculations slightly more efficient 2025-04-05 10:10:15 -07:00
Evan 8b6895d745 add prettier import plugin 2025-03-31 13:09:27 -07:00
Ilan Schemoul 11791719e4 nukes now reduce attacking troops and transport ships (same as rest of pop) (#350)
Co-authored-by: Evan <evanpelle@gmail.com>
2025-03-31 12:39:18 -07:00
Ilan Schemoul 80ece56268 fix crash (#371) 2025-03-30 10:42:31 -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
Ilan Schemoul 68621f326a sam do not target twice same nuke (#270) 2025-03-21 10:17:33 -07:00
Ilan Schemoul 3ce5785d1e nuke icon (#207)
- **feat: white nuke icon next to name if player nukes you**
![Capture d'écran 2025-03-10
220439](https://github.com/user-attachments/assets/1b717b2d-bffb-45fc-96ea-2feb57d25de0)
- **feat: red nuke icon if player sends nuke towards you**
- 
![Capture d'écran 2025-03-10
220358](https://github.com/user-attachments/assets/b755fa06-9510-4bd1-8312-7180dc681d85)
2025-03-11 15:44:45 -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
evanpelle 09132495c0 Revert "have MIRV target all non allied players, increase price to 25… (#181)
… million"

This reverts commit 226112beb5.
2025-03-08 10:58:46 -08:00
Evan 226112beb5 have MIRV target all non allied players, increase price to 25 million 2025-03-03 20:46:28 -08:00
ilan schemoul fc7b08402f feat: stats system to see number of nukes sent by a player in PlayerPanel 2025-03-02 21:41:00 +01:00
Evan 6e76503d5d alert when nuke inbound 2025-02-19 19:45:10 -08:00
Evan c4aaa619af have nukes cause more damage 2025-02-18 19:59:06 -08:00
Evan 5e6f8f5d91 validate all intent input 2025-02-18 16:26:49 -08:00
Evan 0d4f91a52a make h-bomb smaller, make mirv 15 million 2025-02-14 08:01:46 -08:00
Evan 5c85ac36fc rebalance nukes 2025-02-12 14:25:31 -08:00
Evan 40966ca3b9 format all files with prettier 2025-02-12 08:28:15 -08:00
Evan 150887d593 rebalance MIRV 2025-02-10 19:59:37 -08:00
Evan df8fc4208e make hydrogen bomb slighly smaller 2025-02-10 18:01:34 -08:00
Evan a7b3209ad7 Improve mirv: give it arc 2025-02-04 19:50:18 -08:00
Evan b643a6357b implement mirv 2025-02-04 11:53:41 -08:00
Evan 4ee37323f9 format codebase with prettier 2025-02-01 12:05:11 -08:00
evanpelle 75fe718f16 Combine Unit & MutableUnit 2025-02-01 12:05:11 -08:00
evanpelle de1dbff570 combine Game & MutableGame 2025-02-01 12:05:11 -08:00
evanpelle 7d15c0c065 combine Player & MutablePlayer interfaces 2025-02-01 12:05:11 -08:00
Evan f0f5bae79f thread_split: convert all tile to tileref 2025-02-01 12:05:11 -08:00
evanpelle b22532d41f use TileRef instead of TerrainTile for astar 2025-02-01 12:05:11 -08:00
Evan dab427d614 put methods onto terraintile 2025-02-01 12:05:11 -08:00
Evan f4c98318b6 Show player relations in player info overlay 2024-12-30 09:40:16 -08:00
Evan a159c50160 bugfix: NPCs not reseting enemy correctly, don't flip off NPCs, NPCs send messages to enemy 2024-12-27 20:56:07 -08:00
Evan ac1d0c0378 Add relations, NPCs attack enemies using relation, NPCs attack targeted players 2024-12-27 16:53:56 -08:00
Evan fa3b3478b7 don't delete nukes when player dies. was creating a an error because nukeexecution tried deleting inactive unit. 2024-12-26 09:56:12 -08:00
Evan 422f4bdfac rebalance nukes, make fallout much harder to recapture 2024-12-20 20:31:41 -08:00
evanpelle ff02d9d8b6 have core/ directory use consolex for remote logging 2024-12-18 12:00:00 -08:00
evanpelle c13bb1eef9 don't display unit deleted message when tranpsort ship lands 2024-12-11 16:49:23 -08:00
evanpelle 13f186da5f only break alliance if more than 100 tiles destroyed on nuke 2024-12-10 20:28:39 -08:00
evanpelle 5c51655eca add radiation 2024-12-04 13:21:35 -08:00
evanpelle e6fa108eaa use mini a star for all pathfinding 2024-12-03 15:06:55 -08:00
evanpelle 4edd66dc1f AStar returns cell instead of path 2024-12-03 14:35:09 -08:00
Evan 020d193667 create async path finder, trade ships use async when captured 2024-11-29 15:41:13 -08:00
Evan 3e4f4e42cf created path finding web worker 2024-11-29 11:34:03 -08:00
evanpelle 3137611ab3 make nukes destroy more troops 2024-11-25 19:13:15 -08:00
Evan 9af75331e2 update alliance() 2024-11-25 14:10:17 -08:00