Skip to content

Commit 9bd1560

Browse files
committed
style fixes + src. removal
1 parent 9bc6416 commit 9bd1560

File tree

9 files changed

+209
-207
lines changed

9 files changed

+209
-207
lines changed

code/controllers/subsystem/music.dm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ var/datum/subsystem/music/SSmusic
2525
events = left_events
2626

2727
/datum/subsystem/music/proc/push_event(datum/sound_player/source, mob/subject, sound/object, time, volume)
28-
if (istype(source) && istype(subject) && istype(subject) && istype(object) && volume >= 0 && volume <= 100)
29-
src.events += new /datum/musical_event(source, subject, object, time, volume)
28+
if (istype(source) && istype(subject) && istype(object) && volume >= 0 && volume <= 100)
29+
events += new /datum/musical_event(source, subject, object, time, volume)
3030

3131
/datum/subsystem/music/proc/is_overloaded()
32-
return src.events.len > global.musical_config.max_events
32+
return events.len > global.musical_config.max_events

code/modules/bayinstruments/event_manager.dm

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,36 @@
77

88

99
/datum/musical_event/New(datum/sound_player/source_, mob/subject_, sound/object_, time_, volume_)
10-
src.source = source_
11-
src.subject = subject_
12-
src.object = object_
13-
src.time = time_
14-
src.new_volume = volume_
10+
source = source_
11+
subject = subject_
12+
object = object_
13+
time = time_
14+
new_volume = volume_
1515

1616

1717
/datum/musical_event/proc/tick()
1818
if (!(istype(object) && istype(subject) && istype(source)))
1919
return
20-
if (src.new_volume > 0) src.update_sound()
21-
else src.destroy_sound()
20+
if (new_volume > 0)
21+
update_sound()
22+
else
23+
destroy_sound()
2224

2325

2426
/datum/musical_event/proc/update_sound()
25-
src.object.volume = src.new_volume
26-
src.object.status |= SOUND_UPDATE
27-
if (src.subject)
28-
src.subject << src.object
27+
object.volume = new_volume
28+
object.status |= SOUND_UPDATE
29+
if (subject)
30+
subject << object
2931

3032

3133
/datum/musical_event/proc/destroy_sound()
32-
if (src.subject)
33-
var/sound/null_sound = sound(channel=src.object.channel, wait=0)
34+
if (subject)
35+
var/sound/null_sound = sound(channel=object.channel, wait=0)
3436
if (global.musical_config.env_settings_available)
3537
null_sound.environment = -1
36-
src.subject << null_sound
37-
if (src.source || src.source.song)
38-
src.source.song.free_channel(src.object.channel)
38+
subject << null_sound
39+
if (source || source.song)
40+
source.song.free_channel(object.channel)
3941

4042

code/modules/bayinstruments/globals.dm

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,26 +204,26 @@ Bit flags that modify the behavior of above properties
204204

205205

206206
/datum/musical_config/proc/n2t(key) // Used instead of num2text for faster access in sample_map
207-
if (!src.n2t_int.len)
207+
if (!n2t_int.len)
208208
for (var/i=1, i<=127, i++)
209-
src.n2t_int += num2text(i)
209+
n2t_int += num2text(i)
210210

211211
if (key==0)
212212
return "0" // Fuck you BYOND
213213
if (!isnum(key) || key < 0 || key>127 || round(key) != key)
214214
CRASH("n2t argument must be an integer from 0 to 127")
215-
return src.n2t_int[key]
215+
return n2t_int[key]
216216

217217

218218
/datum/musical_config/proc/environment_to_id(environment)
219-
if (environment in src.all_environments)
220-
return src.all_environments.Find(environment) - 2
219+
if (environment in all_environments)
220+
return all_environments.Find(environment) - 2
221221
return -1
222222

223223

224224
/datum/musical_config/proc/id_to_environment(id)
225225
if (id >= -1 && id <= 26)
226-
return src.all_environments[id+2]
226+
return all_environments[id+2]
227227
return "None"
228228

229229

@@ -232,13 +232,13 @@ Bit flags that modify the behavior of above properties
232232

