Skip to content

Commit

Permalink
Egors Suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
InsightfulParasite committed Nov 15, 2023
1 parent b3522e0 commit bac9cc4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 27 deletions.
21 changes: 7 additions & 14 deletions ModularTegustation/tegu_items/gadgets/unpowered.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
var/commandtype = 1
var/commanddelay = 1.5 SECONDS
var/cooldown = 0
//Used for limiting the amount of commands that can exist.
var/current_commands = 0
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,
Expand Down Expand Up @@ -107,28 +107,21 @@
for(var/obj/effect/temp_visual/HoloCommand/V in get_turf(target))
qdel(V)
return
if(!CheckHoloCapacity())
if(current_commands >= max_commands)
to_chat(user, "<span class='warning'>COMMAND CAPACITY REACHED.</span>")
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
current_commands++
RegisterSignal(thing_spawned, COMSIG_PARENT_QDELETING, .proc/ReduceCommandAmount)
else
to_chat(user, "<span class='warning'>CALIBRATION ERROR.</span>")
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

/obj/item/commandprojector/proc/ReduceCommandAmount()
current_commands--

//Deepscanner
/obj/item/deepscanner //intended for ordeals
Expand Down
21 changes: 8 additions & 13 deletions code/game/machinery/computer/manager_camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
var/commandtype = 1
var/command_delay = 0.5 SECONDS
var/command_cooldown
//Used for limiting the amount of commands that can exist.
var/current_commands = 0
var/max_commands = 10
///Variable stolen from AI. Essential for tracking feature.
var/static/datum/trackable/track = new
//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,
Expand Down Expand Up @@ -211,28 +211,23 @@
for(var/obj/effect/temp_visual/HoloCommand/V in T)
qdel(V)
return
if(!CheckHoloCapacity())
if(current_commands >= max_commands)
to_chat(C, "<span class='warning'>COMMAND CAPACITY REACHED.</span>")
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)
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
current_commands++
RegisterSignal(thing_spawned, COMSIG_PARENT_QDELETING, .proc/ReduceCommandAmount)
else
to_chat(C, "<span class='warning'>ERROR: Calibration Faliure.</span>")
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
//Used in the tracking of existing commands.
/obj/machinery/computer/camera_advanced/manager/proc/ReduceCommandAmount()
current_commands--

//Numerical Procs that alter variables
/obj/machinery/computer/camera_advanced/manager/proc/commandtimer()
Expand Down

0 comments on commit bac9cc4

Please sign in to comment.