Files
Bubberstation/code/game/objects/structures/hivebot.dm
Rob Bailey 2029163d33 playsound vary boolean define conversion (#46254)
About The Pull Request

Converts every single usage of playsound's vary parameter to use the boolean define instead of 1 or 0. I'm tired of people copypasting the incorrect usage.
Also changes a couple of places where a list was picked from instead of using get_sfx internal calls

This was done via regex:
(playsound\(.+,.+,.+, ?)1( ?\)| ?,.+\)) to match 1
(playsound\(.+,.+,.+, ?)0( ?\)| ?,.+\)) to match 0
full sed commands:
/(playsound\(.+,.+,.+, ?)1( ?\)| ?,.+\))/\1TRUE\2/ 1 to TRUE
/(playsound\(.+,.+,.+, ?)0( ?\)| ?,.+\))/\1FALSE\2/ 0 to FALSE

I'm not very good with regex and these could probably be optimized, but they worked.
Why It's Good For The Game

Code usability
2019-08-30 18:45:20 +12:00

37 lines
1.2 KiB
Plaintext

/obj/structure/hivebot_beacon
name = "beacon"
desc = "Some odd beacon thing."
icon = 'icons/mob/hivebot.dmi'
icon_state = "def_radar-off"
anchored = TRUE
density = TRUE
var/bot_type = "norm"
var/bot_amt = 10
/obj/structure/hivebot_beacon/Initialize()
. = ..()
var/datum/effect_system/smoke_spread/smoke = new
smoke.set_up(2, loc)
smoke.start()
visible_message("<span class='boldannounce'>[src] warps in!</span>")
playsound(src.loc, 'sound/effects/empulse.ogg', 25, TRUE)
addtimer(CALLBACK(src, .proc/warpbots), rand(10, 600))
/obj/structure/hivebot_beacon/proc/warpbots()
icon_state = "def_radar"
visible_message("<span class='danger'>[src] turns on!</span>")
while(bot_amt > 0)
bot_amt--
switch(bot_type)
if("norm")
new /mob/living/simple_animal/hostile/hivebot(get_turf(src))
if("range")
new /mob/living/simple_animal/hostile/hivebot/range(get_turf(src))
if("rapid")
new /mob/living/simple_animal/hostile/hivebot/rapid(get_turf(src))
sleep(100)
visible_message("<span class='boldannounce'>[src] warps out!</span>")
playsound(src.loc, 'sound/effects/empulse.ogg', 25, TRUE)
qdel(src)
return