Hello, Groundbreaker!

Please use the feedback forum on this page the submit, upvote, downvote, and comment on bugs and suggestions created by you, the community. The Fire Hose team will use this tool to help prioritize your feedback.

Please Note: Before you create a new post, please take a moment to search and see if others have already covered the same topic.

Thank you for being here!

Notifications
Clear all

Flooring needs a LOT of work on state management

0
Topic starter

As I see it there are possibly 3 states the floor can be in and two events needed.

UnPowered = this tile has been created and no neighbor is powered

Powered     = at least one neighbor has power (placing a tile with a powered neighbor may require throwing an event so that any connected tiles that are UnPowered (default state of a power tile) will change state.

InUse         = an optional state where at least one neighbor has power and is in use by a machine. This may cause a raised event when the state changes from InUse to Powered so that any neighboring tiles change state in the event machinery is deleted. This is more complex since deleting a machine requires a check if that was the only machine connected to the floor. That management is a bit more complex. 

All lights on a tile will change based on the StateChange event of that tile 

UnPowered = no light (or maybe lights are red?)

Powered     = yellow

InUse         = white

 

So when a tile (or group of tiles) is/are placed the outer or solo tile(s) do the inspection and set the state, the setter of that state variable validates and sets the state and raises the StateChange event. This, at a minimum guarantees that when a group of tiles is added to a power floor, the lights reflect the real state of that tile. Today when a group of tiles are added to a power floor they remain dead. This sets a bad representation of the true state of that tile (which is powered)

Testing this code:

Place a number of floor tiles in the middle of nowhere. They remain in the UnPowered state.

Place a crank generator on top and crank it up. It probably needs to raise it's own state change event. All lights turn yellow. The generator is not a User machine so the state is always yellow.

Wait for generator to stop all of the lights turn off.

Crank the generator one more time and place a tile away from the powered group. It remains with lights off. Place another tile connecting the dead tile to the powered tiles. All tiles are yellow. 

Crank dies and all tiles including the new ones turn off.