Adds New PoI Features + Bonus PoI

This commit is contained in:
Neerti
2019-01-10 17:17:43 -05:00
committed by Novacat
parent dbd85f3243
commit 91a5203e32
37 changed files with 1287 additions and 418 deletions
@@ -1,78 +1,78 @@
// Creates effects like smoke clouds every so often.
/obj/effect/map_effect/interval/effect_emitter
var/datum/effect/effect/system/effect_system = null
var/effect_system_type = null // Which effect system to attach.
var/effect_amount = 10 // How many effect objects to create on each interval. Note that there's a hard cap on certain effect_systems.
var/effect_cardinals_only = FALSE // If true, effects only move in cardinal directions.
var/effect_forced_dir = null // If set, effects emitted will always move in this direction.
/obj/effect/map_effect/interval/effect_emitter/Initialize()
effect_system = new effect_system_type()
effect_system.attach(src)
configure_effects()
return ..()
/obj/effect/map_effect/interval/effect_emitter/interval/Destroy()
QDEL_NULL(effect_system)
return ..()
/obj/effect/map_effect/interval/effect_emitter/proc/configure_effects()
effect_system.set_up(effect_amount, effect_cardinals_only, usr.loc, effect_forced_dir)
/obj/effect/map_effect/interval/effect_emitter/trigger()
configure_effects() // We do this every interval in case it changes.
effect_system.start()
..()
// Creates smoke clouds every so often.
/obj/effect/map_effect/interval/effect_emitter/smoke
name = "smoke emitter"
icon_state = "smoke_emitter"
effect_system_type = /datum/effect/effect/system/smoke_spread
interval_lower_bound = 1 SECOND
interval_upper_bound = 1 SECOND
effect_amount = 2
/obj/effect/map_effect/interval/effect_emitter/smoke/bad
name = "bad smoke emitter"
effect_system_type = /datum/effect/effect/system/smoke_spread/bad
/obj/effect/map_effect/interval/effect_emitter/smoke/fire
name = "fire smoke emitter"
effect_system_type = /datum/effect/effect/system/smoke_spread/fire
/obj/effect/map_effect/interval/effect_emitter/smoke/frost
name = "frost smoke emitter"
effect_system_type = /datum/effect/effect/system/smoke_spread/frost
/obj/effect/map_effect/interval/effect_emitter/smoke/shock
name = "shock smoke emitter"
effect_system_type = /datum/effect/effect/system/smoke_spread/shock
/obj/effect/map_effect/interval/effect_emitter/smoke/mist
name = "mist smoke emitter"
effect_system_type = /datum/effect/effect/system/smoke_spread/mist
// Makes sparks.
/obj/effect/map_effect/interval/effect_emitter/sparks
name = "spark emitter"
icon_state = "spark_emitter"
effect_system_type = /datum/effect/effect/system/spark_spread
interval_lower_bound = 3 SECONDS
interval_upper_bound = 7 SECONDS
/obj/effect/map_effect/interval/effect_emitter/sparks/frequent
effect_amount = 4 // Otherwise it caps out fast.
interval_lower_bound = 1
interval_upper_bound = 3 SECONDS
// Makes ""steam"" that looks like fire extinguisher water except it does nothing.
/obj/effect/map_effect/interval/effect_emitter/steam
name = "steam emitter"
icon_state = "smoke_emitter"
effect_system_type = /datum/effect/effect/system/steam_spread
// Creates effects like smoke clouds every so often.
/obj/effect/map_effect/interval/effect_emitter
var/datum/effect/effect/system/effect_system = null
var/effect_system_type = null // Which effect system to attach.
var/effect_amount = 10 // How many effect objects to create on each interval. Note that there's a hard cap on certain effect_systems.
var/effect_cardinals_only = FALSE // If true, effects only move in cardinal directions.
var/effect_forced_dir = null // If set, effects emitted will always move in this direction.
/obj/effect/map_effect/interval/effect_emitter/Initialize()
effect_system = new effect_system_type()
effect_system.attach(src)
configure_effects()
return ..()
/obj/effect/map_effect/interval/effect_emitter/interval/Destroy()
QDEL_NULL(effect_system)
return ..()
/obj/effect/map_effect/interval/effect_emitter/proc/configure_effects()
effect_system.set_up(effect_amount, effect_cardinals_only, src.loc, effect_forced_dir)
/obj/effect/map_effect/interval/effect_emitter/trigger()
configure_effects() // We do this every interval in case it changes.
effect_system.start()
..()
// Creates smoke clouds every so often.
/obj/effect/map_effect/interval/effect_emitter/smoke
name = "smoke emitter"
icon_state = "smoke_emitter"
effect_system_type = /datum/effect/effect/system/smoke_spread
interval_lower_bound = 1 SECOND
interval_upper_bound = 1 SECOND
effect_amount = 2
/obj/effect/map_effect/interval/effect_emitter/smoke/bad
name = "bad smoke emitter"
effect_system_type = /datum/effect/effect/system/smoke_spread/bad
/obj/effect/map_effect/interval/effect_emitter/smoke/fire
name = "fire smoke emitter"
effect_system_type = /datum/effect/effect/system/smoke_spread/fire
/obj/effect/map_effect/interval/effect_emitter/smoke/frost
name = "frost smoke emitter"
effect_system_type = /datum/effect/effect/system/smoke_spread/frost
/obj/effect/map_effect/interval/effect_emitter/smoke/shock
name = "shock smoke emitter"
effect_system_type = /datum/effect/effect/system/smoke_spread/shock
/obj/effect/map_effect/interval/effect_emitter/smoke/mist
name = "mist smoke emitter"
effect_system_type = /datum/effect/effect/system/smoke_spread/mist
// Makes sparks.
/obj/effect/map_effect/interval/effect_emitter/sparks
name = "spark emitter"
icon_state = "spark_emitter"
effect_system_type = /datum/effect/effect/system/spark_spread
interval_lower_bound = 3 SECONDS
interval_upper_bound = 7 SECONDS
/obj/effect/map_effect/interval/effect_emitter/sparks/frequent
effect_amount = 4 // Otherwise it caps out fast.
interval_lower_bound = 1
interval_upper_bound = 3 SECONDS
// Makes ""steam"" that looks like fire extinguisher water except it does nothing.
/obj/effect/map_effect/interval/effect_emitter/steam
name = "steam emitter"
icon_state = "smoke_emitter"
effect_system_type = /datum/effect/effect/system/steam_spread
@@ -1,71 +1,72 @@
// These are objects you can use inside special maps (like PoIs), or for adminbuse.
// Players cannot see or interact with these.
/obj/effect/map_effect
anchored = TRUE
invisibility = 99 // So a badmin can go view these by changing their see_invisible.
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.
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/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/retry_delay = 3 SECONDS // How long until we check for players again.
/obj/effect/map_effect/ex_act()
return
/obj/effect/map_effect/singularity_pull()
return
/obj/effect/map_effect/singularity_act()
return
// Base type for effects that run on variable intervals.
/obj/effect/map_effect/interval
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/halt = FALSE // Set to true to stop the loop when it reaches the next iteration.
/obj/effect/map_effect/interval/Initialize()
handle_interval_delay()
return ..()
/obj/effect/map_effect/interval/Destroy()
halt = TRUE // Shouldn't need it to GC but just in case.
return ..()
// Override this for the specific thing to do. Be sure to call parent to keep looping.
/obj/effect/map_effect/interval/proc/trigger()
handle_interval_delay()
// Handles the delay and making sure it doesn't run when it would be bad.
/obj/effect/map_effect/interval/proc/handle_interval_delay()
// Check to see if we're useful first.
if(halt)
return // Do not pass .(), do not recursively collect 200 thaler.
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.
if(!QDELETED(src))
.()
var/next_interval = rand(interval_lower_bound, interval_upper_bound)
spawn(next_interval)
if(!QDELETED(src))
trigger()
// 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)
if(!proximity_to)
return FALSE
for(var/thing in player_list)
var/mob/M = thing // Avoiding typechecks for more speed, player_list will only contain mobs anyways.
if(ignore_ghosts && isobserver(M))
continue
if(ignore_afk && M.client && M.client.is_afk(5 MINUTES))
continue
if(M.z == proximity_to.z && get_dist(M, proximity_to) <= radius)
return TRUE
// These are objects you can use inside special maps (like PoIs), or for adminbuse.
// Players cannot see or interact with these.
/obj/effect/map_effect
anchored = TRUE
invisibility = 99 // So a badmin can go view these by changing their see_invisible.
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.
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/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/retry_delay = 3 SECONDS // How long until we check for players again.
/obj/effect/map_effect/ex_act()
return
/obj/effect/map_effect/singularity_pull()
return
/obj/effect/map_effect/singularity_act()
return
// Base type for effects that run on variable intervals.
/obj/effect/map_effect/interval
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/halt = FALSE // Set to true to stop the loop when it reaches the next iteration.
/obj/effect/map_effect/interval/Initialize()
handle_interval_delay()
return ..()
/obj/effect/map_effect/interval/Destroy()
halt = TRUE // Shouldn't need it to GC but just in case.
return ..()
// Override this for the specific thing to do. Be sure to call parent to keep looping.
/obj/effect/map_effect/interval/proc/trigger()
handle_interval_delay()
// Handles the delay and making sure it doesn't run when it would be bad.
/obj/effect/map_effect/interval/proc/handle_interval_delay()
// Check to see if we're useful first.
if(halt)
return // Do not pass .(), do not recursively collect 200 thaler.
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.
if(!QDELETED(src))
.()
return
var/next_interval = rand(interval_lower_bound, interval_upper_bound)
spawn(next_interval)
if(!QDELETED(src))
trigger()
// 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)
if(!proximity_to)
return FALSE
for(var/thing in player_list)
var/mob/M = thing // Avoiding typechecks for more speed, player_list will only contain mobs anyways.
if(ignore_ghosts && isobserver(M))
continue
if(ignore_afk && M.client && M.client.is_afk(5 MINUTES))
continue
if(M.z == proximity_to.z && get_dist(M, proximity_to) <= radius)
return TRUE
return FALSE