v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Editing User:Fleeting Frames/UnsuspendSelectedBuilding

Jump to navigation Jump to search

Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.


The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 33: Line 33:
 
end
 
end
  
function AnnounceEnd(bldName)
+
function AnnounceEnd(bld)
 
dfhack.gui.makeAnnouncement(
 
dfhack.gui.makeAnnouncement(
 
df.announcement_type.QUOTA_FILLED,
 
df.announcement_type.QUOTA_FILLED,
 
{D_DISPLAY = true},
 
{D_DISPLAY = true},
 
xyz2pos(bld.centerx,bld.centery, bld.z),
 
xyz2pos(bld.centerx,bld.centery, bld.z),
"Ended building " .. bldName .. ".",
+
"Completed building " .. utils.getBuildingName(bld) .. ".",
 
COLOR_GREEN,
 
COLOR_GREEN,
 
true)
 
true)
Line 58: Line 58:
 
if bldjob then
 
if bldjob then
 
local myBldStr=tostring(bld)
 
local myBldStr=tostring(bld)
local myBldName = utils.getBuildingName(bld) --bld is lost on constructions, which means ending the loop would segfault due nil
 
 
if(watchedbuildings[myBldStr] ~= false) then --don't set repeatfunc when there's already one
 
if(watchedbuildings[myBldStr] ~= false) then --don't set repeatfunc when there's already one
 
repeatfunction(
 
repeatfunction(
 
function()
 
function()
if(watchedbuildings[myBldStr]) then
+
if(watchedbuildings[myBldStr]) then  
 
local bld = df.building.find(watchedbuildings[myBldStr])
 
local bld = df.building.find(watchedbuildings[myBldStr])
 
local bldjob = bld and getConstructionJob(bld)
 
local bldjob = bld and getConstructionJob(bld)
if bld and bldjob and bld.flags.exists == false then
+
if bld and bldjob then
 
bldjob.flags.suspend=false
 
bldjob.flags.suspend=false
return true
+
if bld.flags.exists == false then
 +
return true
 +
end
 
end
 
end
 
end
 
end
print("ending..")
+
watchedbuildings[tostring(bld)] = nil --if didn't return, end is at hand
watchedbuildings[myBldStr] = nil --if didn't return, end is at hand
+
AnnounceEnd(bld)  
AnnounceEnd(myBldName)  
 
 
end
 
end
 
)
 
)

Please note that all contributions to Dwarf Fortress Wiki are considered to be released under the GFDL & MIT (see Dwarf Fortress Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)

This page is a member of 1 hidden category: