Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework power tower syncing #627

Merged
merged 2 commits into from
Dec 28, 2023
Merged

Conversation

starfi5h
Copy link
Collaborator

@starfi5h starfi5h commented Dec 28, 2023

Replace the vanilla logic of power chargers and simply sync ON/OFF state.

PowerTowerManager now only maintains two pool, one is LocalChargerIds which stores all nodeIds of power chargers charging the local player. When add/remove nodeId from LocalChargerIds, it is broadcast to other players and stored in RemoteChargerHashIds as 64 bits hashIds, which planetId is the upper bits and nodeId is the lower bits.

If the player is in range of the charger, or RemoteChargerHashIds contains the id, then the charger will be set to working state, otherwise, it is set to idle state.

The pools are reset and recalculated whenever a player is disconnected to prevent persistent energy charges.
Fix #448 #470

Replace vanilla logic of power charger and simply sync ON/OFF state.
Copy link
Collaborator

@PhantomGamers PhantomGamers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@starfi5h starfi5h merged commit 1912e99 into NebulaModTeam:0.10.x Dec 28, 2023
1 check passed
@starfi5h starfi5h deleted the pr-powerCharger branch December 28, 2023 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants