Skip to content

Commit 0cc8bbb

Browse files
authored
suit modifier fixes (#37258)
1 parent 2aab390 commit 0cc8bbb

File tree

1 file changed

+35
-15
lines changed

1 file changed

+35
-15
lines changed

code/game/machinery/suit_modifier.dm

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@
118118
/obj/machinery/suit_modifier/attackby(var/obj/item/I, var/mob/user)
119119
if(istype(I, /obj/item/rig_module) && user.drop_item(I, src))
120120
playsound(src, 'sound/machines/click.ogg', 50, 1)
121-
say("\The [I] installed.", class = "binaryradio")
121+
say("Preparing \the [I] for installation.", class = "binaryradio")
122122
modules_to_install.Add(I)
123123
return
124124
if(istype(I, /obj/item/weapon/cell) && !cell && user.drop_item(I, src))
125125
playsound(src, 'sound/machines/click.ogg', 50, 1)
126-
say("\The [I] installed.", class = "binaryradio")
126+
say("Preparing \the [I] for installation.", class = "binaryradio")
127127
cell = I
128128
return
129129
.=..()
@@ -135,7 +135,7 @@
135135
return
136136
if(is_locking(/mob/living/carbon/human))
137137
playsound(src, 'sound/machines/buzz-two.ogg', 50, 0)
138-
say("Unit Occupied.", class = "binaryradio")
138+
say("Error: Unit occupied.", class = "binaryradio")
139139
return
140140
if(!ishuman(user))
141141
return
@@ -146,10 +146,9 @@
146146
var/obj/item/clothing/suit/space/rig/worn_rig = worn_suit
147147
if(!modules_to_install.len && !cell)
148148
if(worn_rig.modules.len)
149-
say("Installed modules detected.", class = "binaryradio")
150149
process_module_removal(H)
151150
return
152-
say("No upgrade available.", class = "binaryradio")
151+
say("Error: No modules detected and no upgrades available.", class = "binaryradio")
153152
return
154153
process_module_installation(H)
155154
return
@@ -158,9 +157,9 @@
158157
else if(istype(worn_suit, /obj/item/clothing/suit/space/vox))
159158
process_suit_replace(H, vox_suits)
160159
else
161-
say("Unable to detect compatible spacesuit on [H].", class = "binaryradio")
160+
say("Error: Unable to detect compatible spacesuit on [H].", class = "binaryradio")
162161
else if((modules_to_install.len || cell) && !activated)
163-
var/obj/removed = input(user, "Choose an upgrade to remove from [src].", src) as null|anything in modules_to_install + cell
162+
var/obj/removed = input(user, "Choose an upgrade to remove from \the [src].", src.name) as null|anything in modules_to_install + cell
164163
if(!removed || activated || !user.Adjacent(src) || user.incapacitated())
165164
return
166165
user.put_in_hands(removed)
@@ -239,45 +238,63 @@
239238
filtered_suit_list[entry] = list(suit_list[entry][SUIT_INDEX], suit_list[entry][HELMET_INDEX])
240239
return filtered_suit_list
241240

241+
/**
242+
* Changes a vox/plasmaman suit.
243+
*/
242244
/obj/machinery/suit_modifier/proc/process_suit_replace(mob/living/carbon/human/guy, list/suit_list)
243245
if(activated)
244246
return
245247
activated = TRUE
246248
use_power = MACHINE_POWER_USE_ACTIVE
247249
lock_atom(guy)
250+
var/obj/item/clothing/suit/space/oldsuit = guy.get_item_by_slot(slot_wear_suit)
251+
var/obj/item/clothing/head/helmet/space/oldhelmet = guy.get_item_by_slot(slot_head)
252+
oldsuit?.canremove = FALSE
253+
oldhelmet?.canremove = FALSE
248254
activation_animation()
249-
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)
250-
if(!chosen_job || activated || guy.incapacitated() || guy.loc != loc)
255+
var/chosen_job = input(guy, "What kind of model do you wish to apply?", src.name) as null|anything in filter_suit_list(guy, suit_list)
256+
if(!chosen_job || guy.incapacitated() || guy.loc != loc)
251257
cancel_animation()
252258
unlock_atom(guy)
253259
use_power = MACHINE_POWER_USE_IDLE
254260
activated = FALSE
261+
if(!oldsuit?.current_glue_state)
262+
oldsuit?.canremove = TRUE
263+
if(!oldhelmet?.current_glue_state)
264+
oldhelmet?.canremove = TRUE
255265
return
256266
working_animation()
257267
var/obj/item/clothing/suit/space/chosen_suit = suit_list[chosen_job][SUIT_INDEX]
258268
var/obj/item/clothing/head/helmet/space/chosen_helmet = suit_list[chosen_job][HELMET_INDEX]
269+
say("Repainting \the [oldsuit ? oldsuit.name : "suit"] into the [lowertext(chosen_job)] model.", class = "binaryradio")
259270
spawn(rand(3,10) / apply_multiplier)
260271
playsound(src, 'sound/effects/spray3.ogg', 30, 1)
261272
spawn(rand(20,30) / apply_multiplier)
262273
playsound(src, 'sound/effects/spray2.ogg', 30, 1)
263274
spawn(5 SECONDS / apply_multiplier)
264275
playsound(src, 'sound/effects/spray.ogg', 30, 1)
265276
if(do_after(guy, src, 8 SECONDS / apply_multiplier, needhand = FALSE))
266-
var/obj/item/clothing/suit/space/oldsuit = guy.get_item_by_slot(slot_wear_suit)
267277
if(oldsuit)
268278
guy.equip_to_slot(new chosen_suit, slot_wear_suit)
269279
qdel(oldsuit)
270280
guy.update_inv_wear_suit()
271-
var/obj/item/clothing/head/helmet/space/oldhelmet = guy.get_item_by_slot(slot_head)
272281
if(oldhelmet)
273282
guy.equip_to_slot(new chosen_helmet, slot_head)
274283
qdel(oldhelmet)
275284
guy.update_inv_head()
285+
else
286+
if(!oldsuit?.current_glue_state)
287+
oldsuit?.canremove = TRUE
288+
if(!oldhelmet?.current_glue_state)
289+
oldhelmet?.canremove = TRUE
276290
unlock_atom(guy)
277291
finished_animation()
278292
use_power = MACHINE_POWER_USE_IDLE
279293
activated = FALSE
280294

