Skip to content

Commit ef2f89c

Browse files
committed
suit mod qol
1 parent 17490a5 commit ef2f89c

File tree

2 files changed

+142
-56
lines changed

2 files changed

+142
-56
lines changed

code/game/machinery/suit_modifier.dm

Lines changed: 142 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
var/static/list/plasmaman_suits
2929
var/static/list/vox_suits
3030
var/apply_multiplier = 1
31+
var/phasic_scanning = FALSE
3132
idle_power_usage = 50
3233
active_power_usage = 300
3334

@@ -70,8 +71,12 @@
7071
/obj/item/weapon/stock_parts/scanning_module,
7172
/obj/item/weapon/stock_parts/micro_laser
7273
)
73-
if(world.has_round_started())
74-
initialize()
74+
suit_overlay = new /atom/movable/overlay(src)
75+
suit_overlay.icon = 'icons/obj/stationobjs.dmi'
76+
suit_overlay.icon_state = "suitmodifier_overlay"
77+
suit_overlay.plane = ABOVE_HUMAN_PLANE
78+
suit_overlay.mouse_opacity = 0
79+
vis_contents += suit_overlay
7580

7681
/obj/machinery/suit_modifier/RefreshParts()
7782
var/avg_rate = 0
@@ -86,12 +91,13 @@
8691
avg_rate += ML.rating
8792
amount++
8893
active_power_usage = 300 / (avg_rate / amount)
94+
for(var/obj/item/weapon/stock_parts/scanning_module/SM in component_parts)
95+
if(SM.rating >= 3)
96+
phasic_scanning = TRUE
97+
else
98+
phasic_scanning = FALSE
8999

90100
/obj/machinery/suit_modifier/initialize()
91-
suit_overlay = new
92-
suit_overlay.icon = 'icons/obj/stationobjs.dmi'
93-
suit_overlay.plane = ABOVE_HUMAN_PLANE
94-
vis_contents += suit_overlay
95101
if(!plasmaman_suits)
96102
plasmaman_suits = build_plasmaman_suit_list()
97103
if(!vox_suits)
@@ -113,10 +119,12 @@
113119

114120
/obj/machinery/suit_modifier/attackby(var/obj/item/I, var/mob/user)
115121
if(istype(I, /obj/item/rig_module) && user.drop_item(I, src))
122+
playsound(src, 'sound/machines/click.ogg', 50, 1)
116123
say("\The [I] installed.", class = "binaryradio")
117124
modules_to_install.Add(I)
118125
return
119126
if(istype(I, /obj/item/weapon/cell) && !cell && user.drop_item(I, src))
127+
playsound(src, 'sound/machines/click.ogg', 50, 1)
120128
say("\The [I] installed.", class = "binaryradio")
121129
cell = I
122130
return
@@ -125,6 +133,8 @@
125133
/obj/machinery/suit_modifier/attack_hand(mob/user)
126134
if(!isliving(user))
127135
return
136+
if(!powered())
137+
return
128138
if(is_locking(/mob/living/carbon/human))
129139
playsound(src, 'sound/machines/buzz-two.ogg', 50, 0)
130140
say("Unit Occupied.", class = "binaryradio")
@@ -164,23 +174,63 @@
164174
modules_to_install -= removed
165175

166176
/obj/machinery/suit_modifier/proc/activation_animation()
177+
//Close the scanner module
167178
flick("suitmodifier_activate", suit_overlay)
168-
sleep(12)
179+
playsound(src, 'sound/machines/click.ogg', 30, 1)
180+
sleep(11)
181+
//Lights turn on
182+
suit_overlay.set_light(1,1,"#00FF00")
183+
sleep(1)
184+
suit_overlay.icon_state = "suitmodifier_active"
169185