233233

234234
/datum/musical_config/proc/is_custom_env(id)
235-
return id_to_environment(id) == src.all_environments[28]
235+
return id_to_environment(id) == all_environments[28]
236236

237237

238238
/datum/sample_pair
239239
var/sample
240240
var/deviation = 0
241241

242-
/datum/sample_pair/New(sample_file, deviation)
243-
src.sample = sample_file
244-
src.deviation = deviation
242+
/datum/sample_pair/New(sample_file, deviation_)
243+
sample = sample_file
244+
deviation = deviation_

code/modules/bayinstruments/instruments.dm

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
/datum/instrument/proc/create_full_sample_deviation_map()
1010
// Obtain samples
11-
if (!src.samples.len)
12-
CRASH("No samples were defined in [src.type]")
11+
if (!samples.len)
12+
CRASH("No samples were defined in [type]")
1313

1414
var/list/delta_1 = list()
1515
for (var/key in samples)
@@ -19,21 +19,21 @@
1919
for (var/indx1=1 to delta_1.len-1)
2020
var/from_key = delta_1[indx1]
2121
var/to_key = delta_1[indx1+1]
22-
var/sample1 = src.samples[global.musical_config.n2t(from_key)]
23-
var/sample2 = src.samples[global.musical_config.n2t(to_key)]
22+
var/sample1 = samples[global.musical_config.n2t(from_key)]
23+
var/sample2 = samples[global.musical_config.n2t(to_key)]
2424
var/pivot = round((from_key+to_key)/2)
2525
for (var/key = from_key to pivot)
26-
src.sample_map[global.musical_config.n2t(key)] = new /datum/sample_pair(sample1, key-from_key) // [55+56] / 2 -> 55.5 -> 55 so no changes will occur
26+
sample_map[global.musical_config.n2t(key)] = new /datum/sample_pair(sample1, key-from_key) // [55+56] / 2 -> 55.5 -> 55 so no changes will occur
2727
for (var/key = pivot+1 to to_key)
28-
src.sample_map[global.musical_config.n2t(key)] = new /datum/sample_pair(sample2, key-to_key)
28+
sample_map[global.musical_config.n2t(key)] = new /datum/sample_pair(sample2, key-to_key)
2929

3030
// Fill in 0 -- first key and last key -- 127
3131
var/first_key = delta_1[1]
3232
var/last_key = delta_1[delta_1.len]
33-
var/first_sample = src.samples[global.musical_config.n2t(first_key)]
34-
var/last_sample = src.samples[global.musical_config.n2t(last_key)]
33+
var/first_sample = samples[global.musical_config.n2t(first_key)]
34+
var/last_sample = samples[global.musical_config.n2t(last_key)]
3535
for (var/key=0 to first_key-1)
36-
src.sample_map[global.musical_config.n2t(key)] = new /datum/sample_pair(first_sample, key-first_key)
36+
sample_map[global.musical_config.n2t(key)] = new /datum/sample_pair(first_sample, key-first_key)
3737
for (var/key=last_key to 127)
38-
src.sample_map[global.musical_config.n2t(key)] = new /datum/sample_pair(last_sample, key-last_key)
39-
return src.samples
38+
sample_map[global.musical_config.n2t(key)] = new /datum/sample_pair(last_sample, key-last_key)
39+
return samples

code/modules/bayinstruments/real_instruments.dm

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88

99
/obj/structure/synthesized_instrument/New()
1010
..()
11-
src.maximum_lines = global.musical_config.max_lines
12-
src.maximum_line_length = global.musical_config.max_line_length
11+
maximum_lines = global.musical_config.max_lines
12+
maximum_line_length = global.musical_config.max_line_length
1313

1414

1515
/obj/structure/synthesized_instrument/Destroy()
16-
qdel(src.player)
16+
qdel(player)
1717
..()
1818

1919

2020
/obj/structure/synthesized_instrument/attack_hand(mob/user)
21-
src.interact(user)
21+
interact(user)
2222

2323

