@@ -119,6 +119,10 @@ local function is_construction()
119119 return uibs .building_type == df .building_type .Construction
120120end
121121
122+ local function is_siege_engine ()
123+ return uibs .building_type == df .building_type .SiegeEngine
124+ end
125+
122126local function tile_is_construction (pos )
123127 local tt = dfhack .maps .getTileType (pos )
124128 if not tt then return false end
@@ -605,7 +609,7 @@ function PlannerOverlay:init()
605609
606610 local main_panel = widgets .Panel {
607611 view_id = ' main' ,
608- frame = {t = 1 , l = 0 , r = 0 , h = 14 },
612+ frame = {t = 1 , l = 0 , r = 0 , h = 15 },
609613 frame_style = gui .FRAME_INTERIOR_MEDIUM ,
610614 frame_background = gui .CLEAR_PEN ,
611615 visible = self :callback (' is_not_minimized' ),
@@ -743,6 +747,24 @@ function PlannerOverlay:init()
743747 buildingplan .setSpecial (uibs .building_type , uibs .building_subtype , uibs .custom_type , ' engraved' , val )
744748 end ,
745749 },
750+ widgets .CycleHotkeyLabel {
751+ view_id = ' siege_facing' ,
752+ frame = {b = 4 , l = 1 , w = 28 },
753+ key = ' CUSTOM_T' ,
754+ key_back = ' CUSTOM_SHIFT_T' ,
755+ label = ' Facing:' ,
756+ visible = is_siege_engine ,
757+ options = {
758+ {label = ' North' ,value = 0 },
759+ {label = ' Northeast' ,value = 1 },
760+ {label = ' East' ,value = 2 },
761+ {label = ' Southeast' ,value = 3 },
762+ {label = ' South' ,value = 4 },
763+ {label = ' Southwest' ,value = 5 },
764+ {label = ' West' ,value = 6 },
765+ {label = ' Northwest' ,value = 7 },
766+ },
767+ },
746768 widgets .ToggleHotkeyLabel {
747769 view_id = ' empty' ,
748770 frame = {b = 4 , l = 1 , w = 22 },
@@ -829,7 +851,7 @@ function PlannerOverlay:init()
829851 }
830852
831853 local divider_widget = widgets .Divider {
832- frame = {t = 10 , l = 0 , r = 0 , h = 1 },
854+ frame = {t = 11 , l = 0 , r = 0 , h = 1 },
833855 frame_style = gui .FRAME_INTERIOR_MEDIUM ,
834856 visible = self :callback (' is_not_minimized' ),
835857 }
@@ -1307,10 +1329,16 @@ function PlannerOverlay:place_building(placement_data, chosen_items)
13071329 if is_stairs () then
13081330 subtype = self :get_stairs_subtype (pos , pd )
13091331 end
1332+ local fields = {}
1333+ if is_siege_engine () then
1334+ local val = self .subviews .siege_facing :getOptionValue ()
1335+ fields .facing = val
1336+ fields .resting_orientation = val
1337+ end
13101338 local bld , err = dfhack .buildings .constructBuilding {pos = pos ,
13111339 type = uibs .building_type , subtype = subtype , custom = uibs .custom_type ,
13121340 width = pd .width , height = pd .height ,
1313- direction = uibs .direction , filters = filters }
1341+ direction = uibs .direction , filters = filters , fields = fields }
13141342 if err then
13151343 -- it's ok if some buildings fail to build
13161344 goto continue
0 commit comments