295+
/**
296+
* Adds a module to a rigsuit
297+
*/
281298
/obj/machinery/suit_modifier/proc/process_module_installation(var/mob/living/carbon/human/H)
282299
if(activated)
283300
return
@@ -296,19 +313,19 @@
296313
if(!install_result[1]) //more versatile check, allows for custom install conditions.
297314
say(install_result[2], class = "binaryradio")
298315
continue
316+
say("Installing \the [RM] into \the [R].", class = "binaryradio")
299317
playsound(src, 'sound/mecha/hydraulic.ogg', 40, 1)
300318
spawn(rand(4 SECONDS, 5 SECONDS) / apply_multiplier)
301319
playsound(src, 'sound/items/Welder.ogg', 50, 1)
302320
if(do_after(H, src, 8 SECONDS / apply_multiplier, needhand = FALSE))
303-
say("Installing [RM] into \the [R].", class = "binaryradio")
304321
R.modules.Add(RM)
305322
RM.rig = R
306323
RM.forceMove(R)
307324
modules_to_install.Remove(RM)
308325
if(cell) //Can't answer the prompt if you're incapacitated.
309326
var/choice = alert(H, "Do you wish to install [cell]?", src, "Yes", "No")
310327
if((choice == "Yes") && H.Adjacent(src) && !H.incapacitated())
311-
say("Installing [cell] into to \the [R].", class = "binaryradio")
328+
say("Installing \the [cell] into to \the [R].", class = "binaryradio")
312329
playsound(src, 'sound/mecha/hydraulic.ogg', 40, 1)
313330
spawn(rand(4 SECONDS, 5 SECONDS) / apply_multiplier)
314331
playsound(src, 'sound/misc/click.ogg', 50, 1)
@@ -325,6 +342,9 @@
325342
use_power = MACHINE_POWER_USE_IDLE
326343
activated = FALSE
327344

345+
/**
346+
* Removes a module from a rigsuit
347+
*/
328348
/obj/machinery/suit_modifier/proc/process_module_removal(var/mob/living/carbon/human/H)
329349
if(activated)
330350
return
@@ -340,7 +360,7 @@
340360
lock_atom(H)
341361
R.deactivate_suit()
342362
activation_animation()
343-
var/obj/item/rig_module/RM = input(H, "Choose an upgrade to remove from [R].", R) as null|anything in R.modules
363+
var/obj/item/rig_module/RM = input(H, "Choose an upgrade to remove from [R].", src.name) as null|anything in R.modules
344364
if(!RM|| !H.Adjacent(src) || H.incapacitated())
345365
cancel_animation()
346366
if(!R.current_glue_state)
@@ -350,8 +370,8 @@
350370
use_power = MACHINE_POWER_USE_IDLE
351371
activated = FALSE
352372
return
353-
say("Uninstalling [RM] from \the [R].", class = "binaryradio")
354373
working_animation()
374+
say("Uninstalling \the [RM] from \the [R].", class = "binaryradio")
355375
playsound(src, 'sound/mecha/hydraulic.ogg', 40, 1)
356376
spawn(rand(4 SECONDS, 5 SECONDS) / apply_multiplier)
357377
playsound(src, 'sound/items/Welder.ogg', 60, 1)

0 commit comments

Comments
 (0)