2424
/obj/structure/synthesized_instrument/interact(mob/user) // CONDITIONS ..(user) that shit in subclasses
25-
src.ui_interact(user)
25+
ui_interact(user)
2626

2727

2828
/obj/structure/synthesized_instrument/ui_interact(mob/user)
@@ -43,47 +43,47 @@
4343
to_chat(usr, "Non-numeric value was given")
4444
return 0
4545

46-
src.add_fingerprint(usr)
46+
add_fingerprint(usr)
4747

4848
switch (target)
49-
if ("tempo") src.player.song.tempo = src.player.song.sanitize_tempo(src.player.song.tempo + value*world.tick_lag)
49+
if ("tempo") player.song.tempo = player.song.sanitize_tempo(player.song.tempo + value*world.tick_lag)
5050
if ("play")
51-
src.player.song.playing = value
52-
if (src.player.song.playing)
53-
src.player.song.play_song(usr)
51+
player.song.playing = value
52+
if (player.song.playing)
53+
player.song.play_song(usr)
5454
if ("newsong")
55-
src.player.song.lines.Cut()
56-
src.player.song.tempo = src.player.song.sanitize_tempo(5) // default 120 BPM
55+
player.song.lines.Cut()
56+
player.song.tempo = player.song.sanitize_tempo(5) // default 120 BPM
5757
if ("import")
5858
var/t = ""
5959
do
6060
t = html_encode(input(usr, "Please paste the entire song, formatted:", text("[]", name), t) as message)
6161
if(!in_range(src, usr))
6262
return
6363

64-
if(length(t) >= 2*src.maximum_lines*src.maximum_line_length)
64+
if(length(t) >= 2*maximum_lines*maximum_line_length)
6565
var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no")
6666
if(cont == "no")
6767
break
68-
while(length(t) > 2*src.maximum_lines*src.maximum_line_length)
68+
while(length(t) > 2*maximum_lines*maximum_line_length)
6969
if (length(t))
70-
src.player.song.lines = splittext(t, "\n")
71-
if(copytext(src.player.song.lines[1],1,6) == "BPM: ")
72-
if(text2num(copytext(src.player.song.lines[1],6)) != 0)
73-
src.player.song.tempo = src.player.song.sanitize_tempo(600 / text2num(copytext(src.player.song.lines[1],6)))
74-
src.player.song.lines.Cut(1,2)
70+
player.song.lines = splittext(t, "\n")
71+
if(copytext(player.song.lines[1],1,6) == "BPM: ")
72+
if(text2num(copytext(player.song.lines[1],6)) != 0)
73+
player.song.tempo = player.song.sanitize_tempo(600 / text2num(copytext(player.song.lines[1],6)))
74+
player.song.lines.Cut(1,2)
7575
else
76-
src.player.song.tempo = src.player.song.sanitize_tempo(5)
76+
player.song.tempo = player.song.sanitize_tempo(5)
7777
else
78-
src.player.song.tempo = src.player.song.sanitize_tempo(5) // default 120 BPM
79-
if(src.player.song.lines.len > maximum_lines)
78+
player.song.tempo = player.song.sanitize_tempo(5) // default 120 BPM
79+
if(player.song.lines.len > maximum_lines)
8080
to_chat(usr,"Too many lines!")
81-
src.player.song.lines.Cut(maximum_lines+1)
81+
player.song.lines.Cut(maximum_lines+1)
8282
var/linenum = 1
83-
for(var/l in src.player.song.lines)
83+
for(var/l in player.song.lines)
8484
if(length(l) > maximum_line_length)
8585
to_chat(usr, "Line [linenum] too long!")
86-
src.player.song.lines.Remove(l)
86+
player.song.lines.Remove(l)
8787
else
8888
linenum++
8989
else
@@ -103,21 +103,21 @@
103103

104104
/obj/item/device/synthesized_instrument/New()
105105
..()
106-
src.maximum_lines = global.musical_config.max_lines
107-
src.maximum_line_length = global.musical_config.max_line_length
106+
maximum_lines = global.musical_config.max_lines
107+
maximum_line_length = global.musical_config.max_line_length
108108

109109

