Skip to content

Mitigation for the exploding phantom tree bug - #1605

Draft
SilasD wants to merge 3 commits into
masterfrom
exploding-trees
Draft

Mitigation for the exploding phantom tree bug#1605
SilasD wants to merge 3 commits into
masterfrom
exploding-trees

Conversation

@SilasD

@SilasD SilasD commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

this is closely based on ab9rf's work:
https://discord.com/channels/793331351645323264/807444515194798090/1537901782515318876
more discussion in DFHack Discord #feature-discuss
https://discord.com/channels/793331351645323264/807444515194798090/1537577051073290281
and in Kitfox Discord #bug-discussion
https://discord.com/channels/329272032778780672/1049402643342168114/1537342125543530507

verified that this runs ok.

accidentally pushed directly to the main scripts repo.
guess that's because I have privileges now.
glad I was in a new branch. guess I'll continue.

@chdoc chdoc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks technically solid, I just had some comments on the documentation. You went a bit overboard on paragraphs. If a sentence uses references like "these" to expand on a previous sentence, I wouldn't put a paragraph break in between.

Comment thread fix/exploding-trees.lua
Comment on lines +1 to +23
-- removes "phantom" trees before they can explode.
--[====[
fix/exploding-trees
===================

By default, this script runs once a month by the Control Panel's Bug Fixes tab.

This script mitigates a longstanding Dwarf Fortress bug.

Once a year, trees check if they should grow. The exact day and time of this
growth is different for every tree.

Occasionally, when a tree is cut down or otherwise removed from the game, the
game engine doesn't remove the tree's data from the list of plants. The exact
details of this are not currently understood.

For some reason, these "phantom" trees will sometimes collapse during this
growth. This can stun, injure, or kill units which happen to be near this
collapse.

This script finds those trees and sets their dead flag, preventing them from
growing and collapsing.
--]====]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for duplicating the documentation.

Suggested change
-- removes "phantom" trees before they can explode.
--[====[
fix/exploding-trees
===================
By default, this script runs once a month by the Control Panel's Bug Fixes tab.
This script mitigates a longstanding Dwarf Fortress bug.
Once a year, trees check if they should grow. The exact day and time of this
growth is different for every tree.
Occasionally, when a tree is cut down or otherwise removed from the game, the
game engine doesn't remove the tree's data from the list of plants. The exact
details of this are not currently understood.
For some reason, these "phantom" trees will sometimes collapse during this
growth. This can stun, injure, or kill units which happen to be near this
collapse.
This script finds those trees and sets their dead flag, preventing them from
growing and collapsing.
--]====]

Comment thread fix/exploding-trees.lua
end
end

suppress_phantom_exploding_trees() No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix!

:summary: Removes "phantom" trees before they can explode.
:tags: fort bugfix

By default, this script runs once a month by the Control Panel's Bug Fixes tab.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
By default, this script runs once a month by the Control Panel's Bug Fixes tab.
By default, this script is run once a month by the control panel. This can be disabled in the ``Bug Fixes`` tab.


By default, this script runs once a month by the Control Panel's Bug Fixes tab.

This script mitigates a longstanding Dwarf Fortress bug.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This script mitigates a longstanding Dwarf Fortress bug.
This script mitigates the "exploding trees" bug in Dwarf Fortress.

Comment on lines +12 to +17
Once a year, trees check if they should grow. The exact day and time of this
growth is different for every tree.

Occasionally, when a tree is cut down or otherwise removed from the game, the
game engine doesn't remove the tree's data from the list of plants. The exact
details of this are not currently understood.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Once a year, trees check if they should grow. The exact day and time of this
growth is different for every tree.
Occasionally, when a tree is cut down or otherwise removed from the game, the
game engine doesn't remove the tree's data from the list of plants. The exact
details of this are not currently understood.
Once a year, trees check if they should grow. The exact day and time of this
growth is different for every tree. Occasionally, when a tree is cut down or
otherwise removed from the game, the game engine doesn't remove the tree's
data from the list of plants. The exact details of this are not currently understood.

Comment on lines +19 to +24
For some reason, these "phantom" trees will sometimes collapse during this
growth. This can stun, injure, or kill units which happen to be near this
collapse.

This script finds those trees and sets their dead flag, preventing them from
growing and collapsing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For some reason, these "phantom" trees will sometimes collapse during this
growth. This can stun, injure, or kill units which happen to be near this
collapse.
This script finds those trees and sets their dead flag, preventing them from
growing and collapsing.
These "phantom" trees will sometimes collapse during this growth. This
can stun, injure, or kill units which happen to be near this collapse. This
script finds those trees and sets their dead flag, preventing them from
growing and collapsing.

@ab9rf

ab9rf commented Aug 21, 2026

Copy link
Copy Markdown
Member

Community feedback has determined that setting the vegst to DEAD is not enough to mitigate the bug; we have to actually delete the vegst in question. This is significantly harder to do. It may make more sense to fold this into the existing plants plugin, which (as I recall) already has some of the code needed for this.

@SilasD
SilasD marked this pull request as draft August 22, 2026 15:08
@SilasD

SilasD commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

okay, converting this to draft.

I think I'll still finish out the requested changes, as practice. today or tomorrow.

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.

3 participants