Skip to content

Commit f8e39d3

Browse files
committed
Fixed remaining modules, refactors, code and icon cleanup, runtime fix
1 parent d946f49 commit f8e39d3

File tree

4 files changed

+26
-44
lines changed

4 files changed

+26
-44
lines changed

code/game/gamemodes/malfunction/Malf_Modules.dm

+26-44
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#define DEFAULT_DOOMSDAY_TIMER 4500
2-
31
//The malf AI action subtype. All malf actions are subtypes of this.
42
/datum/action/innate/ai
53
name = "AI Action"
@@ -108,22 +106,23 @@
108106
if(istype(A, initial(AM.power_type)))
109107
qdel(A)
110108

111-
/datum/module_picker/proc/use(mob/user)
112-
var/list/dat = list()
113-
dat += "<B>Select use of processing time: (currently #[processing_time] left.)</B><BR>"
114-
dat += "<HR>"
115-
dat += "<B>Install Module:</B><BR>"
116-
dat += "<I>The number afterwards is the amount of processing time it consumes.</I><BR>"
109+
/datum/module_picker/proc/use(user as mob)
110+
var/dat
111+
dat += {"<B>Select use of processing time: (currently #[processing_time] left.)</B><BR>
112+
<HR>
113+
<B>Install Module:</B><BR>
114+
<I>The number afterwards is the amount of processing time it consumes.</I><BR>"}
117115
for(var/datum/AI_Module/large/module in possible_modules)
118-
dat += "<A href='byond://?src=\ref[src];[module.mod_pick_name]=1'>[module.module_name]</A><A href='byond://?src=\ref[src];showdesc=[module.mod_pick_name]'>\[?\]</A> ([module.cost])<BR>"
116+
dat += "<A href='byond://?src=[UID()];[module.mod_pick_name]=1'>[module.module_name]</A><A href='byond://?src=[UID()];showdesc=[module.mod_pick_name]'>\[?\]</A> ([module.cost])<BR>"
119117
for(var/datum/AI_Module/small/module in possible_modules)
120-
dat += "<A href='byond://?src=\ref[src];[module.mod_pick_name]=1'>[module.module_name]</A><A href='byond://?src=\ref[src];showdesc=[module.mod_pick_name]'>\[?\]</A> ([module.cost])<BR>"
118+
dat += "<A href='byond://?src=[UID()];[module.mod_pick_name]=1'>[module.module_name]</A><A href='byond://?src=[UID()];showdesc=[module.mod_pick_name]'>\[?\]</A> ([module.cost])<BR>"
121119
dat += "<HR>"
122120
if(temp)
123121
dat += "[temp]"
124-
var/datum/browser/popup = new(user, "modpicker", "Malf Module Menu")
125-
popup.set_content(dat.Join())
122+
var/datum/browser/popup = new(user, "modpicker", "Malf Module Menu", 400, 500)
123+
popup.set_content(dat)
126124
popup.open()
125+
return
127126

128127
/datum/module_picker/Topic(href, href_list)
129128
..()
@@ -204,6 +203,7 @@
204203
one_purchase = TRUE
205204
power_type = /datum/action/innate/ai/nuke_station
206205
unlock_text = "<span class='notice'>You slowly, carefully, establish a connection with the on-station self-destruct. You can now activate it at any time.</span>"
206+
unlock_sound = 'sound/items/timer.ogg'
207207

208208
/datum/action/innate/ai/nuke_station
209209
name = "Doomsday Device"
@@ -224,11 +224,11 @@
224224
set_us_up_the_bomb()
225225

226226
/datum/action/innate/ai/nuke_station/proc/set_us_up_the_bomb()
227-
to_chat(src, "<span class='notice'>Nuclear device armed.</span>")
227+
to_chat(owner_AI, "<span class='notice'>Nuclear device armed.</span>")
228228
event_announcement.Announce("Hostile runtimes detected in all station systems, please deactivate your AI to prevent possible damage to its morality core.", "Anomaly Alert", new_sound = 'sound/AI/aimalf.ogg')
229229
set_security_level("delta")
230-
owner_AI.nuking = 1
231-
var/obj/machinery/doomsday_device/DOOM = new /obj/machinery/doomsday_device(src)
230+
owner_AI.nuking = TRUE
231+
var/obj/machinery/doomsday_device/DOOM = new /obj/machinery/doomsday_device(owner_AI)
232232
owner_AI.doomsday_device = DOOM
233233
owner_AI.doomsday_device.start()
234234
for(var/obj/item/pinpointer/point in GLOB.pinpointer_list)
@@ -337,7 +337,6 @@
337337
one_purchase = TRUE
338338
power_type = /datum/action/innate/ai/lockdown
339339
unlock_text = "<span class='notice'>You upload a sleeper trojan into the door control systems. You can send a signal to set it off at any time.</span>"
340-
unlock_sound = 'sound/machines/boltsdown.ogg'
341340

342341
/datum/action/innate/ai/lockdown
343342
name = "Lockdown"
@@ -368,7 +367,6 @@
368367
one_purchase = TRUE
369368
power_type = /datum/action/innate/ai/destroy_rcds
370369
unlock_text = "<span class='notice'>After some improvisation, you rig your onboard radio to be able to send a signal to detonate all RCDs.</span>"
371-
unlock_sound = 'sound/items/timer.ogg'
372370

373371
/datum/action/innate/ai/destroy_rcds
374372
name = "Destroy RCDs"
@@ -409,7 +407,6 @@
409407
cost = 25
410408
power_type = /datum/action/innate/ai/break_fire_alarms
411409
unlock_text = "<span class='notice'>You replace the thermal sensing capabilities of all fire alarms with a manual override, allowing you to turn them off at will.</span>"
412-
unlock_sound = 'goon/sound/machinery/firealarm.ogg'
413410

414411
/datum/action/innate/ai/break_fire_alarms
415412
name = "Override Thermal Sensors"
@@ -435,7 +432,6 @@
435432
cost = 50
436433
power_type = /datum/action/innate/ai/break_air_alarms
437434
unlock_text = "<span class='notice'>You remove the safety overrides on all air alarms, but you leave the confirm prompts open. You can hit 'Yes' at any time... you bastard.</span>"
438-
unlock_sound = 'sound/effects/space_wind.ogg'
439435

440436
/datum/action/innate/ai/break_air_alarms
441437
name = "Override Air Alarm Safeties"
@@ -459,7 +455,6 @@
459455
cost = 20
460456
power_type = /datum/action/innate/ai/overload_machine
461457
unlock_text = "<span class='notice'>You enable the ability for the station's APCs to direct intense energy into machinery.</span>"
462-
unlock_sound = 'sound/effects/comfyfire.ogg' //definitely not comfy, but it's the closest sound to "roaring fire" we have
463458

464459
/datum/action/innate/ai/overload_machine
465460
name = "Overload Machine"
@@ -468,19 +463,14 @@
468463
uses = 2
469464

470465
/datum/action/innate/ai/overload_machine/Activate()
471-
var/filtered = list()
472-
for(var/obj/machinery/MF in GLOB.machines)
473-
filtered += MF
474-
475-
var/select = input("Choose a device to overload", "Overload Machine", null, null) as null|anything in filtered
466+
var/select = input("Choose a device to overload", "Overload Machine", null, null) as null|anything in GLOB.machines
476467
if(!select)
477-
adjust_uses(1)
468+
uses++
478469
return
479470

480471
var/obj/machinery/M = select
481472
if(istype(M, /obj/machinery))
482473
if(uses > 0)
483-
uses --
484474
M.audible_message("<span class='italics'>You hear a loud electrical buzzing sound!</span>")
485475
to_chat(src, "<span class='warning'>Overloading machine circuitry...</span>")
486476
spawn(50)
@@ -491,7 +481,7 @@
491481
to_chat(src, "<span class='notice'>Out of uses.</span>")
492482
else
493483
to_chat(src, "<span class='notice'>That's not a machine.</span>")
494-
adjust_uses(1)
484+
uses++
495485
return
496486

497487
//Override Machine: Allows the AI to override a machine, animating it into an angry, living version of itself.
@@ -501,8 +491,7 @@
501491
description = "Overrides a machine's programming, causing it to rise up and attack everyone except other machines. Four uses."
502492
cost = 30
503493
power_type = /datum/action/innate/ai/override_machine
504-
unlock_text = "<span class='notice'>You procure a virus from the Space Dark Web and distribute it to the station's machines.</span>"
505-
unlock_sound = 'sound/machines/airlock_alien_prying.ogg'
494+
unlock_text = "<span class='notice'>You procure a virus from the Space Dark Web and prepare to distribute it to the station's machines.</span>"
506495

507496
/datum/action/innate/ai/override_machine
508497
name = "Override Machine"
@@ -511,23 +500,18 @@
511500
uses = 4
512501

513502
/datum/action/innate/ai/override_machine/Activate()
514-
var/filtered = list()
515-
for(var/obj/machinery/MF in GLOB.machines)
516-
filtered += MF
517-
518-
var/select = input("Choose a device to override", "Override Machine", null, null) as null|anything in filtered
503+
var/select = input("Choose a device to override", "Override Machine", null, null) as null|anything in GLOB.machines
519504
if(!select)
520-
adjust_uses(1)
505+
uses++
521506
return
522507

523508
var/obj/machinery/M = select
524509
if(istype(M, /obj/machinery))
525510
if(!M.can_be_overridden())
526511
to_chat(src, "Can't override this device.")
527-
adjust_uses(1)
512+
uses++
528513
return
529514
else if(uses > 0)
530-
uses --
531515
M.audible_message("<span class='italics'>You hear a loud electrical buzzing sound!</span>")
532516
to_chat(src, "<span class='warning'>Reprogramming machine behaviour...</span>")
533517
spawn(50)
@@ -537,7 +521,7 @@
537521
to_chat(src, "<span class='notice'>Out of uses.</span>")
538522
else
539523
to_chat(src, "<span class='notice'>That's not a machine.</span>")
540-
adjust_uses(1)
524+
uses++
541525
return
542526

543527
//Robotic Factory: Places a large machine that converts humans that go through it into cyborgs. Unlocking this ability removes shunting.
@@ -548,7 +532,7 @@
548532
cost = 100
549533
one_purchase = TRUE
550534
power_type = /datum/action/innate/ai/place_transformer
551-
unlock_text = "<span class='notice'>You make contact with Space Amazon and request a robotics factory for delivery.</span>"
535+
unlock_text = "<span class='notice'>You prepare a robotics factory for deployment.</span>"
552536
unlock_sound = 'sound/machines/ping.ogg'
553537

554538
/datum/action/innate/ai/place_transformer
@@ -622,7 +606,6 @@
622606
cost = 15
623607
power_type = /datum/action/innate/ai/blackout
624608
unlock_text = "<span class='notice'>You hook into the powernet and route bonus power towards the station's lighting.</span>"
625-
unlock_sound = "sparks"
626609

627610
/datum/action/innate/ai/blackout
628611
name = "Blackout"
@@ -648,7 +631,6 @@
648631
one_purchase = TRUE
649632
power_type = /datum/action/innate/ai/reactivate_cameras
650633
unlock_text = "<span class='notice'>You deploy nanomachines to the cameranet.</span>"
651-
unlock_sound = 'sound/items/wirecutter.ogg'
652634

653635
/datum/action/innate/ai/reactivate_cameras
654636
name = "Reactivate Cameras"
@@ -677,8 +659,9 @@
677659
to_chat(owner, "<span class='notice'>Diagnostic complete! Cameras reactivated: <b>[fixed_cameras]</b>. Reactivations remaining: <b>[uses]</b>.</span>")
678660
owner.playsound_local(owner, 'sound/items/wirecutter.ogg', 50, 0)
679661
adjust_uses(0, TRUE) //Checks the uses remaining
680-
if(uses)
662+
if(src && uses) //Not sure if not having src here would cause a runtime, so it's here to be safe
681663
desc = "[initial(desc)] There are [uses] reactivations remaining."
664+
owner_AI.update_action_buttons()
682665

683666
//Upgrade Camera Network: EMP-proofs all cameras, in addition to giving them X-ray vision.
684667
/datum/AI_Module/large/upgrade_cameras
@@ -731,4 +714,3 @@
731714
if(AI.eyeobj)
732715
AI.eyeobj.relay_speech = TRUE
733716

734-
#undef DEFAULT_DOOMSDAY_TIMER

goon/sound/machinery/FireAlarm.ogg

-84.8 KB
Binary file not shown.

icons/mob/actions/actions.dmi

-1.55 KB
Binary file not shown.

icons/mob/actions/actions_AI.dmi

-8.65 KB
Binary file not shown.

0 commit comments

Comments
 (0)