170-
/obj/machinery/suit_modifier/proc/working_animation()
186+
//If the scanners are good enough, we don't need to scan the suit
187+
if(phasic_scanning)
188+
return
189+
190+
//Begin the scanner, scans 4 times
171191
flick("suitmodifier_working", suit_overlay)
172-
sleep(38)
192+
sleep(3)
193+
playsound(src, 'sound/items/healthanalyzer.ogg', 30, 1)
194+
sleep(9)
195+
playsound(src, 'sound/items/healthanalyzer.ogg', 30, 1)
196+
sleep(17)
197+
playsound(src, 'sound/items/healthanalyzer.ogg', 30, 1)
198+
sleep(9)
199+
playsound(src, 'sound/items/healthanalyzer.ogg', 30, 1)
200+
sleep(9)
201+
playsound(src, 'sound/machines/click.ogg', 30, 1)
173202

203+
/obj/machinery/suit_modifier/proc/working_animation()
204+
//Close the big doors
174205
flick("suitmodifier_close", suit_overlay)
175-
sleep(22)
206+
playsound(src, 'sound/machines/poddoor.ogg', 50, 1)
207+
sleep(12)
208+
//Light gets covered up, anim still playing
209+
suit_overlay.set_light(0,0,"#00FF00")
210+
sleep(10)
176211

212+
//Doors are closed
177213
suit_overlay.icon_state = "suitmodifier_closed"
178214
sleep(20)
179215

180216
/obj/machinery/suit_modifier/proc/finished_animation()
181-
suit_overlay.icon_state = null
182-
playsound(src, 'sound/machines/pressurehiss.ogg', 40, 1)
217+
//Pssshhh, doors open
218+
playsound(src, 'sound/machines/poddoor.ogg', 50, 1)
219+
playsound(src, 'sound/machines/pressurehiss.ogg', 30, 1)
183220
new /obj/effect/smoke(get_turf(src))
221+
flick("suitmodifier_open", suit_overlay)
222+
sleep(22)
223+
224+
suit_overlay.icon_state = "suitmodifier_overlay"
225+
226+
/obj/machinery/suit_modifier/proc/cancel_animation()
227+
//Open the scanner module
228+
suit_overlay.set_light(0,0,"#00FF00")
229+
flick("suitmodifier_deactivate", suit_overlay)
230+
sleep(12)
231+
playsound(src, 'sound/machines/click.ogg', 30, 1)
232+
233+
suit_overlay.icon_state = "suitmodifier_overlay"
184234

