From 51751e3c1f2be3f23cb091a80405f6fbc1285c8f Mon Sep 17 00:00:00 2001 From: InsightfulParasite Date: Sat, 21 Oct 2023 17:11:57 -0400 Subject: [PATCH] Manager Commands Now Glow Update manager_camera.dm --- .../tegu_items/gadgets/unpowered.dm | 61 ++++--- .../game/machinery/computer/manager_camera.dm | 165 +++++++----------- .../temporary_visuals/miscellaneous.dm | 33 ++++ 3 files changed, 127 insertions(+), 132 deletions(-) diff --git a/ModularTegustation/tegu_items/gadgets/unpowered.dm b/ModularTegustation/tegu_items/gadgets/unpowered.dm index e1beedea043a..c97800a588bd 100644 --- a/ModularTegustation/tegu_items/gadgets/unpowered.dm +++ b/ModularTegustation/tegu_items/gadgets/unpowered.dm @@ -62,14 +62,18 @@ var/commandtype = 1 var/commanddelay = 1.5 SECONDS var/cooldown = 0 - var/static/list/commandtypes = typecacheof(list( - /obj/effect/temp_visual/commandMove, - /obj/effect/temp_visual/commandWarn, - /obj/effect/temp_visual/commandGaurd, - /obj/effect/temp_visual/commandHeal, - /obj/effect/temp_visual/commandFightA, - /obj/effect/temp_visual/commandFightB - )) + var/max_commands = 5 + //List of existing commands. Used for limiting the amount of commands that can exist. + var/list/current_commands = list() + //Command Types that can be deployed. Listed in order of commandtype. + var/list/commandtypes = list( + /obj/effect/temp_visual/HoloCommand/commandMove, + /obj/effect/temp_visual/HoloCommand/commandWarn, + /obj/effect/temp_visual/HoloCommand/commandGaurd, + /obj/effect/temp_visual/HoloCommand/commandHeal, + /obj/effect/temp_visual/HoloCommand/commandFightA, + /obj/effect/temp_visual/HoloCommand/commandFightB + ) /obj/item/commandprojector/attack_self(mob/user) ..() @@ -100,29 +104,30 @@ /obj/item/commandprojector/afterattack(atom/target, mob/user, proximity_flag) . = ..() if(cooldown <= world.time) - for(var/obj/effect/temp_visual/V in range(get_turf(target), 0)) - if(is_type_in_typecache(V, commandtypes)) - qdel(V) - return - switch(commandtype) - if(1) - new /obj/effect/temp_visual/commandMove(get_turf(target)) - if(2) - new /obj/effect/temp_visual/commandWarn(get_turf(target)) - if(3) - new /obj/effect/temp_visual/commandGaurd(get_turf(target)) - if(4) - new /obj/effect/temp_visual/commandHeal(get_turf(target)) - if(5) - new /obj/effect/temp_visual/commandFightA(get_turf(target)) - if(6) - new /obj/effect/temp_visual/commandFightB(get_turf(target)) - else - to_chat(user, "CALIBRATION ERROR.") + for(var/obj/effect/temp_visual/HoloCommand/V in get_turf(target)) + qdel(V) + return + if(!CheckHoloCapacity()) + to_chat(user, "COMMAND CAPACITY REACHED.") + return + if(commandtype > 0 && commandtype <= 6) + var/thing_to_spawn = commandtypes[commandtype] + var/thing_spawned = new thing_to_spawn(get_turf(target)) + current_commands += thing_spawned + else + to_chat(user, "CALIBRATION ERROR.") cooldown = world.time + commanddelay playsound(src, 'sound/machines/pda_button1.ogg', 20, TRUE) - +//Checks if we had exceeded our max amount of commands, checks if each command is real. +/obj/item/commandprojector/proc/CheckHoloCapacity() + if(current_commands.len > max_commands) + for(var/obj/effect/temp_visual/HoloCommand/i in current_commands) + if(QDELETED(i)) + current_commands -= i + if(current_commands.len > max_commands) + return FALSE + return TRUE //Deepscanner diff --git a/code/game/machinery/computer/manager_camera.dm b/code/game/machinery/computer/manager_camera.dm index de955806e188..cb54230f231f 100644 --- a/code/game/machinery/computer/manager_camera.dm +++ b/code/game/machinery/computer/manager_camera.dm @@ -17,21 +17,25 @@ var/datum/action/innate/managercommand/command var/datum/action/innate/manager_track/follow var/ammo = 6 - var/maxAmmo = 5 + var/max_ammo = 5 var/bullettype = 1 var/commandtype = 1 var/command_delay = 0.5 SECONDS var/command_cooldown + var/max_commands = 10 ///Variable stolen from AI. Essential for tracking feature. var/static/datum/trackable/track = new - var/static/list/commandtypes = typecacheof(list( - /obj/effect/temp_visual/commandMove, - /obj/effect/temp_visual/commandWarn, - /obj/effect/temp_visual/commandGaurd, - /obj/effect/temp_visual/commandHeal, - /obj/effect/temp_visual/commandFightA, - /obj/effect/temp_visual/commandFightB - )) + //List of existing commands. Used for limiting the amount of commands that can exist. + var/list/current_commands = list() + //Command Types sorted in order. + var/list/commandtypes = list( + /obj/effect/temp_visual/HoloCommand/commandMove, + /obj/effect/temp_visual/HoloCommand/commandWarn, + /obj/effect/temp_visual/HoloCommand/commandGaurd, + /obj/effect/temp_visual/HoloCommand/commandHeal, + /obj/effect/temp_visual/HoloCommand/commandFightA, + /obj/effect/temp_visual/HoloCommand/commandFightB + ) /// Used for radial menu; Type = list(name, desc, icon_state) var/list/bullet_types = list( HP_BULLET = list("name" = "HP-N", "desc" = "These bullets speed up the recovery of an employee.", "icon_state" = "green"), @@ -52,7 +56,7 @@ follow = new command_cooldown = world.time - RegisterSignal(SSdcs, COMSIG_GLOB_MELTDOWN_START, .proc/recharge_meltdown) + RegisterSignal(SSdcs, COMSIG_GLOB_MELTDOWN_START, .proc/RechargeMeltdown) /obj/machinery/computer/camera_advanced/manager/examine(mob/user) . = ..() @@ -88,12 +92,12 @@ follow.Grant(user) actions += follow - RegisterSignal(user, COMSIG_MOB_CTRL_CLICKED, .proc/on_hotkey_click) //wanted to use shift click but shift click only allowed applying the effects to my player. - RegisterSignal(user, COMSIG_XENO_TURF_CLICK_ALT, .proc/on_alt_click) + RegisterSignal(user, COMSIG_MOB_CTRL_CLICKED, .proc/HotkeyClick) //wanted to use shift click but shift click only allowed applying the effects to my player. + RegisterSignal(user, COMSIG_XENO_TURF_CLICK_ALT, .proc/altClick) RegisterSignal(user, COMSIG_MOB_SHIFTCLICKON, .proc/ManagerExaminate) /obj/machinery/computer/camera_advanced/manager/attackby(obj/item/O, mob/user, params) - if(istype(O, /obj/item/managerbullet) && ammo <= maxAmmo) + if(istype(O, /obj/item/managerbullet) && ammo <= max_ammo) ammo++ to_chat(user, "You load [O] in to the [src]. It now has [ammo] bullets stored.") playsound(get_turf(src), 'sound/weapons/kenetic_reload.ogg', 10, 0, 3) @@ -107,18 +111,18 @@ UnregisterSignal(user, COMSIG_MOB_SHIFTCLICKON) ..() -/obj/machinery/computer/camera_advanced/manager/proc/on_hotkey_click(datum/source, atom/clicked_atom) //system control for hotkeys +/obj/machinery/computer/camera_advanced/manager/proc/HotkeyClick(datum/source, atom/clicked_atom) //system control for hotkeys SIGNAL_HANDLER if(!isliving(clicked_atom)) return if(ishuman(clicked_atom)) - clickedemployee(source, clicked_atom) + clickedEmployee(source, clicked_atom) return if(ishostile(clicked_atom)) - clickedabno(source, clicked_atom) + clickedAbno(source, clicked_atom) return -/obj/machinery/computer/camera_advanced/manager/proc/clickedemployee(mob/living/owner, mob/living/carbon/employee) //contains carbon copy code of fire action +/obj/machinery/computer/camera_advanced/manager/proc/clickedEmployee(mob/living/owner, mob/living/carbon/employee) //contains carbon copy code of fire action if(ammo >= 1) var/mob/living/carbon/human/H = employee switch(bullettype) @@ -155,7 +159,7 @@ to_chat(owner, "NO TARGET.") return -/obj/machinery/computer/camera_advanced/manager/proc/clickedabno(mob/living/owner, mob/living/simple_animal/hostile/critter) +/obj/machinery/computer/camera_advanced/manager/proc/clickedAbno(mob/living/owner, mob/living/simple_animal/hostile/critter) if(ammo >= 1) var/mob/living/simple_animal/hostile/abnormality/ABNO = critter if(bullettype == 7) @@ -200,32 +204,36 @@ continue to_chat(user, "[i]: [resistance].") -/obj/machinery/computer/camera_advanced/manager/proc/on_alt_click(mob/living/user, turf/open/T) +/obj/machinery/computer/camera_advanced/manager/proc/altClick(mob/living/user, turf/open/T) var/mob/living/C = user if(command_cooldown <= world.time) + for(var/obj/effect/temp_visual/HoloCommand/V in T) + qdel(V) + return + if(!CheckHoloCapacity()) + to_chat(C, "COMMAND CAPACITY REACHED.") + return playsound(get_turf(src), 'sound/machines/terminal_success.ogg', 8, 3, 3) playsound(get_turf(T), 'sound/machines/terminal_success.ogg', 8, 3, 3) - for(var/obj/effect/temp_visual/V in range(T, 0)) - if(is_type_in_typecache(V, commandtypes)) - qdel(V) - return - switch(commandtype) - if(1) - new /obj/effect/temp_visual/commandMove(get_turf(T)) - if(2) - new /obj/effect/temp_visual/commandWarn(get_turf(T)) - if(3) - new /obj/effect/temp_visual/commandGaurd(get_turf(T)) - if(4) - new /obj/effect/temp_visual/commandHeal(get_turf(T)) - if(5) - new /obj/effect/temp_visual/commandFightA(get_turf(T)) - if(6) - new /obj/effect/temp_visual/commandFightB(get_turf(T)) - else - to_chat(C, "CALIBRATION ERROR.") + if(commandtype > 0 && commandtype <= 6) + var/thing_to_spawn = commandtypes[commandtype] + var/thing_spawned = new thing_to_spawn(get_turf(T)) + current_commands += thing_spawned + else + to_chat(C, "ERROR: Calibration Faliure.") commandtimer() +//Checks if we had exceeded our max amount of commands, checks if each command is real. +/obj/machinery/computer/camera_advanced/manager/proc/CheckHoloCapacity() + if(current_commands.len > max_commands) + for(var/obj/effect/temp_visual/HoloCommand/i in current_commands) + if(QDELETED(i)) + current_commands -= i + if(current_commands.len > max_commands) + return FALSE + return TRUE + +//Numerical Procs that alter variables /obj/machinery/computer/camera_advanced/manager/proc/commandtimer() command_cooldown = world.time + command_delay return @@ -238,13 +246,14 @@ commandtype = commandtype + amount return -/obj/machinery/computer/camera_advanced/manager/proc/recharge_meltdown() +/obj/machinery/computer/camera_advanced/manager/proc/RechargeMeltdown() playsound(get_turf(src), 'sound/weapons/kenetic_reload.ogg', 10, 0, 3) - maxAmmo += 0.25 - ammo = maxAmmo - -//Employee Tracking Code: Butchered AI Tracking + max_ammo += 0.25 + ammo = max_ammo +/*--------------------------------------------\ +|Employee Tracking Code: Butchered AI Tracking| +\--------------------------------------------*/ //Shows a list of creatures that can be tracked. /obj/machinery/computer/camera_advanced/manager/proc/TrackableCreatures() track.initialized = TRUE @@ -415,6 +424,7 @@ X.altercommandtype(-5) to_chat(owner, "MOVE IMAGE INITIALIZED.") button_icon_state = button_icon1 + UpdateButtonIcon() /datum/action/innate/managercommand name = "Deploy Command" @@ -430,62 +440,7 @@ var/obj/machinery/computer/camera_advanced/manager/X = E.origin var/cooldown = X.command_cooldown if(cooldown <= world.time) - playsound(get_turf(C), 'sound/machines/terminal_success.ogg', 8, 3, 3) - playsound(get_turf(E), 'sound/machines/terminal_success.ogg', 8, 3, 3) - switch(X.commandtype) - if(1) - new /obj/effect/temp_visual/commandMove(get_turf(E)) - - if(2) - new /obj/effect/temp_visual/commandWarn(get_turf(E)) - - if(3) - new /obj/effect/temp_visual/commandGaurd(get_turf(E)) - - if(4) - new /obj/effect/temp_visual/commandHeal(get_turf(E)) - - if(5) - new /obj/effect/temp_visual/commandFightA(get_turf(E)) - - if(6) - new /obj/effect/temp_visual/commandFightB(get_turf(E)) - - else - to_chat(owner, "CALIBRATION ERROR.") - X.commandtimer() - -// Temp Effects - -/obj/effect/temp_visual/commandMove - icon = 'ModularTegustation/Teguicons/lc13icons.dmi' - icon_state = "Move_here_wagie" - duration = 150 //15 Seconds - -/obj/effect/temp_visual/commandWarn - icon = 'ModularTegustation/Teguicons/lc13icons.dmi' - icon_state = "Watch_out_wagie" - duration = 150 - -/obj/effect/temp_visual/commandGaurd - icon = 'ModularTegustation/Teguicons/lc13icons.dmi' - icon_state = "Guard_this_wagie" - duration = 150 - -/obj/effect/temp_visual/commandHeal - icon = 'ModularTegustation/Teguicons/lc13icons.dmi' - icon_state = "Heal_this_wagie" - duration = 150 - -/obj/effect/temp_visual/commandFightA - icon = 'ModularTegustation/Teguicons/lc13icons.dmi' - icon_state = "Fight_this_wagie1" - duration = 150 - -/obj/effect/temp_visual/commandFightB - icon = 'ModularTegustation/Teguicons/lc13icons.dmi' - icon_state = "Fight_this_wagie2" - duration = 150 + X.altClick(C, get_turf(E)) /turf/open/AltClick(mob/user) SEND_SIGNAL(user, COMSIG_XENO_TURF_CLICK_ALT, src) @@ -499,7 +454,9 @@ #undef PALE_BULLET #undef YELLOW_BULLET -//Manager Camera Tracking Code + /*---------------------------\ + |Manager Camera Tracking Code| + \---------------------------*/ /datum/action/innate/manager_track name = "Follow Creature" desc = "Track a creature." @@ -536,7 +493,7 @@ /obj/machinery/computer/camera_advanced/manager/sephirah //crude and lazy but i think it may work. name = "sephirah camera console" ammo = 0 - maxAmmo = 0 + max_ammo = 0 /obj/machinery/computer/camera_advanced/manager/sephirah/Initialize(mapload) . = ..() @@ -569,11 +526,11 @@ follow.Grant(user) actions += follow - RegisterSignal(user, COMSIG_XENO_TURF_CLICK_ALT, .proc/on_alt_click) + RegisterSignal(user, COMSIG_XENO_TURF_CLICK_ALT, .proc/altClick) RegisterSignal(user, COMSIG_MOB_SHIFTCLICKON, .proc/ManagerExaminate) -/obj/machinery/computer/camera_advanced/manager/sephirah/clickedemployee() +/obj/machinery/computer/camera_advanced/manager/sephirah/clickedEmployee() return -/obj/machinery/computer/camera_advanced/manager/sephirah/recharge_meltdown() +/obj/machinery/computer/camera_advanced/manager/sephirah/RechargeMeltdown() return diff --git a/code/game/objects/effects/temporary_visuals/miscellaneous.dm b/code/game/objects/effects/temporary_visuals/miscellaneous.dm index e820e66c72ba..0bb12d1d280f 100644 --- a/code/game/objects/effects/temporary_visuals/miscellaneous.dm +++ b/code/game/objects/effects/temporary_visuals/miscellaneous.dm @@ -987,3 +987,36 @@ /obj/effect/temp_visual/house/proc/FadeOut() animate(src, alpha = 0, time = 1 SECONDS) + +/obj/effect/temp_visual/HoloCommand + icon = 'ModularTegustation/Teguicons/lc13icons.dmi' + light_range = 1.5 + light_power = 0.2 + light_system = MOVABLE_LIGHT + duration = 150 //15 Seconds + +/obj/effect/temp_visual/HoloCommand/commandMove + icon_state = "Move_here_wagie" + light_range = 1 + light_power = 1 + light_color = COLOR_VERY_LIGHT_GRAY + +/obj/effect/temp_visual/HoloCommand/commandWarn + icon_state = "Watch_out_wagie" + light_color = COLOR_PALE_RED_GRAY + +/obj/effect/temp_visual/HoloCommand/commandGaurd + icon_state = "Guard_this_wagie" + light_color = COLOR_VERY_SOFT_YELLOW + +/obj/effect/temp_visual/HoloCommand/commandHeal + icon_state = "Heal_this_wagie" + light_color = COLOR_VERY_PALE_LIME_GREEN + +/obj/effect/temp_visual/HoloCommand/commandFightA + icon_state = "Fight_this_wagie1" + light_color = COLOR_PALE_BLUE_GRAY + +/obj/effect/temp_visual/HoloCommand/commandFightB + icon_state = "Fight_this_wagie2" + light_color = COLOR_PALE_BLUE_GRAY