110110
/obj/item/device/synthesized_instrument/Destroy()
111-
qdel(src.player)
111+
qdel(player)
112112
..()
113113

114114

115115
/obj/item/device/synthesized_instrument/attack_hand(mob/user)
116-
src.interact(user)
116+
interact(user)
117117

118118

119119
/obj/item/device/synthesized_instrument/interact(mob/user) // CONDITIONS ..(user) that shit in subclasses
120-
src.ui_interact(user)
120+
ui_interact(user)
121121

122122
/obj/item/device/synthesized_instrument/ui_interact(mob/user)
123123
return 0
@@ -137,47 +137,47 @@
137137
to_chat(usr, "Non-numeric value was given")
138138
return 0
139139

140-
src.add_fingerprint(usr)
140+
add_fingerprint(usr)
141141

142142
switch (target)
143-
if ("tempo") src.player.song.tempo = src.player.song.sanitize_tempo(src.player.song.tempo + value*world.tick_lag)
143+
if ("tempo") player.song.tempo = player.song.sanitize_tempo(player.song.tempo + value*world.tick_lag)
144144
if ("play")
145-
src.player.song.playing = value
146-
if (src.player.song.playing)
147-
src.player.song.play_song(usr)
145+
player.song.playing = value
146+
if (player.song.playing)
147+
player.song.play_song(usr)
148148
if ("newsong")
149-
src.player.song.lines.Cut()
150-
src.player.song.tempo = src.player.song.sanitize_tempo(5) // default 120 BPM
149+
player.song.lines.Cut()
150+
player.song.tempo = player.song.sanitize_tempo(5) // default 120 BPM
151151
if ("import")
152152
var/t = ""
153153
do
154154
t = html_encode(input(usr, "Please paste the entire song, formatted:", text("[]", name), t) as message)
155155
if(!in_range(src, usr))
156156
return
157157

158-
if(length(t) >= 2*src.maximum_lines*src.maximum_line_length)
158+
if(length(t) >= 2*maximum_lines*maximum_line_length)
159159
var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no")
160160
if(cont == "no")
161161
break
162-
while(length(t) > 2*src.maximum_lines*src.maximum_line_length)
162+
while(length(t) > 2*maximum_lines*maximum_line_length)
163163
if (length(t))
164-
src.player.song.lines = splittext(t, "\n")
165-
if(copytext(src.player.song.lines[1],1,6) == "BPM: ")
166-
if(text2num(copytext(src.player.song.lines[1],6)) != 0)
167-
src.player.song.tempo = src.player.song.sanitize_tempo(600 / text2num(copytext(src.player.song.lines[1],6)))
168-
src.player.song.lines.Cut(1,2)
164+
player.song.lines = splittext(t, "\n")
165+
if(copytext(player.song.lines[1],1,6) == "BPM: ")
166+
if(text2num(copytext(player.song.lines[1],6)) != 0)
167+
player.song.tempo = player.song.sanitize_tempo(600 / text2num(copytext(player.song.lines[1],6)))
168+
player.song.lines.Cut(1,2)
169169
else
170-
src.player.song.tempo = src.player.song.sanitize_tempo(5)
170+
player.song.tempo = player.song.sanitize_tempo(5)
171171
else
172-
src.player.song.tempo = src.player.song.sanitize_tempo(5) // default 120 BPM
173-
if(src.player.song.lines.len > maximum_lines)
172+
player.song.tempo = player.song.sanitize_tempo(5) // default 120 BPM
173+
if(player.song.lines.len > maximum_lines)
174174
to_chat(usr, "Too many lines!")
175-
src.player.song.lines.Cut(maximum_lines+1)
175+
player.song.lines.Cut(maximum_lines+1)
176176
var/linenum = 1
177-
for(var/l in src.player.song.lines)
177+
for(var/l in player.song.lines)
178178
if(length(l) > maximum_line_length)
179179
to_chat(usr, "Line [linenum] too long!")
180-
src.player.song.lines.Remove(l)
180+
player.song.lines.Remove(l)
181181
else
182182
linenum++
183183
else

0 commit comments

Comments
 (0)