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
This commit is contained in:
Rob Bailey
2019-08-29 23:45:20 -07:00
committed by oranges
parent 3bd71a9c44
commit 2029163d33
515 changed files with 1537 additions and 1538 deletions

View File

@@ -53,7 +53,7 @@
gear_fugitive_leader(leader, landing_turf, backstory)
//after spawning
playsound(src, 'sound/weapons/emitter.ogg', 50, 1)
playsound(src, 'sound/weapons/emitter.ogg', 50, TRUE)
new /obj/item/storage/toolbox/mechanical(landing_turf) //so they can actually escape maint
addtimer(CALLBACK(src, .proc/spawn_hunters), 10 MINUTES)
role_name = "fugitive hunter"

View File

@@ -28,7 +28,7 @@
other_half.cracked = 1
other_half.icon_state = "cracker2"
target.put_in_active_hand(other_half)
playsound(user, 'sound/effects/snap.ogg', 50, 1)
playsound(user, 'sound/effects/snap.ogg', 50, TRUE)
return 1
return ..()

View File

@@ -111,7 +111,7 @@ In my current plan for it, 'solid' will be defined as anything with density == 1
/obj/effect/immovablerod/Bump(atom/clong)
if(prob(10))
playsound(src, 'sound/effects/bang.ogg', 50, 1)
playsound(src, 'sound/effects/bang.ogg', 50, TRUE)
audible_message("<span class='danger'>You hear a CLANG!</span>")
if(clong && prob(25))
@@ -149,7 +149,7 @@ In my current plan for it, 'solid' will be defined as anything with density == 1
if(ishuman(user))
var/mob/living/carbon/human/U = user
if(U.job in list("Research Director"))
playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1)
playsound(src, 'sound/effects/meteorimpact.ogg', 100, TRUE)
for(var/mob/M in urange(8, src))
if(!M.stat)
shake_camera(M, 2, 3)
@@ -164,4 +164,4 @@ In my current plan for it, 'solid' will be defined as anything with density == 1
U.visible_message("<span class='boldwarning'>[U] suplexes [src] into the ground!</span>", "<span class='warning'>You suplex [src] into the ground!</span>")
new /obj/structure/festivus/anchored(drop_location())
new /obj/effect/anomaly/flux(drop_location())
qdel(src)
qdel(src)

View File

@@ -36,7 +36,7 @@
player_mind.special_role = "Nightmare"
player_mind.add_antag_datum(/datum/antagonist/nightmare)
S.set_species(/datum/species/shadow/nightmare)
playsound(S, 'sound/magic/ethereal_exit.ogg', 50, 1, -1)
playsound(S, 'sound/magic/ethereal_exit.ogg', 50, TRUE, -1)
message_admins("[ADMIN_LOOKUPFLW(S)] has been made into a Nightmare by an event.")
log_game("[key_name(S)] was spawned as a Nightmare by an event.")
spawned_mobs += S

View File

@@ -97,7 +97,7 @@
return
T = get_step(T, SOUTHWEST) //align center of image with turf
flick_overlay_static(storm, T, 15)
playsound(T, 'sound/magic/lightningbolt.ogg', rand(80, 100), 1)
playsound(T, 'sound/magic/lightningbolt.ogg', rand(80, 100), TRUE)
/datum/round_event/portal_storm/proc/spawn_hostile()
if(!hostile_types || !hostile_types.len)

View File

@@ -36,7 +36,7 @@
player_mind.assigned_role = "Space Dragon"
player_mind.special_role = "Space Dragon"
player_mind.add_antag_datum(/datum/antagonist/space_dragon)
playsound(S, 'sound/magic/ethereal_exit.ogg', 50, 1, -1)
playsound(S, 'sound/magic/ethereal_exit.ogg', 50, TRUE, -1)
message_admins("[ADMIN_LOOKUPFLW(S)] has been made into a Space Dragon by an event.")
log_game("[key_name(S)] was spawned as a Space Dragon by an event.")
spawned_mobs += S

View File

@@ -344,11 +344,11 @@
switch(damage_type)
if(BRUTE)
if(damage_amount)
playsound(src, 'sound/weapons/slash.ogg', 50, 1)
playsound(src, 'sound/weapons/slash.ogg', 50, TRUE)
else
playsound(src, 'sound/weapons/tap.ogg', 50, 1)
playsound(src, 'sound/weapons/tap.ogg', 50, TRUE)
if(BURN)
playsound(src.loc, 'sound/items/welder.ogg', 100, 1)
playsound(src.loc, 'sound/items/welder.ogg', 100, TRUE)
/obj/structure/spacevine/Crossed(mob/crosser)
if(isliving(crosser))