185235
/proc/filter_suit_list(mob/living/carbon/human/guy, list/suit_list)
186236
var/guy_access = guy.GetAccess()
@@ -194,93 +244,129 @@
194244
/obj/machinery/suit_modifier/proc/process_suit_replace(mob/living/carbon/human/guy, list/suit_list)
195245
if(activated)
196246
return
247+
activated = TRUE
248+
use_power = MACHINE_POWER_USE_ACTIVE
197249
lock_atom(guy)
250+
activation_animation()
198251
var/obj/item/clothing/suit/space/chosen_job = input(guy, "What kind of model do you wish to apply?") as null|anything in filter_suit_list(guy, suit_list)
199252
if(!chosen_job || activated || guy.incapacitated() || guy.loc != loc)
253+
cancel_animation()
200254
unlock_atom(guy)
255+
use_power = MACHINE_POWER_USE_IDLE
256+
activated = FALSE
201257
return
258+
working_animation()
202259
var/obj/item/clothing/suit/space/chosen_suit = suit_list[chosen_job][SUIT_INDEX]
203260
var/obj/item/clothing/head/helmet/space/chosen_helmet = suit_list[chosen_job][HELMET_INDEX]
204-
activated = TRUE
205-
use_power = MACHINE_POWER_USE_ACTIVE
206-
activation_animation()
207-
working_animation()
208-
var/obj/item/clothing/suit/space/oldsuit = guy.get_item_by_slot(slot_wear_suit)
209-
if(oldsuit)
210-
guy.equip_to_slot(new chosen_suit, slot_wear_suit)
211-
qdel(oldsuit)
212-
guy.update_inv_wear_suit()
213-
var/obj/item/clothing/head/helmet/space/oldhelmet = guy.get_item_by_slot(slot_head)
214-
if(oldhelmet)
215-
guy.equip_to_slot(new chosen_helmet, slot_head)
216-
qdel(oldhelmet)
217-
guy.update_inv_head()
218-
finished_animation()
261+
spawn(rand(3,10) / apply_multiplier)
262+
playsound(src, 'sound/effects/spray3.ogg', 30, 1)
263+
spawn(rand(20,30) / apply_multiplier)
264+
playsound(src, 'sound/effects/spray2.ogg', 30, 1)
265+
spawn(5 SECONDS / apply_multiplier)
266+
playsound(src, 'sound/effects/spray.ogg', 30, 1)
267+
if(do_after(guy, src, 8 SECONDS / apply_multiplier, needhand = FALSE))
268+
var/obj/item/clothing/suit/space/oldsuit = guy.get_item_by_slot(slot_wear_suit)
269+
if(oldsuit)
270+
guy.equip_to_slot(new chosen_suit, slot_wear_suit)
271+
qdel(oldsuit)
272+
guy.update_inv_wear_suit()
273+
var/obj/item/clothing/head/helmet/space/oldhelmet = guy.get_item_by_slot(slot_head)
274+
if(oldhelmet)
275+
guy.equip_to_slot(new chosen_helmet, slot_head)
276+
qdel(oldhelmet)
277+
guy.update_inv_head()
219278
unlock_atom(guy)
279+
finished_animation()
220280
use_power = MACHINE_POWER_USE_IDLE
221281
activated = FALSE
222282

223283
/obj/machinery/suit_modifier/proc/process_module_installation(var/mob/living/carbon/human/H)
224284
if(activated)
225285
return
226-
lock_atom(H)
286+
var/obj/item/clothing/suit/space/rig/R = H.is_wearing_item(/obj/item/clothing/suit/space/rig, slot_wear_suit)
287+
if(!R)
288+
return
227289
activated = TRUE
228290
use_power = MACHINE_POWER_USE_ACTIVE
229-
activation_animation()
230-
var/obj/item/clothing/suit/space/rig/R = H.is_wearing_item(/obj/item/clothing/suit/space/rig, slot_wear_suit)
291+
R.canremove = FALSE
292+
lock_atom(H)
231293
R.deactivate_suit()
294+
activation_animation()
295+
working_animation()
232296
for(var/obj/item/rig_module/RM in modules_to_install)
233297
var/install_result=RM.can_install(R)
234298
if(!install_result[1]) //more versatile check, allows for custom install conditions.
235299
say(install_result[2], class = "binaryradio")
236300
continue
301+
playsound(src, 'sound/mecha/hydraulic.ogg', 40, 1)
302+
spawn(rand(4 SECONDS, 5 SECONDS) / apply_multiplier)
303+
playsound(src, 'sound/items/Welder.ogg', 50, 1)
237304
if(do_after(H, src, 8 SECONDS / apply_multiplier, needhand = FALSE))
238305
say("Installing [RM] into \the [R].", class = "binaryradio")
239306
R.modules.Add(RM)
240307
RM.rig = R
241308
RM.forceMove(R)
242309
modules_to_install.Remove(RM)
243-
working_animation()
244310
if(cell) //Can't answer the prompt if you're incapacitated.
245311
var/choice = alert(H, "Do you wish to install [cell]?", src, "Yes", "No")
246312
if((choice == "Yes") && H.Adjacent(src) && !H.incapacitated())
247313
say("Installing [cell] into to \the [R].", class = "binaryradio")
248-
if(R.cell)
249-
R.cell.forceMove(get_turf(src))
250-
cell.forceMove(R)
251-
R.cell = cell
252-
cell = null
253-
finished_animation()
254-
unlock_atom(H)
314+
playsound(src, 'sound/mecha/hydraulic.ogg', 40, 1)
315+
spawn(rand(4 SECONDS, 5 SECONDS) / apply_multiplier)
316+
playsound(src, 'sound/misc/click.ogg', 50, 1)
317+
if(do_after(H, src, 8 SECONDS / apply_multiplier, needhand = FALSE))
318+
if(R.cell)
319+
R.cell.forceMove(get_turf(src))
320+
cell.forceMove(R)
321+
R.cell = cell
322+
cell = null
323+
if(!R.current_glue_state)
324+
R.canremove = TRUE
255325
R.initialize_suit()
326+
unlock_atom(H)
327+
finished_animation()
256328
use_power = MACHINE_POWER_USE_IDLE
257329
activated = FALSE
258330

