Skip to content

Commit

Permalink
Moves HumanAI verbs to GM tab, adds a simple verb for fortifying rooms
Browse files Browse the repository at this point in the history
  • Loading branch information
Zonespace27 committed Sep 20, 2024
1 parent 7d6a687 commit c213076
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 5 deletions.
2 changes: 1 addition & 1 deletion code/controllers/subsystem/human_ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions code/game/objects/structures/barricade/folding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions code/game/objects/structures/barricade/non_folding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions code/game/objects/structures/barricade/sandbags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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,
))


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/carbon/human/ai/ai_management_menu.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
67 changes: 67 additions & 0 deletions code/modules/mob/living/carbon/human/ai/fortify_room.dm
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c213076

Please sign in to comment.