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

Fix Issues 3,4,5 #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

robot256
Copy link

Here are my fixes for the bugs I identified. Summary of changes:

  • OnTick reads all stations' circuit signals before renaming any of them (by deleting and rebuilding them). This allows multiple stations on the same circuit network to be renamed correctly. ( Multiple Stringy stops wired together do not update #5)
  • global.stringyStations is maintained only in the global list, rather than a local variable, to ensure saving/loading the game is as reliable as possible.
  • gloabl.stringyStations is indexed by the unit_number of the train stop, rather than the surface coordinates. This is faster, will work on multiple surfaces, and will not accidentally delete the wrong unit during fast-replace. (Not updating on fast-replace #3)
  • Added handlers for all possible create/delete events to maintain the global.stringyStations list of active entities.
  • Added "raise_destroy=true" flag to destroying the train stop while renaming, which removes it from the global.stringyStations list as well as any other mod's lists. (Does not call script_raised_destroy #4)

I have not yet tested if any of these changes impact the stringy schedule programming features.

- No longer cache the global table in the local Lua session.  Always reference global.stringyStations[] for best performance.
- Store global.stringStations[] as a dictionary instead of a list, mapping LuaEntity::unit_number -> LuaEntity handle.
- Add debug printing console options.
- Handle additional events for adding and removing stations from the list.
- Rebuild the station list when the mod version changes to make sure it is stored in the correct format.
- Reverted to the old renameStringyStation method.
- Added the raise_destroy=true and create_build_smoke_effect=false flags to the destroy and create_entity calls.
- Changed updateStringyStation to only return a station to rename.  OnTick makes a list of stations to rename, and doesn't change any of them until all have been processed.  This is necessary when the global table is indexed by unit_number, and also solves the issue of circuit wires being disconnected before all connected stations have been checked.
@robot256 robot256 changed the title Fix #3, #4, #5 Fix Issues 3,4,5 Feb 14, 2020
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.

None yet

1 participant