mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Merge pull request #7153 from VOREStation/upstream-merge-6934
[MIRROR] Adjust two things that loop forever
This commit is contained in:
@@ -12,45 +12,51 @@
|
|||||||
var/obj/item/weapon/disk/nuclear/the_disk = null
|
var/obj/item/weapon/disk/nuclear/the_disk = null
|
||||||
var/active = 0
|
var/active = 0
|
||||||
|
|
||||||
|
|
||||||
attack_self()
|
|
||||||
if(!active)
|
|
||||||
active = 1
|
|
||||||
workdisk()
|
|
||||||
to_chat(usr, "<span class='notice'>You activate the pinpointer</span>")
|
|
||||||
else
|
|
||||||
active = 0
|
|
||||||
icon_state = "pinoff"
|
|
||||||
to_chat(usr, "<span>You deactivate the pinpointer</span>")
|
|
||||||
|
|
||||||
proc/workdisk()
|
|
||||||
if(!active) return
|
|
||||||
if(!the_disk)
|
|
||||||
the_disk = locate()
|
|
||||||
if(!the_disk)
|
|
||||||
icon_state = "pinonnull"
|
|
||||||
return
|
|
||||||
set_dir(get_dir(src,the_disk))
|
|
||||||
switch(get_dist(src,the_disk))
|
|
||||||
if(0)
|
|
||||||
icon_state = "pinondirect"
|
|
||||||
if(1 to 8)
|
|
||||||
icon_state = "pinonclose"
|
|
||||||
if(9 to 16)
|
|
||||||
icon_state = "pinonmedium"
|
|
||||||
if(16 to INFINITY)
|
|
||||||
icon_state = "pinonfar"
|
|
||||||
spawn(5) .()
|
|
||||||
|
|
||||||
examine(mob/user)
|
|
||||||
..(user)
|
|
||||||
for(var/obj/machinery/nuclearbomb/bomb in machines)
|
|
||||||
if(bomb.timing)
|
|
||||||
to_chat(user, "Extreme danger. Arming signal detected. Time remaining: [bomb.timeleft]")
|
|
||||||
|
|
||||||
/obj/item/weapon/pinpointer/Destroy()
|
/obj/item/weapon/pinpointer/Destroy()
|
||||||
active = 0
|
active = 0
|
||||||
..()
|
STOP_PROCESSING(SSobj, src)
|
||||||
|
return ..()
|
||||||
|
|
||||||
|
/obj/item/weapon/pinpointer/attack_self()
|
||||||
|
if(!active)
|
||||||
|
active = 1
|
||||||
|
START_PROCESSING(SSobj, src)
|
||||||
|
to_chat(usr, "<span class='notice'>You activate the pinpointer</span>")
|
||||||
|
else
|
||||||
|
active = 0
|
||||||
|
STOP_PROCESSING(SSobj, src)
|
||||||
|
icon_state = "pinoff"
|
||||||
|
to_chat(usr, "<span class='notice'>You deactivate the pinpointer</span>")
|
||||||
|
|
||||||
|
/obj/item/weapon/pinpointer/process()
|
||||||
|
if(!active)
|
||||||
|
return PROCESS_KILL
|
||||||
|
|
||||||
|
if(!the_disk)
|
||||||
|
the_disk = locate()
|
||||||
|
if(!the_disk)
|
||||||
|
icon_state = "pinonnull"
|
||||||
|
return
|
||||||
|
|
||||||
|
set_dir(get_dir(src,the_disk))
|
||||||
|
|
||||||
|
switch(get_dist(src,the_disk))
|
||||||
|
if(0)
|
||||||
|
icon_state = "pinondirect"
|
||||||
|
if(1 to 8)
|
||||||
|
icon_state = "pinonclose"
|
||||||
|
if(9 to 16)
|
||||||
|
icon_state = "pinonmedium"
|
||||||
|
if(16 to INFINITY)
|
||||||
|
icon_state = "pinonfar"
|
||||||
|
|
||||||
|
/obj/item/weapon/pinpointer/examine(mob/user)
|
||||||
|
..(user)
|
||||||
|
for(var/obj/machinery/nuclearbomb/bomb in machines)
|
||||||
|
if(bomb.timing)
|
||||||
|
to_chat(user, "Extreme danger. Arming signal detected. Time remaining: [bomb.timeleft]")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/obj/item/weapon/pinpointer/advpinpointer
|
/obj/item/weapon/pinpointer/advpinpointer
|
||||||
name = "Advanced Pinpointer"
|
name = "Advanced Pinpointer"
|
||||||
@@ -60,58 +66,49 @@
|
|||||||
var/turf/location = null
|
var/turf/location = null
|
||||||
var/obj/target = null
|
var/obj/target = null
|
||||||
|
|
||||||
attack_self()
|
/obj/item/weapon/pinpointer/advpinpointer/process()
|
||||||
if(!active)
|
if(!active)
|
||||||
active = 1
|
return PROCESS_KILL
|
||||||
if(mode == 0)
|
if(mode == 0)
|
||||||
workdisk()
|
..()
|
||||||
if(mode == 1)
|
if(mode == 1)
|
||||||
worklocation()
|
worklocation()
|
||||||
if(mode == 2)
|
if(mode == 2)
|
||||||
workobj()
|
workobj()
|
||||||
to_chat(usr, "<span class='notice'>You activate the pinpointer</span>")
|
|
||||||
else
|
|
||||||
active = 0
|
|
||||||
icon_state = "pinoff"
|
|
||||||
to_chat(usr, "<span class='notice'>You deactivate the pinpointer</span>")
|
|
||||||
|
|
||||||
|
/obj/item/weapon/pinpointer/advpinpointer/proc/worklocation()
|
||||||
|
if(!location)
|
||||||
|
icon_state = "pinonnull"
|
||||||
|
return
|
||||||
|
|
||||||
proc/worklocation()
|
set_dir(get_dir(src,location))
|
||||||
if(!active)
|
|
||||||
return
|
|
||||||
if(!location)
|
|
||||||
icon_state = "pinonnull"
|
|
||||||
return
|
|
||||||
set_dir(get_dir(src,location))
|
|
||||||
switch(get_dist(src,location))
|
|
||||||
if(0)
|
|
||||||
icon_state = "pinondirect"
|
|
||||||
if(1 to 8)
|
|
||||||
icon_state = "pinonclose"
|
|
||||||
if(9 to 16)
|
|
||||||
icon_state = "pinonmedium"
|
|
||||||
if(16 to INFINITY)
|
|
||||||
icon_state = "pinonfar"
|
|
||||||
spawn(5) .()
|
|
||||||
|
|
||||||
|
switch(get_dist(src,location))
|
||||||
|
if(0)
|
||||||
|
icon_state = "pinondirect"
|
||||||
|
if(1 to 8)
|
||||||
|
icon_state = "pinonclose"
|
||||||
|
if(9 to 16)
|
||||||
|
icon_state = "pinonmedium"
|
||||||
|
if(16 to INFINITY)
|
||||||
|
icon_state = "pinonfar"
|
||||||
|
|
||||||
proc/workobj()
|
/obj/item/weapon/pinpointer/advpinpointer/proc/workobj()
|
||||||
if(!active)
|
if(!target)
|
||||||
return
|
icon_state = "pinonnull"
|
||||||
if(!target)
|
return
|
||||||
icon_state = "pinonnull"
|
|
||||||
return
|
set_dir(get_dir(src,target))
|
||||||
set_dir(get_dir(src,target))
|
|
||||||
switch(get_dist(src,target))
|
switch(get_dist(src,target))
|
||||||
if(0)
|
if(0)
|
||||||
icon_state = "pinondirect"
|
icon_state = "pinondirect"
|
||||||
if(1 to 8)
|
if(1 to 8)
|
||||||
icon_state = "pinonclose"
|
icon_state = "pinonclose"
|
||||||
if(9 to 16)
|
if(9 to 16)
|
||||||
icon_state = "pinonmedium"
|
icon_state = "pinonmedium"
|
||||||
if(16 to INFINITY)
|
if(16 to INFINITY)
|
||||||
icon_state = "pinonfar"
|
icon_state = "pinonfar"
|
||||||
spawn(5) .()
|
|
||||||
|
|
||||||
/obj/item/weapon/pinpointer/advpinpointer/verb/toggle_mode()
|
/obj/item/weapon/pinpointer/advpinpointer/verb/toggle_mode()
|
||||||
set category = "Object"
|
set category = "Object"
|
||||||
@@ -140,7 +137,6 @@
|
|||||||
|
|
||||||
to_chat(usr, "You set the pinpointer to locate [locationx],[locationy]")
|
to_chat(usr, "You set the pinpointer to locate [locationx],[locationy]")
|
||||||
|
|
||||||
|
|
||||||
return attack_self()
|
return attack_self()
|
||||||
|
|
||||||
if("Disk Recovery")
|
if("Disk Recovery")
|
||||||
@@ -150,9 +146,10 @@
|
|||||||
if("Other Signature")
|
if("Other Signature")
|
||||||
mode = 2
|
mode = 2
|
||||||
switch(alert("Search for item signature or DNA fragment?" , "Signature Mode Select" , "" , "Item" , "DNA"))
|
switch(alert("Search for item signature or DNA fragment?" , "Signature Mode Select" , "" , "Item" , "DNA"))
|
||||||
|
|
||||||
if("Item")
|
if("Item")
|
||||||
var/datum/objective/steal/itemlist
|
var/datum/objective/steal/itemlist
|
||||||
itemlist = itemlist // To supress a 'variable defined but not used' error.
|
itemlist = itemlist
|
||||||
var/targetitem = input("Select item to search for.", "Item Mode Select","") as null|anything in itemlist.possible_items
|
var/targetitem = input("Select item to search for.", "Item Mode Select","") as null|anything in itemlist.possible_items
|
||||||
if(!targetitem)
|
if(!targetitem)
|
||||||
return
|
return
|
||||||
@@ -161,6 +158,7 @@
|
|||||||
to_chat(usr, "Failed to locate [targetitem]!")
|
to_chat(usr, "Failed to locate [targetitem]!")
|
||||||
return
|
return
|
||||||
to_chat(usr, "You set the pinpointer to locate [targetitem]")
|
to_chat(usr, "You set the pinpointer to locate [targetitem]")
|
||||||
|
|
||||||
if("DNA")
|
if("DNA")
|
||||||
var/DNAstring = input("Input DNA string to search for." , "Please Enter String." , "")
|
var/DNAstring = input("Input DNA string to search for." , "Please Enter String." , "")
|
||||||
if(!DNAstring)
|
if(!DNAstring)
|
||||||
@@ -187,6 +185,7 @@
|
|||||||
/obj/item/weapon/pinpointer/nukeop/attack_self(mob/user as mob)
|
/obj/item/weapon/pinpointer/nukeop/attack_self(mob/user as mob)
|
||||||
if(!active)
|
if(!active)
|
||||||
active = 1
|
active = 1
|
||||||
|
START_PROCESSING(SSobj, src)
|
||||||
if(!mode)
|
if(!mode)
|
||||||
workdisk()
|
workdisk()
|
||||||
to_chat(user, "<span class='notice'>Authentication Disk Locator active.</span>")
|
to_chat(user, "<span class='notice'>Authentication Disk Locator active.</span>")
|
||||||
@@ -195,30 +194,35 @@
|
|||||||
to_chat(user, "<span class='notice'>Shuttle Locator active.</span>")
|
to_chat(user, "<span class='notice'>Shuttle Locator active.</span>")
|
||||||
else
|
else
|
||||||
active = 0
|
active = 0
|
||||||
|
STOP_PROCESSING(SSobj, src)
|
||||||
icon_state = "pinoff"
|
icon_state = "pinoff"
|
||||||
to_chat(user, "<span class='notice'>You deactivate the pinpointer.</span>")
|
to_chat(user, "<span class='notice'>You deactivate the pinpointer.</span>")
|
||||||
|
|
||||||
|
/obj/item/weapon/pinpointer/nukeop/process()
|
||||||
|
if(!active)
|
||||||
|
return PROCESS_KILL
|
||||||
|
|
||||||
/obj/item/weapon/pinpointer/nukeop/workdisk()
|
switch(mode)
|
||||||
if(!active) return
|
if(0)
|
||||||
if(mode) //Check in case the mode changes while operating
|
workdisk()
|
||||||
worklocation()
|
if(1)
|
||||||
return
|
worklocation()
|
||||||
|
|
||||||
|
/obj/item/weapon/pinpointer/nukeop/proc/workdisk()
|
||||||
if(bomb_set) //If the bomb is set, lead to the shuttle
|
if(bomb_set) //If the bomb is set, lead to the shuttle
|
||||||
mode = 1 //Ensures worklocation() continues to work
|
mode = 1 //Ensures worklocation() continues to work
|
||||||
worklocation()
|
|
||||||
playsound(loc, 'sound/machines/twobeep.ogg', 50, 1) //Plays a beep
|
playsound(loc, 'sound/machines/twobeep.ogg', 50, 1) //Plays a beep
|
||||||
visible_message("Shuttle Locator active.") //Lets the mob holding it know that the mode has changed
|
visible_message("<span class='notice'>Shuttle Locator active.</span>") //Lets the mob holding it know that the mode has changed
|
||||||
return //Get outta here
|
return //Get outta here
|
||||||
|
|
||||||
if(!the_disk)
|
if(!the_disk)
|
||||||
the_disk = locate()
|
the_disk = locate()
|
||||||
if(!the_disk)
|
if(!the_disk)
|
||||||
icon_state = "pinonnull"
|
icon_state = "pinonnull"
|
||||||
return
|
return
|
||||||
// if(loc.z != the_disk.z) //If you are on a different z-level from the disk
|
|
||||||
// icon_state = "pinonnull"
|
|
||||||
// else
|
|
||||||
set_dir(get_dir(src, the_disk))
|
set_dir(get_dir(src, the_disk))
|
||||||
|
|
||||||
switch(get_dist(src, the_disk))
|
switch(get_dist(src, the_disk))
|
||||||
if(0)
|
if(0)
|
||||||
icon_state = "pinondirect"
|
icon_state = "pinondirect"
|
||||||
@@ -229,29 +233,25 @@
|
|||||||
if(16 to INFINITY)
|
if(16 to INFINITY)
|
||||||
icon_state = "pinonfar"
|
icon_state = "pinonfar"
|
||||||
|
|
||||||
spawn(5) .()
|
|
||||||
|
|
||||||
|
|
||||||
/obj/item/weapon/pinpointer/nukeop/proc/worklocation()
|
/obj/item/weapon/pinpointer/nukeop/proc/worklocation()
|
||||||
if(!active) return
|
|
||||||
if(!mode)
|
|
||||||
workdisk()
|
|
||||||
return
|
|
||||||
if(!bomb_set)
|
if(!bomb_set)
|
||||||
mode = 0
|
mode = 0
|
||||||
workdisk()
|
|
||||||
playsound(loc, 'sound/machines/twobeep.ogg', 50, 1)
|
playsound(loc, 'sound/machines/twobeep.ogg', 50, 1)
|
||||||
visible_message("<span class='notice'>Authentication Disk Locator active.</span>")
|
visible_message("<span class='notice'>Authentication Disk Locator active.</span>")
|
||||||
return
|
return
|
||||||
|
|
||||||
if(!home)
|
if(!home)
|
||||||
home = locate()
|
home = locate()
|
||||||
if(!home)
|
if(!home)
|
||||||
icon_state = "pinonnull"
|
icon_state = "pinonnull"
|
||||||
return
|
return
|
||||||
|
|
||||||
if(loc.z != home.z) //If you are on a different z-level from the shuttle
|
if(loc.z != home.z) //If you are on a different z-level from the shuttle
|
||||||
icon_state = "pinonnull"
|
icon_state = "pinonnull"
|
||||||
|
|
||||||
else
|
else
|
||||||
set_dir(get_dir(src, home))
|
set_dir(get_dir(src, home))
|
||||||
|
|
||||||
switch(get_dist(src, home))
|
switch(get_dist(src, home))
|
||||||
if(0)
|
if(0)
|
||||||
icon_state = "pinondirect"
|
icon_state = "pinondirect"
|
||||||
@@ -262,8 +262,6 @@
|
|||||||
if(16 to INFINITY)
|
if(16 to INFINITY)
|
||||||
icon_state = "pinonfar"
|
icon_state = "pinonfar"
|
||||||
|
|
||||||
spawn(5) .()
|
|
||||||
|
|
||||||
|
|
||||||
// This one only points to the ship. Useful if there is no nuking to occur today.
|
// This one only points to the ship. Useful if there is no nuking to occur today.
|
||||||
/obj/item/weapon/pinpointer/shuttle
|
/obj/item/weapon/pinpointer/shuttle
|
||||||
@@ -273,16 +271,17 @@
|
|||||||
/obj/item/weapon/pinpointer/shuttle/attack_self(mob/user as mob)
|
/obj/item/weapon/pinpointer/shuttle/attack_self(mob/user as mob)
|
||||||
if(!active)
|
if(!active)
|
||||||
active = TRUE
|
active = TRUE
|
||||||
find_shuttle()
|
START_PROCESSING(SSobj, src)
|
||||||
to_chat(user, "<span class='notice'>Shuttle Locator active.</span>")
|
to_chat(user, "<span class='notice'>Shuttle Locator active.</span>")
|
||||||
else
|
else
|
||||||
active = FALSE
|
active = FALSE
|
||||||
|
STOP_PROCESSING(SSobj, src)
|
||||||
icon_state = "pinoff"
|
icon_state = "pinoff"
|
||||||
to_chat(user, "<span class='notice'>You deactivate the pinpointer.</span>")
|
to_chat(user, "<span class='notice'>You deactivate the pinpointer.</span>")
|
||||||
|
|
||||||
/obj/item/weapon/pinpointer/shuttle/proc/find_shuttle()
|
/obj/item/weapon/pinpointer/shuttle/process()
|
||||||
if(!active)
|
if(!active)
|
||||||
return
|
return PROCESS_KILL
|
||||||
|
|
||||||
if(!our_shuttle)
|
if(!our_shuttle)
|
||||||
for(var/obj/machinery/computer/shuttle_control/S in machines)
|
for(var/obj/machinery/computer/shuttle_control/S in machines)
|
||||||
@@ -296,8 +295,10 @@
|
|||||||
|
|
||||||
if(loc.z != our_shuttle.z) //If you are on a different z-level from the shuttle
|
if(loc.z != our_shuttle.z) //If you are on a different z-level from the shuttle
|
||||||
icon_state = "pinonnull"
|
icon_state = "pinonnull"
|
||||||
|
|
||||||
else
|
else
|
||||||
set_dir(get_dir(src, our_shuttle))
|
set_dir(get_dir(src, our_shuttle))
|
||||||
|
|
||||||
switch(get_dist(src, our_shuttle))
|
switch(get_dist(src, our_shuttle))
|
||||||
if(0)
|
if(0)
|
||||||
icon_state = "pinondirect"
|
icon_state = "pinondirect"
|
||||||
@@ -308,9 +309,6 @@
|
|||||||
if(16 to INFINITY)
|
if(16 to INFINITY)
|
||||||
icon_state = "pinonfar"
|
icon_state = "pinonfar"
|
||||||
|
|
||||||
spawn(5)
|
|
||||||
.()
|
|
||||||
|
|
||||||
|
|
||||||
/obj/item/weapon/pinpointer/shuttle/merc
|
/obj/item/weapon/pinpointer/shuttle/merc
|
||||||
shuttle_comp_id = "Mercenary"
|
shuttle_comp_id = "Mercenary"
|
||||||
|
|||||||
@@ -1,72 +1,68 @@
|
|||||||
// These are objects you can use inside special maps (like PoIs), or for adminbuse.
|
// These are objects you can use inside special maps (like PoIs), or for adminbuse.
|
||||||
// Players cannot see or interact with these.
|
// Players cannot see or interact with these.
|
||||||
/obj/effect/map_effect
|
/obj/effect/map_effect
|
||||||
anchored = TRUE
|
anchored = TRUE
|
||||||
invisibility = 99 // So a badmin can go view these by changing their see_invisible.
|
invisibility = 99 // So a badmin can go view these by changing their see_invisible.
|
||||||
icon = 'icons/effects/map_effects.dmi'
|
icon = 'icons/effects/map_effects.dmi'
|
||||||
|
|
||||||
// Below vars concern check_for_player_proximity() and is used to not waste effort if nobody is around to appreciate the effects.
|
// Below vars concern check_for_player_proximity() and is used to not waste effort if nobody is around to appreciate the effects.
|
||||||
var/always_run = FALSE // If true, the game will not try to suppress this from firing if nobody is around to see it.
|
var/always_run = FALSE // If true, the game will not try to suppress this from firing if nobody is around to see it.
|
||||||
var/proximity_needed = 12 // How many tiles a mob with a client must be for this to run.
|
var/proximity_needed = 12 // How many tiles a mob with a client must be for this to run.
|
||||||
var/ignore_ghosts = FALSE // If true, ghosts won't satisfy the above requirement.
|
var/ignore_ghosts = FALSE // If true, ghosts won't satisfy the above requirement.
|
||||||
var/ignore_afk = TRUE // If true, AFK people (5 minutes) won't satisfy it as well.
|
var/ignore_afk = TRUE // If true, AFK people (5 minutes) won't satisfy it as well.
|
||||||
var/retry_delay = 3 SECONDS // How long until we check for players again.
|
var/retry_delay = 5 SECONDS // How long until we check for players again.
|
||||||
|
|
||||||
/obj/effect/map_effect/ex_act()
|
/obj/effect/map_effect/ex_act()
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/effect/map_effect/singularity_pull()
|
/obj/effect/map_effect/singularity_pull()
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/effect/map_effect/singularity_act()
|
/obj/effect/map_effect/singularity_act()
|
||||||
return
|
return
|
||||||
|
|
||||||
// Base type for effects that run on variable intervals.
|
// Base type for effects that run on variable intervals.
|
||||||
/obj/effect/map_effect/interval
|
/obj/effect/map_effect/interval
|
||||||
var/interval_lower_bound = 5 SECONDS // Lower number for how often the map_effect will trigger.
|
var/interval_lower_bound = 5 SECONDS // Lower number for how often the map_effect will trigger.
|
||||||
var/interval_upper_bound = 5 SECONDS // Higher number for above.
|
var/interval_upper_bound = 5 SECONDS // Higher number for above.
|
||||||
var/halt = FALSE // Set to true to stop the loop when it reaches the next iteration.
|
var/halt = FALSE // Set to true to stop the loop when it reaches the next iteration.
|
||||||
|
|
||||||
/obj/effect/map_effect/interval/Initialize()
|
/obj/effect/map_effect/interval/Initialize()
|
||||||
handle_interval_delay()
|
handle_interval_delay()
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/obj/effect/map_effect/interval/Destroy()
|
/obj/effect/map_effect/interval/Destroy()
|
||||||
halt = TRUE // Shouldn't need it to GC but just in case.
|
halt = TRUE // Shouldn't need it to GC but just in case.
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
// Override this for the specific thing to do. Be sure to call parent to keep looping.
|
// Override this for the specific thing to do. Be sure to call parent to keep looping.
|
||||||
/obj/effect/map_effect/interval/proc/trigger()
|
/obj/effect/map_effect/interval/proc/trigger()
|
||||||
handle_interval_delay()
|
handle_interval_delay()
|
||||||
|
|
||||||
// Handles the delay and making sure it doesn't run when it would be bad.
|
// Handles the delay and making sure it doesn't run when it would be bad.
|
||||||
/obj/effect/map_effect/interval/proc/handle_interval_delay()
|
/obj/effect/map_effect/interval/proc/handle_interval_delay()
|
||||||
// Check to see if we're useful first.
|
// Check to see if we're useful first.
|
||||||
if(halt)
|
if(halt)
|
||||||
return // Do not pass .(), do not recursively collect 200 thaler.
|
return // Do not pass .(), do not recursively collect 200 thaler.
|
||||||
|
|
||||||
if(!always_run && !check_for_player_proximity(src, proximity_needed, ignore_ghosts, ignore_afk))
|
if(!always_run && !check_for_player_proximity(src, proximity_needed, ignore_ghosts, ignore_afk))
|
||||||
spawn(retry_delay) // Maybe someday we'll have fancy TG timers/schedulers.
|
//Nobody home, try again after retry_delay
|
||||||
if(!QDELETED(src))
|
addtimer(CALLBACK(src, .proc/handle_interval_delay), retry_delay)
|
||||||
.()
|
else
|
||||||
return
|
//Someone was here!
|
||||||
|
addtimer(CALLBACK(src, .proc/trigger), rand(interval_lower_bound, interval_upper_bound))
|
||||||
var/next_interval = rand(interval_lower_bound, interval_upper_bound)
|
|
||||||
spawn(next_interval)
|
// Helper proc to optimize the use of effects by making sure they do not run if nobody is around to perceive it.
|
||||||
if(!QDELETED(src))
|
/proc/check_for_player_proximity(var/atom/proximity_to, var/radius = 12, var/ignore_ghosts = FALSE, var/ignore_afk = TRUE)
|
||||||
trigger()
|
if(!proximity_to)
|
||||||
|
return FALSE
|
||||||
// Helper proc to optimize the use of effects by making sure they do not run if nobody is around to perceive it.
|
|
||||||
/proc/check_for_player_proximity(var/atom/proximity_to, var/radius = 12, var/ignore_ghosts = FALSE, var/ignore_afk = TRUE)
|
for(var/thing in player_list)
|
||||||
if(!proximity_to)
|
var/mob/M = thing // Avoiding typechecks for more speed, player_list will only contain mobs anyways.
|
||||||
return FALSE
|
if(ignore_ghosts && isobserver(M))
|
||||||
|
continue
|
||||||
for(var/thing in player_list)
|
if(ignore_afk && M.client && M.client.is_afk(5 MINUTES))
|
||||||
var/mob/M = thing // Avoiding typechecks for more speed, player_list will only contain mobs anyways.
|
continue
|
||||||
if(ignore_ghosts && isobserver(M))
|
if(M.z == proximity_to.z && get_dist(M, proximity_to) <= radius)
|
||||||
continue
|
return TRUE
|
||||||
if(ignore_afk && M.client && M.client.is_afk(5 MINUTES))
|
return FALSE
|
||||||
continue
|
|
||||||
if(M.z == proximity_to.z && get_dist(M, proximity_to) <= radius)
|
|
||||||
return TRUE
|
|
||||||
return FALSE
|
|
||||||
|
|||||||
Reference in New Issue
Block a user