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

Fire: Remove ABM active when fire mod disabled #2209

Merged
merged 1 commit into from Sep 14, 2018

Conversation

Projects
None yet
2 participants
@paramat
Copy link
Member

commented Sep 4, 2018

Another ABM bites the dust.

When the fire mod is disabled it insanely still runs an ABM to remove basic_flame nodes. However, these nodes have node timers running on them, so instead we can just alter the node definition to remove the flame on timer expire.
The 'on_construct' function is also changed to immediately remove any placed basic_flame.

Tested, flames disappear one by one in a satisfying way due to being consistent with normal flame lifetime.

end,

on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(30, 60))

This comment has been minimized.

Copy link
@SmallJoker

SmallJoker Sep 4, 2018

Member

if not fire_enabled then return end before the node timer start. No need to duplicate the node definition code to cover both cases.

This comment has been minimized.

Copy link
@paramat

paramat Sep 5, 2018

Author Member

Heh ok i almost did this but thought it wouldn't work (should have checked). I thought that the setting would not be available within the functions.

This comment has been minimized.

Copy link
@SmallJoker

SmallJoker Sep 5, 2018

Member

It's a local variable, defined on load. So it will be available to the entire code in init.lua after its definition - it does not expire until the Lua instance is closed.

@paramat paramat added the WIP label Sep 5, 2018

@paramat paramat force-pushed the paramat:nofireabm branch from b2d078c to f36e8b0 Sep 5, 2018

@paramat paramat removed the WIP label Sep 5, 2018

@paramat

This comment has been minimized.

Copy link
Member Author

commented Sep 5, 2018

Updated as requested, tested and works.

@paramat

This comment has been minimized.

Copy link
Member Author

commented Sep 14, 2018

@paramat paramat merged commit be6fe9f into minetest:master Sep 14, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@paramat paramat deleted the paramat:nofireabm branch Oct 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.