Boo! Rework (#14543)

* Boo Refactor

* Boo-Refactor Review Items

Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>

* Vending Machines Flicker

* Dave's Fire PR Review Mixtape Ft. SteelSlayer

Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>

Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
This commit is contained in:
Samuel
2020-10-26 19:57:02 -04:00
committed by GitHub
parent 1133527469
commit c99f7e3b22
17 changed files with 229 additions and 61 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
/mob/dead/observer/proc/open_spawners_menu)
// Our new boo spell.
AddSpell(new /obj/effect/proc_holder/spell/aoe_turf/boo(null))
AddSpell(new /obj/effect/proc_holder/spell/targeted/click/boo(null))
can_reenter_corpse = flags & GHOST_CAN_REENTER
started_as_observer = flags & GHOST_IS_OBSERVER
+22 -6
View File
@@ -9,22 +9,38 @@ GLOBAL_LIST_INIT(boo_phrases, list(
"It feels like someone's standing behind you.",
))
/obj/effect/proc_holder/spell/aoe_turf/boo
/obj/effect/proc_holder/spell/targeted/click/boo
name = "Boo!"
desc = "Fuck with the living."
selection_deactivated_message = "<span class='shadowling'>Your presence will not be known. For now.</span>"
selection_activated_message = "<span class='shadowling'>You prepare to reach across the veil. <b>Left-click to influence a target!</b></span>"
auto_target_single = FALSE
allowed_type = /atom // No subtypes are safe from spookage.
ghost = TRUE
action_icon_state = "boo"
school = "transmutation"
charge_max = 600
charge_max = 2 MINUTES
starts_charged = FALSE
clothes_req = 0
stat_allowed = 1
invocation = ""
invocation_type = "none"
range = 1 // Or maybe 3?
range = 20
// no need to spam admins regarding boo casts
create_logs = FALSE
/obj/effect/proc_holder/spell/aoe_turf/boo/cast(list/targets, mob/user = usr)
for(var/turf/T in targets)
T.get_spooked()
/obj/effect/proc_holder/spell/targeted/click/boo/cast(list/targets, mob/user = usr)
var/atom/target = targets[1]
ASSERT(istype(target))
if(target.get_spooked())
var/area/spook_zone = get_area(target)
if (spook_zone.is_haunted == TRUE)
to_chat(usr, "<span class='shadowling'>The veil is weak in [spook_zone], it took less effort to influence [target].</span>")
charge_counter = charge_max / 2
return
charge_counter = charge_max * 0.9 // We've targetted a non-spookable object! Try again fast!
@@ -1962,6 +1962,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
/mob/living/carbon/human/get_spooked()
to_chat(src, "<span class='whisper'>[pick(GLOB.boo_phrases)]</span>")
return TRUE
/mob/living/carbon/human/extinguish_light()
// Parent function handles stuff the human may be holding
@@ -57,7 +57,6 @@
var/gene_stability = DEFAULT_GENE_STABILITY
var/ignore_gene_stability = 0
var/obj/effect/proc_holder/ranged_ability //Any ranged ability the mob has, as a click override
var/tesla_ignore = FALSE
+2
View File
@@ -199,3 +199,5 @@
var/forced_look = null // This can either be a numerical direction or a soft object reference (UID). It makes the mob always face towards the selected thing.
var/registered_z
var/obj/effect/proc_holder/ranged_ability //Any ranged ability the mob has, as a click override
+28 -4
View File
@@ -419,18 +419,27 @@
update_icon()
updating_icon = 0
/obj/machinery/power/apc/get_spooked(second_pass = FALSE)
/obj/machinery/power/apc/flicker(second_pass = FALSE)
if(opened || panel_open)
return
return FALSE
if(stat & (NOPOWER | BROKEN))
return
return FALSE
if(!second_pass) //The first time, we just cut overlays
addtimer(CALLBACK(src, /obj/machinery/power/apc/proc.get_spooked, TRUE), 1)
addtimer(CALLBACK(src, /obj/machinery/power/apc/proc.flicker, TRUE), 1)
cut_overlays()
// APC power distruptions have a chance to propogate to other machines on its network
for(var/obj/machinery/M in area)
// Please don't cascade, thanks
if(M == src)
continue
if(prob(10))
M.flicker()
else
flick("apcemag", src) //Second time we cause the APC to update its icon, then add a timer to update icon later
addtimer(CALLBACK(src, /obj/machinery/power/apc/proc.update_icon, TRUE), 10)
return TRUE
//attack with an item - open/close cover, insert cell, or (un)lock interface
/obj/machinery/power/apc/attackby(obj/item/W, mob/living/user, params)
@@ -1231,6 +1240,21 @@
else if(last_ch != charging)
queue_icon_update()
if(prob(MACHINE_FLICKER_CHANCE))
flicker()
// lights don't have their own processing loop, so APCs will be the father they never had. 3x as likely to cause a light flicker in a particular area, pick a light to flicker at random
if(prob(MACHINE_FLICKER_CHANCE) * 3)
var/list/lights = list()
for(var/obj/machinery/light/L in area)
lights += L
if(lights.len > 0)
var/obj/machinery/light/picked_light = pick(lights)
ASSERT(istype(picked_light))
picked_light.flicker()
/obj/machinery/power/apc/proc/autoset(var/val, var/on)
if(on==0)
if(val==2) // if on, return off
+19 -16
View File
@@ -289,9 +289,6 @@
on = FALSE
return
/obj/machinery/light/get_spooked()
flicker()
/**
* Updates the light's properties
*
@@ -519,32 +516,38 @@
var/area/A = get_area(src)
return A.lightswitch && A.power_light
/obj/machinery/light/proc/flicker(amount = rand(10, 20))
/obj/machinery/light/flicker(amount = rand(20, 30))
if(flickering)
return
return FALSE
if(!on)
return
if(!on || status != LIGHT_OK)
return FALSE
flickering = TRUE
INVOKE_ASYNC(src, /obj/machinery/light/.proc/flicker_event, amount)
return TRUE
/**
* Flicker routine for the light.
* Called by invoke_async so the parent proc can return immediately.
*/
/obj/machinery/light/proc/flicker_event(amount)
for(var/i in 1 to amount)
if(status != LIGHT_OK)
break
on = !on
update() // No param means that ghosts can burn out lights
sleep(rand(5, 15))
if(status == LIGHT_OK)
on = TRUE
/obj/machinery/light/proc/flicker_event(var/amount)
if(on && status == LIGHT_OK)
for(var/i = 0; i < amount; i++)
if(status != LIGHT_OK)
break
on = FALSE
update(FALSE)
sleep(rand(1, 3))
on = (status == LIGHT_OK)
update(FALSE)
sleep(rand(1, 10))
on = (status == LIGHT_OK)
update(FALSE)
flickering = FALSE
// ai attack - make lights flicker, because why not
/obj/machinery/light/attack_ai(mob/user)
flicker(1)