Rework grid to use timer instead of abm #10
Labels
No Label
Api
Game mechanic
orion
sparkmachine
v-next
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Reference: nephele/minetest-gamemode-orion#10
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Basically go from this:
-> abm checks all energy nodes
--> abm runs energy_distrib on master
-> random on_timer events on blocks on different timescales eat energy
To this:
-> net_master has a timer on a predictable timestamp
--> master force loads all members
--> energy_distrib is ran on master node
--> master node calls _sparktechwork (or similar function) on all nodes which perform work and eat energy
Each energy node would have a _sparktechwork function that does the actual sparktech related task, the on_timer function would be replaced with a default implementation from sparkapi. It will be enabled and disabled by the net rebuilding code automatically.
Also, use the "elapsed" function from on_timer to catch up lost stuff, this way, unlike an abm, we can catch up everything that should have happened in that time :D (assuming all sparkwork functions are coded to perform the operation and don't artificially delay anything)
Should also consider whether "enabled" state is considered for grid energy distribution