@ -58,9 +58,71 @@ is equivalent to:
] ]
] ]
trade_cancel = defconf ( ' trade-cancel ' )
function trade_cancel . intercept_key ( key )
return dfhack.gui . matchFocusString ( " dwarfmode/Trade " ) and
( key == keys.LEAVESCREEN or key == MOUSE_RIGHT ) and
( trader_goods_selected ( screen ) or broker_goods_selected ( screen ) )
end
trade_cancel.title = " Cancel trade "
trade_cancel.message = " Are you sure you want leave this screen? \n Selected items will not be saved. "
haul_delete_route = defconf ( ' haul-delete-route ' )
function haul_delete_route . intercept_key ( key )
return df.global . game.main_interface . current_hover == 180 and key == MOUSE_LEFT
end
haul_delete_route.title = " Confirm deletion "
haul_delete_route.message = " Are you sure you want to delete this route? "
haul_delete_stop = defconf ( ' haul-delete-stop ' )
function haul_delete_stop . intercept_key ( key )
return df.global . game.main_interface . current_hover == 185 and key == MOUSE_LEFT
end
haul_delete_stop.title = " Confirm deletion "
haul_delete_stop.message = " Are you sure you want to delete this stop? "
depot_remove = defconf ( ' depot-remove ' )
function depot_remove . intercept_key ( key )
if df.global . game.main_interface . current_hover == 299 and
key == MOUSE_LEFT and
df.building_tradedepotst : is_instance ( dfhack.gui . getSelectedBuilding ( true ) ) then
for _ , caravan in pairs ( df.global . plotinfo.caravans ) do
if caravan.time_remaining > 0 then
return true
end
end
end
end
depot_remove.title = " Confirm depot removal "
depot_remove.message = " Are you sure you want to remove this depot? \n " ..
" Merchants are present and will lose profits. "
squad_disband = defconf ( ' squad-disband ' )
function squad_disband . intercept_key ( key )
return key == MOUSE_LEFT and df.global . game.main_interface . current_hover == 341
end
squad_disband.title = " Disband squad "
squad_disband.message = " Are you sure you want to disband this squad? "
order_remove = defconf ( ' order-remove ' )
function order_remove . intercept_key ( key )
return key == MOUSE_LEFT and df.global . game.main_interface . current_hover == 222
end
order_remove.title = " Remove manager order "
order_remove.message = " Are you sure you want to remove this order? "
zone_remove = defconf ( ' zone-remove ' )
function zone_remove . intercept_key ( key )
return key == MOUSE_LEFT and df.global . game.main_interface . current_hover == 130
end
zone_remove.title = " Remove zone "
zone_remove.message = " Are you sure you want to remove this zone? "
-- these confirmations have more complex button detection requirements
--[[
trade = defconf ( ' trade ' )
trade = defconf ( ' trade ' )
function trade . intercept_key ( key )
function trade . intercept_key ( key )
return false --dfhack.gui.matchFocusString("dwarfmode/Trade") and key == MOUSE_LEFT and hovering over trade button?
dfhack.gui . matchFocusString ( " dwarfmode/Trade " ) and key == MOUSE_LEFT and hovering over trade button ?
end
end
trade.title = " Confirm trade "
trade.title = " Confirm trade "
function trade . get_message ( )
function trade . get_message ( )
@ -81,16 +143,7 @@ function trade.get_message()
end
end
end
end
trade_cancel = defconf ( ' trade-cancel ' )
trade_seize = defconf ( ' trade-seize ' )
function trade_cancel . intercept_key ( key )
return dfhack.gui . matchFocusString ( " dwarfmode/Trade " ) and
( key == keys.LEAVESCREEN or key == MOUSE_RIGHT ) and
( trader_goods_selected ( screen ) or broker_goods_selected ( screen ) )
end
trade_cancel.title = " Cancel trade "
trade_cancel.message = " Are you sure you want leave this screen? \n Selected items will not be saved. "
--[[trade_seize = defconf('trade-seize')
function trade_seize . intercept_key ( key )
function trade_seize . intercept_key ( key )
return screen.in_edit_count == 0 and
return screen.in_edit_count == 0 and
trader_goods_selected ( screen ) and
trader_goods_selected ( screen ) and
@ -121,46 +174,9 @@ function trade_select_all.intercept_key(key)
end
end
trade_select_all.title = " Confirm selection "
trade_select_all.title = " Confirm selection "
trade_select_all.message = " Selecting all goods will overwrite your current selection \n " ..
trade_select_all.message = " Selecting all goods will overwrite your current selection \n " ..
" and cannot be undone. Continue? " --]]
" and cannot be undone. Continue? "
haul_delete_route = defconf ( ' haul-delete-route ' )
uniform_delete = defconf ( ' uniform-delete ' )
function haul_delete_route . intercept_key ( key )
return df.global . game.main_interface . current_hover == 180 and key == MOUSE_LEFT
end
haul_delete_route.title = " Confirm deletion "
haul_delete_route.message = " Are you sure you want to delete this route? "
haul_delete_stop = defconf ( ' haul-delete-stop ' )
function haul_delete_stop . intercept_key ( key )
return df.global . game.main_interface . current_hover == 185 and key == MOUSE_LEFT
end
haul_delete_stop.title = " Confirm deletion "
haul_delete_stop.message = " Are you sure you want to delete this stop? "
depot_remove = defconf ( ' depot-remove ' )
function depot_remove . intercept_key ( key )
if df.global . game.main_interface . current_hover == 299 and
key == MOUSE_LEFT and
df.building_tradedepotst : is_instance ( dfhack.gui . getSelectedBuilding ( true ) ) then
for _ , caravan in pairs ( df.global . plotinfo.caravans ) do
if caravan.time_remaining > 0 then
return true
end
end
end
end
depot_remove.title = " Confirm depot removal "
depot_remove.message = " Are you sure you want to remove this depot? \n " ..
" Merchants are present and will lose profits. "
squad_disband = defconf ( ' squad-disband ' )
function squad_disband . intercept_key ( key )
return key == MOUSE_LEFT and df.global . game.main_interface . current_hover == 341
end
squad_disband.title = " Disband squad "
squad_disband.message = " Are you sure you want to disband this squad? "
--[[uniform_delete = defconf('uniform-delete')
function uniform_delete . intercept_key ( key )
function uniform_delete . intercept_key ( key )
return key == keys.D_MILITARY_DELETE_UNIFORM and
return key == keys.D_MILITARY_DELETE_UNIFORM and
screen.page == screen._type . T_page.Uniforms and
screen.page == screen._type . T_page.Uniforms and
@ -189,17 +205,6 @@ end
route_delete.title = " Delete route "
route_delete.title = " Delete route "
route_delete.message = " Are you sure you want to delete this route? "
route_delete.message = " Are you sure you want to delete this route? "
location_retire = defconf ( ' location-retire ' )
function location_retire . intercept_key ( key )
return key == keys.LOCATION_RETIRE and
( screen.menu == df.viewscreen_locationsst . T_menu.Locations or
screen.menu == df.viewscreen_locationsst . T_menu.Occupations ) and
screen.in_edit == df.viewscreen_locationsst . T_in_edit.None and
screen.locations [ screen.location_idx ]
end
location_retire.title = " Retire location "
location_retire.message = " Are you sure you want to retire this location? "
convict = defconf ( ' convict ' )
convict = defconf ( ' convict ' )
convict.title = " Confirm conviction "
convict.title = " Confirm conviction "
function convict . intercept_key ( key )
function convict . intercept_key ( key )
@ -214,15 +219,22 @@ function convict.get_message()
return " Are you sure you want to convict " .. name .. " ? \n " ..
return " Are you sure you want to convict " .. name .. " ? \n " ..
" This action is irreversible. "
" This action is irreversible. "
end
end
] ] --
order_remove = defconf ( ' order-remove ' )
-- locations cannot be retired currently
function order_remove . intercept_key ( key )
--[[
return key == keys.MANAGER_REMOVE and
location_retire = defconf ( ' location-retire ' )
not screen.in_max_workshops
function location_retire . intercept_key ( key )
return key == keys.LOCATION_RETIRE and
( screen.menu == df.viewscreen_locationsst . T_menu.Locations or
screen.menu == df.viewscreen_locationsst . T_menu.Occupations ) and
screen.in_edit == df.viewscreen_locationsst . T_in_edit.None and
screen.locations [ screen.location_idx ]
end
end
order_remove.title = " Remove manager order "
location_retire.title = " Retire location "
order_remove.message = " Are you sure you want to remove this order? "
location_retire.message = " Are you sure you want to retire this location ?"
] ] --
] ] --
-- End of confirmation definitions
-- End of confirmation definitions
function check ( )
function check ( )