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
Add 'on (first) load' option to ABMs or LBMs (or new 'on load ABM' API) #5303
Comments
I can foresee many advantages to expanding the functionality of ABMs. However, if the goal is to only execute an ABM once, then wouldn't it be more straightforward to just allow an "interval" of 0 with a chance of 1, then the ABM would execute for all the specified nodes exactly one time as soon as the mapblock is loaded or reloaded? Changing the implementation of LBMs as described does not seem in fitting with their intended purpose.
As an alternative, a specialized block modifier could be introduced for this purpose, with on_load( ) and on_unload( ) callbacks that are guaranteed to execute immediately after a mapblock is loaded or immediately before a mapblock is unloaded within the environment. The mapblock boundaries could be passed as a parameter to both callbacks. I'm just using XBM here for sake of example:
I understand that exposing mapblocks in this way is regarded by some core devs as bad form. So this latter solution might be deemed unacceptable. |
One of the reasons I did LBMs separate from ABMs and not just added it to ABMs was the neighbour search. Its computationally expensive and doesn't make sense when replacing nodes. |
I understand why it is like it is. But I think there is a need for something like l a "on load ABM" So maybe it is the wrong approach to modify the LBM. Maybe it is the better way to add some kind of "on (first) load) behavior to ABM's or to add some kind of new ABM that only run's on load |
Personally speaking, I would like to the reliability of LBMs addressed before modifying them for other purposes (right now LBMs are effectively broken, and basically useless). |
1+ year bump. Any core dev support? |
Let me bring this up in a different way. I know that the LBM's original purpose is to replace old nodes with new versions in existing maps. They are useless in new maps, except a mod will be updated (e.g. replace 2d torches with 3d)
But how about if they can also act like a one time ABM? I know that I can use register_on_generated in some cases, but it becomes more complicated if I want to search for nodes with a neighbor. I need to run find_node_near for each found node in a list. Even if Lua is fast this will be inefficient
Some examples for use cases:
To keep compatibility I propose a parameter like
one_time_ABM = true
, that is set to false by default. If the parameter is set to true the LBM behaves like an ABM, but just one time on each load or once at first load of the mapBecause the reason for this issue is mainly the search for neighbors, I will open a second issue to add neighbor search to find_node_near and find_nodes_in_area
The text was updated successfully, but these errors were encountered: