From 6887e948522e3d2e24acba4fc275b21b1057deea Mon Sep 17 00:00:00 2001
From: Aranclanos
ZrL0jSZ(lrIudU$RUmzAE3
zP1L1M?R#q|Z>I>Kkp%I*S-o39iH$)@?Z9-=^>_| P
zPMZLv5@Kv70X%7OJyHMy3R8c0)$IQeoqt8n|EWxWCdHa^>>u1L1 P
zPMZLv5@Kv70X%7OJyHMy3R8c0)$IQeoqt8n|EWxWCdHa^>>u1L1 FBKUnq$4qPfVSQd@9m!_Ot2DYw68
"
dat += "Detach Container
"
dat += "Food
"
- dat += "10 milk (20)
"
- dat += "Slab of meat (50)
"
+ dat += "10 milk (20)
"
+ dat += "Slab of meat (50)
"
dat += "Nutrient
"
- dat += "E-Z-Nutrient (10) | x5
"
- dat += "Left 4 Zed (20) | x5
"
- dat += "Robust Harvest (25) | x5
"
+ dat += "E-Z-Nutrient (10) | x5
"
+ dat += "Left 4 Zed (20) | x5
"
+ dat += "Robust Harvest (25) | x5
"
dat += "Leather
"
- dat += "Wallet (100)
"
- dat += "Botanical gloves (250)
"
- dat += "Utility belt (300)
"
- dat += "Leather Satchel (400)
"
+ dat += "Wallet (100)
"
+ dat += "Botanical gloves (250)
"
+ dat += "Utility belt (300)
"
+ dat += "Leather Satchel (400)
"
//dat += "Other
"
- //dat += "Monkey (500)
"
+ //dat += "Monkey (500)
"
else
dat += "
No beaker inside. Please insert a beaker.
"
if("nopoints")
@@ -146,54 +146,74 @@
menustat = "void"
return
-/obj/machinery/biogenerator/proc/create_product(var/item,var/cost)
- if(cost > points)
+/obj/machinery/biogenerator/proc/check_cost(var/cost)
+ if (cost > points)
menustat = "nopoints"
+ return 1
+ else
+ points -= cost
+ processing = 1
+ update_icon()
+ updateUsrDialog()
+ sleep(30)
return 0
- processing = 1
- update_icon()
- updateUsrDialog()
- points -= cost
- sleep(30)
+
+/obj/machinery/biogenerator/proc/create_product(var/item)
switch(item)
if("milk")
- beaker.reagents.add_reagent("milk",10)
+ if (check_cost(20)) return 0
+ else beaker.reagents.add_reagent("milk",10)
if("meat")
- new/obj/item/weapon/reagent_containers/food/snacks/meat(src.loc)
+ if (check_cost(50)) return 0
+ else new/obj/item/weapon/reagent_containers/food/snacks/meat(src.loc)
if("ez")
- new/obj/item/nutrient/ez(src.loc)
+ if (check_cost(10)) return 0
+ else new/obj/item/nutrient/ez(src.loc)
if("l4z")
- new/obj/item/nutrient/l4z(src.loc)
+ if (check_cost(20)) return 0
+ else new/obj/item/nutrient/l4z(src.loc)
if("rh")
- new/obj/item/nutrient/rh(src.loc)
+ if (check_cost(25)) return 0
+ else new/obj/item/nutrient/rh(src.loc)
if("ez5") //It's not an elegant method, but it's safe and easy. -Cheridan
- new/obj/item/nutrient/ez(src.loc)
- new/obj/item/nutrient/ez(src.loc)
- new/obj/item/nutrient/ez(src.loc)
- new/obj/item/nutrient/ez(src.loc)
- new/obj/item/nutrient/ez(src.loc)
+ if (check_cost(50)) return 0
+ else
+ new/obj/item/nutrient/ez(src.loc)
+ new/obj/item/nutrient/ez(src.loc)
+ new/obj/item/nutrient/ez(src.loc)
+ new/obj/item/nutrient/ez(src.loc)
+ new/obj/item/nutrient/ez(src.loc)
if("l4z5")
- new/obj/item/nutrient/l4z(src.loc)
- new/obj/item/nutrient/l4z(src.loc)
- new/obj/item/nutrient/l4z(src.loc)
- new/obj/item/nutrient/l4z(src.loc)
- new/obj/item/nutrient/l4z(src.loc)
+ if (check_cost(100)) return 0
+ else
+ new/obj/item/nutrient/l4z(src.loc)
+ new/obj/item/nutrient/l4z(src.loc)
+ new/obj/item/nutrient/l4z(src.loc)
+ new/obj/item/nutrient/l4z(src.loc)
+ new/obj/item/nutrient/l4z(src.loc)
if("rh5")
- new/obj/item/nutrient/rh(src.loc)
- new/obj/item/nutrient/rh(src.loc)
- new/obj/item/nutrient/rh(src.loc)
- new/obj/item/nutrient/rh(src.loc)
- new/obj/item/nutrient/rh(src.loc)
+ if (check_cost(125)) return 0
+ else
+ new/obj/item/nutrient/rh(src.loc)
+ new/obj/item/nutrient/rh(src.loc)
+ new/obj/item/nutrient/rh(src.loc)
+ new/obj/item/nutrient/rh(src.loc)
+ new/obj/item/nutrient/rh(src.loc)
if("wallet")
- new/obj/item/weapon/storage/wallet(src.loc)
+ if (check_cost(100)) return 0
+ else new/obj/item/weapon/storage/wallet(src.loc)
if("gloves")
- new/obj/item/clothing/gloves/botanic_leather(src.loc)
+ if (check_cost(250)) return 0
+ else new/obj/item/clothing/gloves/botanic_leather(src.loc)
if("tbelt")
- new/obj/item/weapon/storage/belt/utility(src.loc)
+ if (check_cost(300)) return 0
+ else new/obj/item/weapon/storage/belt/utility(src.loc)
if("satchel")
- new/obj/item/weapon/storage/backpack/satchel(src.loc)
- if("monkey")
- new/mob/living/carbon/monkey(src.loc)
+ if (check_cost(400)) return 0
+ else new/obj/item/weapon/storage/backpack/satchel(src.loc)
+ //if("monkey")
+ // if (check_cost(500)) return 0
+ // else new/mob/living/carbon/monkey(src.loc)
processing = 0
menustat = "complete"
update_icon()
diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm
index 639ff1c485b..964ff592f45 100644
--- a/code/modules/reagents/Chemistry-Machinery.dm
+++ b/code/modules/reagents/Chemistry-Machinery.dm
@@ -276,6 +276,7 @@
if(href_list["amount"])
var/id = href_list["add"]
var/amount = text2num(href_list["amount"])
+ if (amount < 0) return
R.trans_id_to(src, id, amount)
else if (href_list["addcustom"])
@@ -290,6 +291,7 @@
if(href_list["amount"])
var/id = href_list["remove"]
var/amount = text2num(href_list["amount"])
+ if (amount < 0) return
if(mode)
reagents.trans_id_to(beaker, id, amount)
else
From 4fe39dd49bae2f57d7eb57879bef9324b558812b Mon Sep 17 00:00:00 2001
From: Incoming
\n[(A.locked ? "The Air Alarm is locked." : "The Air Alarm is unlocked.")]
\n[((A.shorted || (A.stat & (NOPOWER|BROKEN))) ? "The Air Alarm is offline." : "The Air Alarm is working properly!")]
\n[(A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")]")
+
+/datum/wires/alarm/UpdateCut(var/index, var/mended)
+ var/obj/machinery/alarm/A = holder
+ switch(index)
+ if(AALARM_WIRE_IDSCAN)
+ if(!mended)
+ A.locked = 1
+ //world << "Idscan wire cut"
+
+ if(AALARM_WIRE_POWER)
+ A.shock(usr, 50)
+ A.shorted = !mended
+ A.update_icon()
+ //world << "Power wire cut"
+
+ if (AALARM_WIRE_AI_CONTROL)
+ if (A.aidisabled == !mended)
+ A.aidisabled = mended
+ //world << "AI Control Wire Cut"
+
+ if(AALARM_WIRE_SYPHON)
+ if(!mended)
+ A.mode = 3 // AALARM_MODE_PANIC
+ A.apply_mode()
+ //world << "Syphon Wire Cut"
+
+ if(AALARM_WIRE_AALARM)
+ if (A.alarm_area.atmosalert(2))
+ A.post_alert(2)
+ A.update_icon()
+
+/datum/wires/alarm/UpdatePulsed(var/index)
+ var/obj/machinery/alarm/A = holder
+ switch(index)
+ if(AALARM_WIRE_IDSCAN)
+ A.locked = !A.locked
+ // world << "Idscan wire pulsed"
+
+ if (AALARM_WIRE_POWER)
+ // world << "Power wire pulsed"
+ if(A.shorted == 0)
+ A.shorted = 1
+ A.update_icon()
+
+ spawn(12000)
+ if(A.shorted == 1)
+ A.shorted = 0
+ A.update_icon()
+
+
+ if (AALARM_WIRE_AI_CONTROL)
+ // world << "AI Control wire pulsed"
+ if (A.aidisabled == 0)
+ A.aidisabled = 1
+ A.updateDialog()
+ spawn(100)
+ if (A.aidisabled == 1)
+ A.aidisabled = 0
+
+ if(AALARM_WIRE_SYPHON)
+ // world << "Syphon wire pulsed"
+ if(A.mode == 1) // AALARM_MODE_SCRUB
+ A.mode = 3 // AALARM_MODE_PANIC
+ else
+ A.mode = 1 // AALARM_MODE_SCRUB
+ A.apply_mode()
+
+ if(AALARM_WIRE_AALARM)
+ // world << "Aalarm wire pulsed"
+ if (A.alarm_area.atmosalert(0))
+ A.post_alert(0)
+ A.update_icon()
diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm
index dccfb930f63..eb25e49cfad 100644
--- a/code/game/machinery/alarm.dm
+++ b/code/game/machinery/alarm.dm
@@ -1,28 +1,4 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
-
-
-/proc/RandomAAlarmWires()
- //to make this not randomize the wires, just set index to 1 and increment it in the flag for loop (after doing everything else).
- var/list/AAlarmwires = list(0, 0, 0, 0, 0)
- AAlarmIndexToFlag = list(0, 0, 0, 0, 0)
- AAlarmIndexToWireColor = list(0, 0, 0, 0, 0)
- AAlarmWireColorToIndex = list(0, 0, 0, 0, 0)
- var/flagIndex = 1
- for (var/flag=1, flag<32, flag+=flag)
- var/valid = 0
- while (!valid)
- var/colorIndex = rand(1, 5)
- if (AAlarmwires[colorIndex]==0)
- valid = 1
- AAlarmwires[colorIndex] = flag
- AAlarmIndexToFlag[flagIndex] = flag
- AAlarmIndexToWireColor[flagIndex] = colorIndex
- AAlarmWireColorToIndex[colorIndex] = flagIndex
- flagIndex+=1
- return AAlarmwires
-
-
-
// A datum for dealing with threshold limit values
// used in /obj/machinery/alarm
/datum/tlv
@@ -51,6 +27,20 @@
max1 = other.max1
max2 = other.max2
+#define AALARM_MODE_SCRUBBING 1
+#define AALARM_MODE_VENTING 2 //makes draught
+#define AALARM_MODE_PANIC 3 //constantly sucks all air
+#define AALARM_MODE_REPLACEMENT 4 //sucks off all air, then refill and swithes to scrubbing
+#define AALARM_MODE_OFF 5
+
+#define AALARM_SCREEN_MAIN 1
+#define AALARM_SCREEN_VENT 2
+#define AALARM_SCREEN_SCRUB 3
+#define AALARM_SCREEN_MODE 4
+#define AALARM_SCREEN_SENSORS 5
+
+#define AALARM_REPORT_TIMEOUT 100
+
/obj/machinery/alarm
name = "alarm"
icon = 'icons/obj/monitors.dmi'
@@ -64,36 +54,19 @@
var/frequency = 1439
//var/skipprocess = 0 //Experimenting
var/alarm_frequency = 1437
-#define AALARM_REPORT_TIMEOUT 100
+
var/datum/radio_frequency/radio_connection
var/locked = 1
+ var/datum/wires/alarm/wires = null
var/wiresexposed = 0 // If it's been screwdrivered open.
var/aidisabled = 0
var/AAlarmwires = 31
var/shorted = 0
var/buildstage = 2 // 2 = complete, 1 = no wires, 0 = circuit gone
- // Uses code from apc.dm
-#define AALARM_WIRE_IDSCAN 1 //Added wires
-#define AALARM_WIRE_POWER 2
-#define AALARM_WIRE_SYPHON 3
-#define AALARM_WIRE_AI_CONTROL 4
-#define AALARM_WIRE_AALARM 5
-
-
-#define AALARM_MODE_SCRUBBING 1
-#define AALARM_MODE_VENTING 2 //makes draught
-#define AALARM_MODE_PANIC 3 //constantly sucks all air
-#define AALARM_MODE_REPLACEMENT 4 //sucks off all air, then refill and swithes to scrubbing
-#define AALARM_MODE_OFF 5
var/mode = AALARM_MODE_SCRUBBING
-#define AALARM_SCREEN_MAIN 1
-#define AALARM_SCREEN_VENT 2
-#define AALARM_SCREEN_SCRUB 3
-#define AALARM_SCREEN_MODE 4
-#define AALARM_SCREEN_SENSORS 5
var/screen = AALARM_SCREEN_MAIN
var/area_uid
var/area/alarm_area
@@ -145,6 +118,7 @@
/obj/machinery/alarm/New(nloc, ndir, nbuild)
..()
+ wires = new(src)
if(nloc)
loc = nloc
@@ -201,31 +175,6 @@
user << browse(null, "window=air_alarm")
return
- if(wiresexposed && (!istype(user, /mob/living/silicon)))
- var/t1 = text("Access Panel
\n")
- var/list/AAlarmwires = list(
- "Orange" = 1,
- "Dark red" = 2,
- "White" = 3,
- "Yellow" = 4,
- "Black" = 5,
- )
- for(var/wiredesc in AAlarmwires)
- var/is_uncut = src.AAlarmwires & AAlarmWireColorToFlag[AAlarmwires[wiredesc]]
- t1 += "[wiredesc] wire: "
- if(!is_uncut)
- t1 += "Mend"
-
- else
- t1 += "Cut "
- t1 += "Pulse "
-
- t1 += "
"
- t1 += text("
\n[(src.locked ? "The Air Alarm is locked." : "The Air Alarm is unlocked.")]
\n[((src.shorted || (stat & (NOPOWER|BROKEN))) ? "The Air Alarm is offline." : "The Air Alarm is working properly!")]
\n[(src.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")]")
- t1 += text("")
- user << browse(t1, "window=AAlarmwires")
- onclose(user, "AAlarmwires")
-
if(!shorted)
//user << browse(return_text(),"window=air_alarm")
//onclose(user, "air_alarm")
@@ -235,135 +184,11 @@
popup.open()
refresh_all()
- return
-
-
-/obj/machinery/alarm/proc/isWireColorCut(var/wireColor)
- var/wireFlag = AAlarmWireColorToFlag[wireColor]
- return ((src.AAlarmwires & wireFlag) == 0)
-
-/obj/machinery/alarm/proc/isWireCut(var/wireIndex)
- var/wireFlag = AAlarmIndexToFlag[wireIndex]
- return ((src.AAlarmwires & wireFlag) == 0)
-
-/obj/machinery/alarm/proc/cut(var/wireColor)
- var/wireFlag = AAlarmWireColorToFlag[wireColor]
- var/wireIndex = AAlarmWireColorToIndex[wireColor]
- AAlarmwires &= ~wireFlag
- switch(wireIndex)
- if(AALARM_WIRE_IDSCAN)
- src.locked = 1
- //world << "Idscan wire cut"
-
- if(AALARM_WIRE_POWER)
- src.shock(usr, 50)
- src.shorted = 1
- update_icon()
- //world << "Power wire cut"
-
- if (AALARM_WIRE_AI_CONTROL)
- if (src.aidisabled == 0)
- src.aidisabled = 1
- //world << "AI Control Wire Cut"
-
- if(AALARM_WIRE_SYPHON)
- mode = AALARM_MODE_PANIC
- apply_mode()
- //world << "Syphon Wire Cut"
-
- if(AALARM_WIRE_AALARM)
-
- if (alarm_area.atmosalert(2))
- post_alert(2)
- spawn(1)
- src.updateUsrDialog()
- update_icon()
-
- //world << "AAlarm Wire Cut"
-
- src.updateDialog()
- update_icon()
+ if(wiresexposed && (!istype(user, /mob/living/silicon)))
+ wires.Interact(user)
return
-/obj/machinery/alarm/proc/mend(var/wireColor)
- var/wireFlag = AAlarmWireColorToFlag[wireColor]
- var/wireIndex = AAlarmWireColorToIndex[wireColor] //not used in this function
- AAlarmwires |= wireFlag
- switch(wireIndex)
- if(AALARM_WIRE_IDSCAN)
- //world << "Idscan wire mended"
-
- if(AALARM_WIRE_POWER)
- src.shorted = 0
- src.shock(usr, 50)
- update_icon()
- //world << "Power wire mended"
-
- if(AALARM_WIRE_AI_CONTROL)
- if (src.aidisabled == 1)
- src.aidisabled = 0
- //world << "AI Cont. wire mended"
-
-
- // if(AALARM_WIRE_SYPHON)
- // world << "Syphon Wire mended"
-
-
- // if(AALARM_WIRE_AALARM)
- //world << "AAlarm Wire mended"
-
- update_icon()
- src.updateDialog()
- return
-
-/obj/machinery/alarm/proc/pulse(var/wireColor)
- //var/wireFlag = AAlarmWireColorToFlag[wireColor] //not used in this function
- var/wireIndex = AAlarmWireColorToIndex[wireColor]
- switch(wireIndex)
- if(AALARM_WIRE_IDSCAN) //unlocks for 30 seconds, if you have a better way to hack I'm all ears
- src.locked = 0
- spawn(300)
- src.locked = 1
- //world << "Idscan wire pulsed"
-
- if (AALARM_WIRE_POWER)
- // world << "Power wire pulsed"
- if(shorted == 0)
- shorted = 1
- update_icon()
-
- spawn(1200)
- if(shorted == 1)
- shorted = 0
- update_icon()
-
-
- if (AALARM_WIRE_AI_CONTROL)
- // world << "AI Control wire pulsed"
- if (src.aidisabled == 0)
- src.aidisabled = 1
- src.updateDialog()
- spawn(10)
- if (src.aidisabled == 1)
- src.aidisabled = 0
- src.updateDialog()
-
- if(AALARM_WIRE_SYPHON)
- // world << "Syphon wire pulsed"
- mode = AALARM_MODE_REPLACEMENT
- apply_mode()
-
- if(AALARM_WIRE_AALARM)
- // world << "Aalarm wire pulsed"
- if (alarm_area.atmosalert(0))
- post_alert(0)
- spawn(1)
- src.updateUsrDialog()
- update_icon()
-
- src.updateDialog()
- return
/obj/machinery/alarm/proc/shock(mob/user, prb)
if((stat & (NOPOWER))) // unpowered, no shock
@@ -702,33 +527,8 @@ table tr:first-child th:first-child { border: none;}
if (!istype(usr, /mob/living/silicon))
usr.unset_machine()
usr << browse(null, "window=air_alarm")
- usr << browse(null, "window=AAlarmwires")
return
- if (href_list["AAlarmwires"])
- var/t1 = text2num(href_list["AAlarmwires"])
- if (!( istype(usr.get_active_hand(), /obj/item/weapon/wirecutters) ))
- usr << "You need wirecutters!"
- return
- if (src.isWireColorCut(t1))
- src.mend(t1)
- else
- src.cut(t1)
- spawn(1)
- src.updateUsrDialog()
- else if (href_list["pulse"])
- var/t1 = text2num(href_list["pulse"])
- if (!istype(usr.get_active_hand(), /obj/item/device/multitool))
- usr << "You need a multitool!"
- return
- if (src.isWireColorCut(t1))
- usr << "You can't pulse a cut wire."
- return
- else
- src.pulse(t1)
- spawn(1)
- src.updateUsrDialog()
-
if(href_list["command"])
@@ -988,7 +788,7 @@ table tr:first-child th:first-child { border: none;}
if(stat & (NOPOWER|BROKEN))
user << "It does nothing"
else
- if(src.allowed(usr) && !isWireCut(AALARM_WIRE_IDSCAN))
+ if(src.allowed(usr) && !wires.IsIndexCut(AALARM_WIRE_IDSCAN))
locked = !locked
user << "\blue You [ locked ? "lock" : "unlock"] the Air Alarm interface."
src.updateUsrDialog()
diff --git a/code/global.dm b/code/global.dm
index 0b5af7d9149..e75a8d4e468 100644
--- a/code/global.dm
+++ b/code/global.dm
@@ -134,15 +134,6 @@ var/shuttlecoming = 0
var/join_motd = null
var/forceblob = 0
- //airlockWireColorToIndex takes a number representing the wire color, e.g. the orange wire is always 1, the dark red wire is always 2, etc. It returns the index for whatever that wire does.
- //airlockIndexToWireColor does the opposite thing - it takes the index for what the wire does, for example AIRLOCK_WIRE_IDSCAN is 1, AIRLOCK_WIRE_POWER1 is 2, etc. It returns the wire color number.
- //airlockWireColorToFlag takes the wire color number and returns the flag for it (1, 2, 4, 8, 16, etc)
-
-var/list/AAlarmWireColorToFlag = RandomAAlarmWires()
-var/list/AAlarmIndexToFlag
-var/list/AAlarmIndexToWireColor
-var/list/AAlarmWireColorToIndex
-
//This was a define, but I changed it to a variable so it can be changed in-game.(kept the all-caps definition because... code...) -Errorage
var/MAX_EX_DEVESTATION_RANGE = 3
var/MAX_EX_HEAVY_RANGE = 7
diff --git a/tgstation.dme b/tgstation.dme
index 826d69ff1fd..d7aa93be9ca 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -152,6 +152,7 @@
#include "code\datums\spells\turf_teleport.dm"
#include "code\datums\spells\wizard.dm"
#include "code\datums\wires\airlock.dm"
+#include "code\datums\wires\alarm.dm"
#include "code\datums\wires\apc.dm"
#include "code\datums\wires\camera.dm"
#include "code\datums\wires\explosive.dm"
From b2906e121698d43af4c2a7d6698957c23844be9c Mon Sep 17 00:00:00 2001
From: KazeEspada 6Rtd7SVs$FO?X5eixy_(1?nOyustD3l|
zbcb5T{U^Ig{FB`b2M33npVU*Vt&Nq9QS2_^-ZPksv-K)tr;ZBwyL@td0B$c4BJ+>9
z?kCROh5B%d(GxX8Q;+A!&>#5J-OWiKmIf4_w#w`G?o&98Pr~@v5K^zWhq1fL`8~=h
zhVp^@A+_^dHg1RAAnq`=GE0~!+;^x`OC%Y5N)9bm$y890u+Zm~fWRSm)l!2WK%V9*
zvGG@r(mxY83Qzx14OJuGMzRAvfm^G;xXWqe%IY`Ngeh#nV)lMfR$*icQSlaXXgC!X
zAh5v}B>foqx?p=iRxkZY>odg~_-`bKh3-D75BN7?==>W_;~iOJ<}K39XvjN8C0lo)
z)Ov#4EZ!)zQ5qV@pe}vyJFETCT-
"
+ dat += "
"
+ dat += "Install Module:
"
+ dat += "The number afterwards is the amount of processing time it consumes.
"
+ for(var/datum/AI_Module/large/module in src.possible_modules)
+ dat += "[module.module_name] ([module.cost])
"
+ for(var/datum/AI_Module/small/module in src.possible_modules)
+ dat += "[module.module_name] ([module.cost])
"
+ dat += "
"
if (src.temp)
- dat = "[src.temp]
Clear"
- else if(src.processing_time <= 0)
- dat = " No processing time is left available. No more modules are able to be chosen at this time."
- else
- dat = "Select use of processing time: (currently [src.processing_time] left.)
"
- dat += "
"
- dat += "Install Module:
"
- dat += "The number afterwards is the amount of processing time it consumes.
"
- for(var/datum/AI_Module/large/module in src.possible_modules)
- dat += "[module.module_name] (50)
"
- for(var/datum/AI_Module/small/module in src.possible_modules)
- dat += "[module.module_name] (15)
"
- dat += "
"
-
- user << browse(dat, "window=modpicker")
- onclose(user, "modpicker")
+ dat += "[src.temp]"
+ var/datum/browser/popup = new(user, "modpicker", "Malf Module Menu")
+ popup.set_content(dat)
+ popup.open()
return
-/datum/AI_Module/module_picker/Topic(href, href_list)
+/datum/module_picker/Topic(href, href_list)
..()
- if (href_list["coreup"])
- var/already
- for (var/datum/AI_Module/mod in usr:current_modules)
- if(istype(mod, /datum/AI_Module/large/fireproof_core))
- already = 1
- if (!already)
- usr.verbs += /client/proc/fireproof_core
- usr:current_modules += new /datum/AI_Module/large/fireproof_core
- src.temp = "An upgrade to improve core resistance, making it immune to fire and heat. This effect is permanent."
- src.processing_time -= 50
- else src.temp = "This module is only needed once."
- else if (href_list["turret"])
- var/already
- for (var/datum/AI_Module/mod in usr:current_modules)
- if(istype(mod, /datum/AI_Module/large/upgrade_turrets))
- already = 1
- if (!already)
- usr.verbs += /client/proc/upgrade_turrets
- usr:current_modules += new /datum/AI_Module/large/upgrade_turrets
- src.temp = "Improves the firing speed and health of all AI turrets. This effect is permanent."
- src.processing_time -= 50
- else src.temp = "This module is only needed once."
+ if(!isAI(usr))
+ return
+ var/mob/living/silicon/ai/A = usr
- else if (href_list["rcd"])
- var/already
- for (var/datum/AI_Module/mod in usr:current_modules)
- if(istype(mod, /datum/AI_Module/large/disable_rcd))
- mod:uses += 1
- already = 1
- if (!already)
- usr:current_modules += new /datum/AI_Module/large/disable_rcd
- usr.verbs += /client/proc/disable_rcd
- src.temp = "Send a specialised pulse to break all RCD devices on the station."
- else src.temp = "Additional use added to RCD disabler."
- src.processing_time -= 50
+ for(var/datum/AI_Module/AM in possible_modules)
+ if (href_list[AM.mod_pick_name])
- else if (href_list["overload"])
- var/already
- for (var/datum/AI_Module/mod in usr:current_modules)
- if(istype(mod, /datum/AI_Module/small/overload_machine))
- mod:uses += 2
- already = 1
- if (!already)
- usr.verbs += /client/proc/overload_machine
- usr:current_modules += new /datum/AI_Module/small/overload_machine
- src.temp = "Overloads an electrical machine, causing a small explosion. 2 uses."
- else src.temp = "Two additional uses added to Overload module."
- src.processing_time -= 15
+ // Cost check
+ if(AM.cost > src.processing_time)
+ temp = "You cannot afford this module."
+ break
- else if (href_list["blackout"])
- var/already
- for (var/datum/AI_Module/mod in usr:current_modules)
- if(istype(mod, /datum/AI_Module/small/blackout))
- mod:uses += 3
- already = 1
- if (!already)
- usr.verbs += /client/proc/blackout
- src.temp = "Attempts to overload the lighting circuits on the station, destroying some bulbs. 3 uses."
- usr:current_modules += new /datum/AI_Module/small/blackout
- else src.temp = "Three additional uses added to Blackout module."
- src.processing_time -= 15
+ // Add new uses if we can, and it is allowed.
+ var/datum/AI_Module/already_AM = locate(AM.type) in A.current_modules
+ if(already_AM)
+ if(!AM.one_time)
+ already_AM.uses += AM.uses
+ src.processing_time -= AM.cost
+ temp = "Additional use added to [already_AM.module_name]"
+ break
+ else
+ temp = "This module is only needed once."
+ break
- else if (href_list["interhack"])
- var/already
- for (var/datum/AI_Module/mod in usr:current_modules)
- if(istype(mod, /datum/AI_Module/small/interhack))
- already = 1
- if (!already)
- usr.verbs += /client/proc/interhack
- src.temp = "Hacks the status upgrade from Cent. Com, removing any information about malfunctioning electrical systems."
- usr:current_modules += new /datum/AI_Module/small/interhack
- src.processing_time -= 15
- else src.temp = "This module is only needed once."
+ // Give the power and take away the money.
+ A.verbs += AM.power_type
+ A.current_modules += new AM.type
+ temp = AM.description
+ src.processing_time -= AM.cost
- else if (href_list["recam"])
- var/already
- for (var/datum/AI_Module/mod in usr:current_modules)
- if(istype(mod, /datum/AI_Module/small/reactivate_camera))
- mod:uses += 10
- already = 1
- if (!already)
- usr.verbs += /client/proc/reactivate_camera
- src.temp = "Reactivates a currently disabled camera. 10 uses."
- usr:current_modules += new /datum/AI_Module/small/reactivate_camera
- else src.temp = "Ten additional uses added to ReCam module."
- src.processing_time -= 15
-
- else if(href_list["upgradecam"])
- var/already
- for (var/datum/AI_Module/mod in usr:current_modules)
- if(istype(mod, /datum/AI_Module/small/upgrade_camera))
- mod:uses += 10
- already = 1
- if (!already)
- usr.verbs += /client/proc/upgrade_camera
- src.temp = "Upgrades a camera to have X-Ray vision, Motion and be EMP-Proof. 10 uses."
- usr:current_modules += new /datum/AI_Module/small/upgrade_camera
- else src.temp = "Ten additional uses added to ReCam module."
- src.processing_time -= 15
-
- else
- if (href_list["temp"])
- src.temp = null
src.use(usr)
return
diff --git a/code/game/gamemodes/malfunction/malfunction.dm b/code/game/gamemodes/malfunction/malfunction.dm
index 3a19021f250..31cf3537816 100644
--- a/code/game/gamemodes/malfunction/malfunction.dm
+++ b/code/game/gamemodes/malfunction/malfunction.dm
@@ -4,9 +4,9 @@
/datum/game_mode/malfunction
name = "AI malfunction"
config_tag = "malfunction"
- required_players = 20
- required_enemies = 1
- recommended_enemies = 1
+ required_players = 0//20
+ required_enemies = 0//1
+ recommended_enemies = 0//1
uplink_welcome = "Crazy AI Uplink Console:"
uplink_uses = 10
@@ -52,7 +52,7 @@
return
AI_mind.current.verbs += /mob/living/silicon/ai/proc/choose_modules
AI_mind.current:laws = new /datum/ai_laws/malfunction
- AI_mind.current:malf_picker = new /datum/AI_Module/module_picker
+ AI_mind.current:malf_picker = new /datum/module_picker
AI_mind.current:show_laws()
greet_malf(AI_mind)
diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm
index a067319596e..eb051aca74a 100644
--- a/code/modules/mob/living/silicon/ai/ai.dm
+++ b/code/modules/mob/living/silicon/ai/ai.dm
@@ -31,7 +31,7 @@ var/list/ai_list = list()
var/obj/item/device/multitool/aiMulti = null
//MALFUNCTION
- var/datum/AI_Module/module_picker/malf_picker
+ var/datum/module_picker/malf_picker
var/processing_time = 100
var/list/datum/AI_Module/current_modules = list()
var/fire_res_on_core = 0
@@ -48,6 +48,7 @@ var/list/ai_list = list()
var/datum/trackable/track = null
var/last_paper_seen = null
+ var/can_shunt = 1
/mob/living/silicon/ai/New(loc, var/datum/ai_laws/L, var/obj/item/device/mmi/B, var/safety = 0)
var/list/possibleNames = ai_names
diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm
index da28c138593..f4968a9d6c6 100644
--- a/code/modules/power/apc.dm
+++ b/code/modules/power/apc.dm
@@ -796,6 +796,9 @@
if(istype(malf.loc, /obj/machinery/power/apc)) // Already in an APC
malf << "You must evacuate your current apc first."
return
+ if(!malf.can_shunt)
+ malf << "You cannot shunt."
+ return
if(src.z != 1)
return
src.occupant = new /mob/living/silicon/ai(src,malf.laws,null,1)
From 67123b19bb35b2f239234540c5cfc96a65688f90 Mon Sep 17 00:00:00 2001
From: Giacomand 12 July 2013
+ Giacom updated:
+
+
+7 July 2013
Giacom updated:
From edfd879efdb85057efa291813308b88f588b717d Mon Sep 17 00:00:00 2001
From: Giacomand z}-v
z^f0dUBYeJNio
z5~3W_jh?7Y(l4OzEr?u2fF+
z2gIv>na-|i?HG~e2#f}{XE>7q_TK%sK5=zfUwpxno(EYlTodKY$^Gt)n~K`
12 July 2013
- Giacom updated:
-
-
-7 July 2013
Giacom updated:
From 9caa5905fecc3da72ea17f21342af16b77d9cba9 Mon Sep 17 00:00:00 2001
From: Giacomand