From c2130763b478616069df8d36edb6b4a8dfe9148e Mon Sep 17 00:00:00 2001 From: John Doe Date: Thu, 19 Sep 2024 18:25:00 -0700 Subject: [PATCH] Moves HumanAI verbs to GM tab, adds a simple verb for fortifying rooms --- code/controllers/subsystem/human_ai.dm | 2 +- .../objects/structures/barricade/folding.dm | 12 ++++ .../structures/barricade/non_folding.dm | 13 ++++ .../objects/structures/barricade/sandbags.dm | 4 ++ code/modules/admin/admin_verbs.dm | 1 + .../action_datums/orders/patrol_waypoints.dm | 2 +- .../carbon/human/ai/ai_management_menu.dm | 4 +- .../human/ai/faction_management_panel.dm | 2 +- .../living/carbon/human/ai/fortify_room.dm | 67 +++++++++++++++++++ colonialmarines.dme | 1 + 10 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 code/modules/mob/living/carbon/human/ai/fortify_room.dm diff --git a/code/controllers/subsystem/human_ai.dm b/code/controllers/subsystem/human_ai.dm index 9450f0fe19..9d582c231f 100644 --- a/code/controllers/subsystem/human_ai.dm +++ b/code/controllers/subsystem/human_ai.dm @@ -34,7 +34,7 @@ SUBSYSTEM_DEF(human_ai) /datum/admins/proc/toggle_human_ai() set name = "Toggle Human AI" - set category = "Debug.HumanAI" + set category = "Game Master.HumanAI" if(!check_rights(R_DEBUG)) return diff --git a/code/game/objects/structures/barricade/folding.dm b/code/game/objects/structures/barricade/folding.dm index 8fe00d04a7..fc90b76400 100644 --- a/code/game/objects/structures/barricade/folding.dm +++ b/code/game/objects/structures/barricade/folding.dm @@ -289,3 +289,15 @@ repair_materials = list("metal" = 0.3, "plasteel" = 0.45) linkable = FALSE + +/obj/structure/barricade/plasteel/metal/wired/New() + can_wire = FALSE + is_wired = TRUE + climbable = FALSE + update_icon() + return ..() + +/obj/structure/barricade/plasteel/metal/wired/initialize_pass_flags(datum/pass_flags_container/PF) + ..() + flags_can_pass_front_temp &= ~PASS_OVER_THROW_MOB + flags_can_pass_behind_temp &= ~PASS_OVER_THROW_MOB diff --git a/code/game/objects/structures/barricade/non_folding.dm b/code/game/objects/structures/barricade/non_folding.dm index 575f1da738..1556e8cca4 100644 --- a/code/game/objects/structures/barricade/non_folding.dm +++ b/code/game/objects/structures/barricade/non_folding.dm @@ -294,3 +294,16 @@ barricade_type = "new_plasteel" repair_materials = list("plasteel" = 0.45) +/obj/structure/barricade/metal/plasteel/wired/New() + maxhealth += 50 + update_health(-50) + can_wire = FALSE + is_wired = TRUE + climbable = FALSE + update_icon() + return ..() + +/obj/structure/barricade/metal/plasteel/wired/initialize_pass_flags(datum/pass_flags_container/PF) + ..() + flags_can_pass_front_temp &= ~PASS_OVER_THROW_MOB + flags_can_pass_behind_temp &= ~PASS_OVER_THROW_MOB diff --git a/code/game/objects/structures/barricade/sandbags.dm b/code/game/objects/structures/barricade/sandbags.dm index 0e2b77b4c1..c08cd6d77a 100644 --- a/code/game/objects/structures/barricade/sandbags.dm +++ b/code/game/objects/structures/barricade/sandbags.dm @@ -133,6 +133,10 @@ health += 50 build_stage++ +/obj/structure/barricade/sandbags/full + +/obj/structure/barricade/sandbags/full/New(loc, mob/user, direction, amount = 5) + . = ..() /obj/structure/barricade/sandbags/wired/New() health = BARRICADE_SANDBAG_TRESHOLD_5 diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 2dc741cc5e..95a83117e8 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -79,6 +79,7 @@ GLOBAL_LIST_INIT(admin_verbs_default, list( /client/proc/open_human_faction_management_panel, /client/proc/create_human_ai, /client/proc/other_records, + /client/proc/fortify_room, )) diff --git a/code/modules/mob/living/carbon/human/ai/action_datums/orders/patrol_waypoints.dm b/code/modules/mob/living/carbon/human/ai/action_datums/orders/patrol_waypoints.dm index c3343ffa4f..6f77965e0a 100644 --- a/code/modules/mob/living/carbon/human/ai/action_datums/orders/patrol_waypoints.dm +++ b/code/modules/mob/living/carbon/human/ai/action_datums/orders/patrol_waypoints.dm @@ -56,7 +56,7 @@ /datum/admins/proc/create_human_ai_patrol() set name = "Create Human AI Patrol Waypoints" - set category = "Debug.HumanAI" + set category = "Game Master.HumanAI" if(!check_rights(R_DEBUG)) return diff --git a/code/modules/mob/living/carbon/human/ai/ai_management_menu.dm b/code/modules/mob/living/carbon/human/ai/ai_management_menu.dm index d3fb8a1ae9..28a5fdd359 100644 --- a/code/modules/mob/living/carbon/human/ai/ai_management_menu.dm +++ b/code/modules/mob/living/carbon/human/ai/ai_management_menu.dm @@ -116,7 +116,7 @@ /client/proc/open_human_ai_management_panel() set name = "Human AI Management Panel" - set category = "Debug.HumanAI" + set category = "Game Master.HumanAI" if(!check_rights(R_DEBUG)) return @@ -130,7 +130,7 @@ /client/proc/create_human_ai() set name = "Create Human AI" - set category = "Debug.HumanAI" + set category = "Game Master.HumanAI" if(!check_rights(R_DEBUG)) return diff --git a/code/modules/mob/living/carbon/human/ai/faction_management_panel.dm b/code/modules/mob/living/carbon/human/ai/faction_management_panel.dm index 6780255589..3fa21daca7 100644 --- a/code/modules/mob/living/carbon/human/ai/faction_management_panel.dm +++ b/code/modules/mob/living/carbon/human/ai/faction_management_panel.dm @@ -132,7 +132,7 @@ /client/proc/open_human_faction_management_panel() set name = "Human Faction Management Panel" - set category = "Debug.HumanAI" + set category = "Game Master.HumanAI" if(!check_rights(R_DEBUG)) return diff --git a/code/modules/mob/living/carbon/human/ai/fortify_room.dm b/code/modules/mob/living/carbon/human/ai/fortify_room.dm new file mode 100644 index 0000000000..9a970c937f --- /dev/null +++ b/code/modules/mob/living/carbon/human/ai/fortify_room.dm @@ -0,0 +1,67 @@ +/client/proc/fortify_room() + set name = "Fortify Room" + set category = "Game Master.HumanAI" + + if(!check_rights(R_DEBUG)) + return + + var/list/turf_list = list() + var/retval + + switch(tgui_input_list(mob, "How fortified should this be?", "Fortification Level", list("Wood", "Sandbag", "Sandbag (Wired)", "Metal", "Metal (Wired)", "Plasteel", "Plasteel (Wired)"))) + if("Wood") + retval = recursive_turf_room_fortify(get_turf(mob), turf_list, /obj/structure/barricade/wooden, null) + if("Sandbag") + retval = recursive_turf_room_fortify(get_turf(mob), turf_list, /obj/structure/barricade/sandbags/full, null) + if("Sandbag (Wired)") + retval = recursive_turf_room_fortify(get_turf(mob), turf_list, /obj/structure/barricade/sandbags/wired, null) + if("Metal") + retval = recursive_turf_room_fortify(get_turf(mob), turf_list, /obj/structure/barricade/metal, /obj/structure/barricade/plasteel/metal) + if("Metal (Wired)") + retval = recursive_turf_room_fortify(get_turf(mob), turf_list, /obj/structure/barricade/metal/wired, /obj/structure/barricade/plasteel/metal/wired) + if("Plasteel") + retval = recursive_turf_room_fortify(get_turf(mob), turf_list, /obj/structure/barricade/metal/plasteel, /obj/structure/barricade/plasteel) + if("Plasteel (Wired)") + retval = recursive_turf_room_fortify(get_turf(mob), turf_list, /obj/structure/barricade/metal/plasteel/wired, /obj/structure/barricade/plasteel/wired) + + if(retval) + to_chat(src, SPAN_NOTICE("Room fortified. Tiles scanned: [length(turf_list)].")) + else + to_chat(src, SPAN_NOTICE("Room too large to fully fortify. Capped at [length(turf_list)].")) + +/proc/recursive_turf_room_fortify(turf/scan_turf, list/turf_list, cade_type, folding_cade_type) + if(length(turf_list) > 256) + return FALSE // abort if the room is too large + if(istype(scan_turf, /turf/closed)) + return TRUE // abort if we're a wall + if(scan_turf in turf_list) + return TRUE // abort if we've already been scanned + if((locate(/obj/structure/machinery/door) in scan_turf) || (locate(/obj/structure/window_frame) in scan_turf) || (locate(/obj/structure/window) in scan_turf)) + return TRUE // abort if there's a door or window here + turf_list += scan_turf + for(var/cardinal in GLOB.cardinals) + var/turf/nearby_turf = get_step(scan_turf, cardinal) + if(!nearby_turf) + continue + + if((locate(/obj/structure/window_frame) in nearby_turf) || (locate(/obj/structure/window) in nearby_turf)) + for(var/obj/structure/barricade/existing_cade in scan_turf) + if(existing_cade.dir == cardinal) + goto next_recurse + + var/obj/structure/barricade/cade = new cade_type(scan_turf) + cade.setDir(cardinal) + + if(folding_cade_type && (locate(/obj/structure/machinery/door) in nearby_turf)) + for(var/obj/structure/barricade/existing_cade in scan_turf) + if(existing_cade.dir == cardinal) + goto next_recurse + + var/obj/structure/barricade/plasteel/cade = new folding_cade_type(scan_turf) + cade.setDir(cardinal) + cade.open(cade) // this closes it + + next_recurse: + if(!recursive_turf_room_fortify(nearby_turf, turf_list, cade_type, folding_cade_type)) + return FALSE + return TRUE diff --git a/colonialmarines.dme b/colonialmarines.dme index 5ee739c13f..14b6ace70b 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -1981,6 +1981,7 @@ #include "code\modules\mob\living\carbon\human\ai\ai_equipment.dm" #include "code\modules\mob\living\carbon\human\ai\ai_management_menu.dm" #include "code\modules\mob\living\carbon\human\ai\faction_management_panel.dm" +#include "code\modules\mob\living\carbon\human\ai\fortify_room.dm" #include "code\modules\mob\living\carbon\human\ai\action_datums\pickup_primary.dm" #include "code\modules\mob\living\carbon\human\ai\action_datums\throw_grenade.dm" #include "code\modules\mob\living\carbon\human\ai\action_datums\approach_target_carefully.dm"