259331
/obj/machinery/suit_modifier/proc/process_module_removal(var/mob/living/carbon/human/H)
260332
if(activated)
261333
return
262-
lock_atom(H)
334+
var/obj/item/clothing/suit/space/rig/R = H.is_wearing_item(/obj/item/clothing/suit/space/rig, slot_wear_suit)
335+
if(!R)
336+
return
337+
// if we have something that's not a rig_module here we have a problem
338+
if(!R.modules.len)
339+
return
263340
activated = TRUE
264341
use_power = MACHINE_POWER_USE_ACTIVE
265-
activation_animation()
266-
var/obj/item/clothing/suit/space/rig/R = H.is_wearing_item(/obj/item/clothing/suit/space/rig, slot_wear_suit)
342+
R.canremove = FALSE
343+
lock_atom(H)
267344
R.deactivate_suit()
268-
if(R.modules.len)
269-
// if we have something that's not a rig_module here we have a problem
270-
var/obj/item/rig_module/RM = input(H, "Choose an upgrade to remove from [R].", R) as null|anything in R.modules
271-
if(!RM|| !H.Adjacent(src) || H.incapacitated())
272-
unlock_atom(H)
273-
activated = FALSE
274-
return
275-
working_animation()
276-
say("Uninstalling [RM] from \the [R].", class = "binaryradio")
277-
if(do_after(H, src, 8 SECONDS / apply_multiplier, needhand = FALSE))
278-
R.modules.Remove(RM)
279-
RM.rig = null
280-
RM.forceMove(get_turf(src))
281-
finished_animation()
282-
unlock_atom(H)
345+
activation_animation()
346+
var/obj/item/rig_module/RM = input(H, "Choose an upgrade to remove from [R].", R) as null|anything in R.modules
347+
if(!RM|| !H.Adjacent(src) || H.incapacitated())
348+
cancel_animation()
349+
if(!R.current_glue_state)
350+
R.canremove = TRUE
351+
unlock_atom(H)
352+
R.initialize_suit()
353+
use_power = MACHINE_POWER_USE_IDLE
354+
activated = FALSE
355+
return
356+
say("Uninstalling [RM] from \the [R].", class = "binaryradio")
357+
working_animation()
358+
playsound(src, 'sound/mecha/hydraulic.ogg', 40, 1)
359+
spawn(rand(4 SECONDS, 5 SECONDS) / apply_multiplier)
360+
playsound(src, 'sound/items/Welder.ogg', 60, 1)
361+
if(do_after(H, src, 8 SECONDS / apply_multiplier, needhand = FALSE))
362+
R.modules.Remove(RM)
363+
RM.rig = null
364+
RM.forceMove(get_turf(src))
365+
if(!R.current_glue_state)
366+
R.canremove = TRUE
283367
R.initialize_suit()
368+
unlock_atom(H)
369+
finished_animation()
284370
use_power = MACHINE_POWER_USE_IDLE
285371
activated = FALSE
286372

icons/obj/stationobjs.dmi

9.36 KB
Binary file not shown.

0 commit comments

Comments
 (0)