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-30 18:45:20 +12:00
committed by oranges
parent 3bd71a9c44
commit 2029163d33
515 changed files with 1537 additions and 1538 deletions
+2 -2
View File
@@ -89,7 +89,7 @@ interface with the mining shuttle at the landing site if a mobile beacon is also
var/shuttle_error = SSshuttle.moveShuttle(shuttleId, href_list["move"], 1)
if(launch_warning)
say("<span class='danger'>Launch sequence activated! Prepare for drop!!</span>")
playsound(loc, 'sound/machines/warning-buzzer.ogg', 70, 0)
playsound(loc, 'sound/machines/warning-buzzer.ogg', 70, FALSE)
launch_warning = FALSE
else if(!shuttle_error)
say("Shuttle request uploaded. Please stand away from the doors.")
@@ -362,7 +362,7 @@ interface with the mining shuttle at the landing site if a mobile beacon is also
aux_base_console.set_mining_mode() //Lets the colony park the shuttle there, now that it has a dock.
to_chat(user, "<span class='notice'>Mining shuttle calibration successful! Shuttle interface available at base console.</span>")
anchored = TRUE //Locks in place to mark the landing zone.
playsound(loc, 'sound/machines/ping.ogg', 50, 0)
playsound(loc, 'sound/machines/ping.ogg', 50, FALSE)
/obj/structure/mining_shuttle_beacon/proc/clear_cooldown()
anti_spam_cd = 0
+3 -3
View File
@@ -183,7 +183,7 @@
owner.changeNext_move(CLICK_CD_RANGE)
B.RCD.afterattack(rcd_target, owner, TRUE) //Activate the RCD and force it to work remotely!
playsound(target_turf, 'sound/items/deconstruct.ogg', 60, 1)
playsound(target_turf, 'sound/items/deconstruct.ogg', 60, TRUE)
/datum/action/innate/aux_base/switch_mode
name = "Switch Mode"
@@ -242,7 +242,7 @@ datum/action/innate/aux_base/place_fan/Activate()
new /obj/structure/fans/tiny(fan_turf)
B.fans_remaining--
to_chat(owner, "<span class='notice'>Tiny fan placed. [B.fans_remaining] remaining.</span>")
playsound(fan_turf, 'sound/machines/click.ogg', 50, 1)
playsound(fan_turf, 'sound/machines/click.ogg', 50, TRUE)
datum/action/innate/aux_base/install_turret
name = "Install Plasma Anti-Wildlife Turret"
@@ -271,4 +271,4 @@ datum/action/innate/aux_base/install_turret/Activate()
B.turret_stock--
to_chat(owner, "<span class='notice'>Turret installation complete!</span>")
playsound(turret_turf, 'sound/items/drill_use.ogg', 65, 1)
playsound(turret_turf, 'sound/items/drill_use.ogg', 65, TRUE)
@@ -91,7 +91,7 @@
D.preparePixelProjectile(target, user, clickparams)
D.firer = user
D.hammer_synced = src
playsound(user, 'sound/weapons/plasma_cutter.ogg', 100, 1)
playsound(user, 'sound/weapons/plasma_cutter.ogg', 100, TRUE)
D.fire()
charged = FALSE
update_icon()
@@ -117,7 +117,7 @@
if(!QDELETED(C))
C.total_damage += detonation_damage + backstab_bonus //cheat a little and add the total before killing it, so certain mobs don't have much lower chances of giving an item
L.apply_damage(detonation_damage + backstab_bonus, BRUTE, blocked = def_check)
playsound(user, 'sound/weapons/kenetic_accel.ogg', 100, 1) //Seriously who spelled it wrong
playsound(user, 'sound/weapons/kenetic_accel.ogg', 100, TRUE) //Seriously who spelled it wrong
else
if(!QDELETED(C))
C.total_damage += detonation_damage
@@ -127,7 +127,7 @@
if(!charged)
charged = TRUE
update_icon()
playsound(src.loc, 'sound/weapons/kenetic_reload.ogg', 60, 1)
playsound(src.loc, 'sound/weapons/kenetic_reload.ogg', 60, TRUE)
/obj/item/twohanded/kinetic_crusher/ui_action_click(mob/user, actiontype)
light_on = !light_on
@@ -343,7 +343,7 @@
for(var/mob/living/L in oview(2, user))
if(L.stat == DEAD)
continue
playsound(L, 'sound/magic/fireball.ogg', 20, 1)
playsound(L, 'sound/magic/fireball.ogg', 20, TRUE)
new /obj/effect/temp_visual/fire(L.loc)
addtimer(CALLBACK(src, .proc/pushback, L, user), 1) //no free backstabs, we push AFTER module stuff is done
L.adjustFireLoss(bonus_value, forced = TRUE)
@@ -41,7 +41,7 @@
loaded = 0
user.visible_message("<span class='notice'>[user] injects [M] with [src], reviving it.</span>")
SSblackbox.record_feedback("tally", "lazarus_injector", 1, M.type)
playsound(src,'sound/effects/refill.ogg',50,1)
playsound(src,'sound/effects/refill.ogg',50,TRUE)
icon_state = "lazarus_empty"
return
else
@@ -52,7 +52,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, list(
return
if(use(1))
to_chat(user, "<span class='notice'>You activate and anchor [amount ? "a":"the"] [singular_name] in place.</span>")
playsound(user, 'sound/machines/click.ogg', 50, 1)
playsound(user, 'sound/machines/click.ogg', 50, TRUE)
var/obj/structure/marker_beacon/M = new(user.loc, picked_color)
transfer_fingerprints_to(M)
@@ -113,7 +113,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, list(
M.update_icon()
transfer_fingerprints_to(M)
if(user.put_in_hands(M, TRUE)) //delete the beacon if it fails
playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
qdel(src) //otherwise delete us
/obj/structure/marker_beacon/attackby(obj/item/I, mob/user, params)
@@ -122,14 +122,14 @@ GLOBAL_LIST_INIT(marker_beacon_colors, list(
to_chat(user, "<span class='notice'>You start picking [src] up...</span>")
if(do_after(user, remove_speed, target = src) && M.amount + 1 <= M.max_amount)
M.add(1)
playsound(src, 'sound/items/deconstruct.ogg', 50, 1)
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
qdel(src)
return
if(istype(I, /obj/item/light_eater))
var/obj/effect/decal/cleanable/ash/A = new /obj/effect/decal/cleanable/ash(drop_location())
A.desc += "\nLooks like this used to be \a [src] some time ago."
visible_message("<span class='danger'>[src] is disintegrated by [I]!</span>")
playsound(src, 'sound/items/welder.ogg', 50, 1)
playsound(src, 'sound/items/welder.ogg', 50, TRUE)
qdel(src)
return
return ..()
+2 -2
View File
@@ -66,7 +66,7 @@
res = set_resonator
if(res)
res.fields += src
playsound(src,'sound/weapons/resonator_fire.ogg',50,1)
playsound(src,'sound/weapons/resonator_fire.ogg',50,TRUE)
transform = matrix()*0.75
animate(src, transform = matrix()*1.5, time = duration)
deltimer(timerid)
@@ -97,7 +97,7 @@
var/turf/closed/mineral/M = T
M.gets_drilled(creator)
check_pressure(T)
playsound(T,'sound/weapons/resonator_blast.ogg',50,1)
playsound(T,'sound/weapons/resonator_blast.ogg',50,TRUE)
for(var/mob/living/L in T)
if(creator)
log_combat(creator, L, "used a resonator field on", "resonator")
@@ -57,7 +57,7 @@
used = FALSE
return
playsound(src, 'sound/effects/phasein.ogg', 100, 1)
playsound(src, 'sound/effects/phasein.ogg', 100, TRUE)
var/turf/T = deploy_location
if(!is_mining_level(T.z)) //only report capsules away from the mining/lavaland level
@@ -47,7 +47,7 @@
var/obj/effect/portal/jaunt_tunnel/J = new (get_turf(src), src, 100, null, FALSE, get_turf(chosen_beacon))
if(adjacent)
try_move_adjacent(J)
playsound(src,'sound/effects/sparks4.ogg',50,1)
playsound(src,'sound/effects/sparks4.ogg',50,TRUE)
qdel(src)
/obj/item/wormhole_jaunter/emp_act(power)
@@ -90,7 +90,7 @@
. = ..()
if(.)
// KERPLUNK
playsound(M,'sound/weapons/resonator_blast.ogg',50,1)
playsound(M,'sound/weapons/resonator_blast.ogg',50,TRUE)
if(iscarbon(M))
var/mob/living/carbon/L = M
L.Paralyze(60)
+2 -2
View File
@@ -92,7 +92,7 @@ GLOBAL_LIST_EMPTY(total_extraction_beacons)
balloon.appearance_flags = RESET_COLOR | RESET_ALPHA | RESET_TRANSFORM
holder_obj.cut_overlay(balloon2)
holder_obj.add_overlay(balloon)
playsound(holder_obj.loc, 'sound/items/fultext_deploy.ogg', 50, 1, -3)
playsound(holder_obj.loc, 'sound/items/fultext_deploy.ogg', 50, TRUE, -3)
animate(holder_obj, pixel_z = 10, time = 20)
sleep(20)
animate(holder_obj, pixel_z = 15, time = 10)
@@ -103,7 +103,7 @@ GLOBAL_LIST_EMPTY(total_extraction_beacons)
sleep(10)
animate(holder_obj, pixel_z = 10, time = 10)
sleep(10)
playsound(holder_obj.loc, 'sound/items/fultext_launch.ogg', 50, 1, -3)
playsound(holder_obj.loc, 'sound/items/fultext_launch.ogg', 50, TRUE, -3)
animate(holder_obj, pixel_z = 1000, time = 30)
if(ishuman(A))
var/mob/living/carbon/human/L = A
@@ -895,7 +895,7 @@
to_chat(user, "<span class='danger'>You feel like you could walk straight through lava now.</span>")
H.weather_immunities |= "lava"
playsound(user.loc,'sound/items/drink.ogg', rand(10,50), 1)
playsound(user.loc,'sound/items/drink.ogg', rand(10,50), TRUE)
qdel(src)
/datum/disease/transformation/dragon
@@ -967,7 +967,7 @@
message_admins("[ADMIN_LOOKUPFLW(user)] fired the lava staff at [ADMIN_VERBOSEJMP(T)]")
log_game("[key_name(user)] fired the lava staff at [AREACOORD(T)].")
timer = world.time + create_cooldown
playsound(T,'sound/magic/fireball.ogg', 200, 1)
playsound(T,'sound/magic/fireball.ogg', 200, TRUE)
else
timer = world.time
qdel(L)
@@ -976,7 +976,7 @@
if(T.TerraformTurf(reset_turf_type, flags = CHANGETURF_INHERIT_AIR))
user.visible_message("<span class='danger'>[user] turns \the [old_name] into [reset_string]!</span>")
timer = world.time + reset_cooldown
playsound(T,'sound/magic/fireball.ogg', 200, 1)
playsound(T,'sound/magic/fireball.ogg', 200, TRUE)
/obj/effect/temp_visual/lavastaff
icon_state = "lavastaff_warn"
@@ -1016,7 +1016,7 @@
var/obj/effect/mine/pickup/bloodbath/B = new(H)
INVOKE_ASYNC(B, /obj/effect/mine/pickup/bloodbath/.proc/mineEffect, H)
to_chat(user, "<span class='notice'>You shatter the bottle!</span>")
playsound(user.loc, 'sound/effects/glassbr1.ogg', 100, 1)
playsound(user.loc, 'sound/effects/glassbr1.ogg', 100, TRUE)
message_admins("<span class='adminnotice'>[ADMIN_LOOKUPFLW(user)] has activated a bottle of mayhem!</span>")
log_combat(user, null, "activated a bottle of mayhem", src)
qdel(src)
@@ -1207,7 +1207,7 @@
INVOKE_ASYNC(src, .proc/prepare_icon_update)
if(do_after(user, 50, target = user) && !beacon)
var/turf/T = get_turf(user)
playsound(T,'sound/magic/blind.ogg', 200, 1, -4)
playsound(T,'sound/magic/blind.ogg', 200, TRUE, -4)
new /obj/effect/temp_visual/hierophant/telegraph/teleport(T, user)
beacon = new/obj/effect/hierophant(T)
user.update_action_buttons_icon()
@@ -1250,8 +1250,8 @@
return
new /obj/effect/temp_visual/hierophant/telegraph(T, user)
new /obj/effect/temp_visual/hierophant/telegraph(source, user)
playsound(T,'sound/magic/wand_teleport.ogg', 200, 1)
playsound(source,'sound/machines/airlockopen.ogg', 200, 1)
playsound(T,'sound/magic/wand_teleport.ogg', 200, TRUE)
playsound(source,'sound/machines/airlockopen.ogg', 200, TRUE)
if(!do_after(user, 3, target = user) || !user || !beacon || QDELETED(beacon)) //no walking away shitlord
teleporting = FALSE
if(user)
@@ -1322,7 +1322,7 @@
if(!T)
return
new /obj/effect/temp_visual/hierophant/telegraph/cardinal(T, user)
playsound(T,'sound/effects/bin_close.ogg', 200, 1)
playsound(T,'sound/effects/bin_close.ogg', 200, TRUE)
sleep(2)
var/obj/effect/temp_visual/hierophant/blast/B = new(T, user, friendly_fire_check)
B.damage = HIEROPHANT_CLUB_CARDINAL_DAMAGE
@@ -1349,7 +1349,7 @@
if(!T)
return
new /obj/effect/temp_visual/hierophant/telegraph(T, user)
playsound(T,'sound/effects/bin_close.ogg', 200, 1)
playsound(T,'sound/effects/bin_close.ogg', 200, TRUE)
sleep(2)
for(var/t in RANGE_TURFS(1, T))
var/obj/effect/temp_visual/hierophant/blast/B = new(t, user, friendly_fire_check)
+4 -4
View File
@@ -13,7 +13,7 @@
if(.)
return
flick("[icon_state]2", src)
playsound(loc, pick(hit_sounds), 25, 1, -1)
playsound(loc, pick(hit_sounds), 25, TRUE, -1)
if(isliving(user))
var/mob/living/L = user
SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "exercise", /datum/mood_event/exercise)
@@ -46,7 +46,7 @@
user.visible_message("<B>[user] is [bragmessage]!</B>")
AnimateMachine(user)
playsound(user, 'sound/machines/click.ogg', 60, 1)
playsound(user, 'sound/machines/click.ogg', 60, TRUE)
obj_flags &= ~IN_USE
user.pixel_y = 0
var/finishmessage = pick("You feel stronger!","You feel like you can take on the world!","You feel robust!","You feel indestructible!")
@@ -70,7 +70,7 @@
sleep(3)
animate(user, pixel_y = -4, time = 3)
sleep(3)
playsound(user, 'goon/sound/effects/spring.ogg', 60, 1)
playsound(user, 'goon/sound/effects/spring.ogg', 60, TRUE)
/obj/structure/weightmachine/weightlifter
icon = 'goon/icons/obj/fitness.dmi'
@@ -88,7 +88,7 @@
for (var/innerReps = max(reps, 1), innerReps > 0, innerReps--)
sleep(3)
animate(user, pixel_y = (user.pixel_y == 3) ? 5 : 3, time = 3)
playsound(user, 'goon/sound/effects/spring.ogg', 60, 1)
playsound(user, 'goon/sound/effects/spring.ogg', 60, TRUE)
sleep(3)
animate(user, pixel_y = 2, time = 3)
sleep(3)
+2 -2
View File
@@ -254,7 +254,7 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
/obj/item/twohanded/required/gibtonite/proc/GibtoniteReaction(mob/user, triggered_by = 0)
if(!primed)
primed = TRUE
playsound(src,'sound/effects/hit_on_shattered_glass.ogg',50,1)
playsound(src,'sound/effects/hit_on_shattered_glass.ogg',50,TRUE)
icon_state = "Gibtonite active"
var/notify_admins = FALSE
if(z != 5)//Only annoy the admins ingame if we're triggered off the mining zlevel
@@ -471,7 +471,7 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
cooldown = world.time + 15
flick("coin_[cmineral]_flip", src)
icon_state = "coin_[cmineral]_[coinflip]"
playsound(user.loc, 'sound/items/coinflip.ogg', 50, 1)
playsound(user.loc, 'sound/items/coinflip.ogg', 50, TRUE)
var/oldloc = loc
sleep(15)
if(loc == oldloc && user && !user.incapacitated())