-
Notifications
You must be signed in to change notification settings - Fork 231
Mitigation for the exploding phantom tree bug #1605
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,31 @@ | ||||||||||||||||||||||
| fix/exploding-trees | ||||||||||||||||||||||
| =================== | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| .. dfhack-tool:: | ||||||||||||||||||||||
| :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. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| This script mitigates a longstanding Dwarf Fortress bug. | ||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||||||||||||||||||||||
|
Comment on lines
+12
to
+17
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||||||||||||||||||||||
|
Comment on lines
+19
to
+24
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Usage | ||||||||||||||||||||||
| ----- | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| :: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| fix/exploding-trees | ||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,45 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||
| -- 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 on lines
+1
to
+23
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no need for duplicating the documentation.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| function suppress_phantom_exploding_trees() | ||||||||||||||||||||||||||||||||||||||||||||||||
| for idx, tree in ipairs(df.global.world.plants.all) do | ||||||||||||||||||||||||||||||||||||||||||||||||
| if not tree.damage_flags.dead | ||||||||||||||||||||||||||||||||||||||||||||||||
| and tree.tree_info ~= nil | ||||||||||||||||||||||||||||||||||||||||||||||||
| and (tree.type == df.plant_type.DRY_TREE | ||||||||||||||||||||||||||||||||||||||||||||||||
| or tree.type == df.plant_type.WET_TREE) | ||||||||||||||||||||||||||||||||||||||||||||||||
| then | ||||||||||||||||||||||||||||||||||||||||||||||||
| local tt = dfhack.maps.getTileType(tree.pos) | ||||||||||||||||||||||||||||||||||||||||||||||||
| local is_trunk = df.tiletype.attrs[tt].material == df.tiletype_material.TREE | ||||||||||||||||||||||||||||||||||||||||||||||||
| if not is_trunk then | ||||||||||||||||||||||||||||||||||||||||||||||||
| tree.damage_flags.dead = true | ||||||||||||||||||||||||||||||||||||||||||||||||
| local announcement = string.format( | ||||||||||||||||||||||||||||||||||||||||||||||||
| "DFHack %s: phantom tree %d at location (%d,%d,%d) suppressed.", | ||||||||||||||||||||||||||||||||||||||||||||||||
| dfhack.current_script_name(), idx, tree.pos.x, tree.pos.y, tree.pos.z) | ||||||||||||||||||||||||||||||||||||||||||||||||
| dfhack.printerr(announcement) | ||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| suppress_phantom_exploding_trees() | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please fix! |
||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.