Merge remote-tracking branch 'origin/master' into modular_computers

This commit is contained in:
davipatury
2017-03-04 15:44:20 -03:00
323 changed files with 13245 additions and 7898 deletions
+2 -2
View File
@@ -187,7 +187,7 @@
/datum/action/item_action/toggle_hardsuit_mode
name = "Toggle Hardsuit Mode"
/datum/action/item_action/toggle_unfriendly_fire
name = "Toggle Friendly Fire \[ON\]"
desc = "Toggles if the staff causes friendly fire."
@@ -357,7 +357,7 @@
..()
name = "Toggle [target.name]"
button.name = name
/datum/action/item_action/organ_action/use/New(Target)
..()
name = "Use [target.name]"
+228 -13
View File
@@ -1,16 +1,231 @@
/hook/startup/proc/createDatacore()
data_core = new /obj/effect/datacore()
data_core = new /datum/datacore()
return 1
/obj/effect/datacore/proc/manifest(var/nosleep = 0)
spawn()
if(!nosleep)
sleep(40)
for(var/mob/living/carbon/human/H in player_list)
manifest_inject(H)
return
/datum/datacore
var/list/medical = list()
var/list/general = list()
var/list/security = list()
//This list tracks characters spawned in the world and cannot be modified in-game. Currently referenced by respawn_character().
var/list/locked = list()
/obj/effect/datacore/proc/manifest_modify(var/name, var/assignment)
/datum/datacore/proc/get_manifest(monochrome, OOC)
var/list/heads = new()
var/list/sec = new()
var/list/eng = new()
var/list/med = new()
var/list/sci = new()
var/list/ser = new()
var/list/sup = new()
var/list/bot = new()
var/list/misc = new()
var/list/isactive = new()
var/dat = {"
<head><style>
.manifest {border-collapse:collapse;}
.manifest td, th {border:1px solid [monochrome?"black":"#DEF; background-color:white; color:black"]; padding:.25em}
.manifest th {height: 2em; [monochrome?"border-top-width: 3px":"background-color: #48C; color:white"]}
.manifest tr.head th { [monochrome?"border-top-width: 1px":"background-color: #488;"] }
.manifest td:first-child {text-align:right}
.manifest tr.alt td {[monochrome?"border-top-width: 2px":"background-color: #DEF"]}
</style></head>
<table class="manifest" width='350px'>
<tr class='head'><th>Name</th><th>Rank</th><th>Activity</th></tr>
"}
var/even = 0
// sort mobs
for(var/datum/data/record/t in data_core.general)
var/name = t.fields["name"]
var/rank = t.fields["rank"]
var/real_rank = t.fields["real_rank"]
if(OOC)
var/active = 0
for(var/mob/M in player_list)
if(M.real_name == name && M.client && M.client.inactivity <= 10 * 60 * 10)
active = 1
break
isactive[name] = active ? "Active" : "Inactive"
else
isactive[name] = t.fields["p_stat"]
var/department = 0
if(real_rank in command_positions)
heads[name] = rank
department = 1
if(real_rank in security_positions)
sec[name] = rank
department = 1
if(real_rank in engineering_positions)
eng[name] = rank
department = 1
if(real_rank in medical_positions)
med[name] = rank
department = 1
if(real_rank in science_positions)
sci[name] = rank
department = 1
if(real_rank in service_positions)
ser[name] = rank
department = 1
if(real_rank in supply_positions)
sup[name] = rank
department = 1
if(real_rank in nonhuman_positions)
bot[name] = rank
department = 1
if(!department && !(name in heads))
misc[name] = rank
if(heads.len > 0)
dat += "<tr><th colspan=3>Heads</th></tr>"
for(var/name in heads)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[heads[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(sec.len > 0)
dat += "<tr><th colspan=3>Security</th></tr>"
for(var/name in sec)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[sec[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(eng.len > 0)
dat += "<tr><th colspan=3>Engineering</th></tr>"
for(var/name in eng)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[eng[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(med.len > 0)
dat += "<tr><th colspan=3>Medical</th></tr>"
for(var/name in med)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[med[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(sci.len > 0)
dat += "<tr><th colspan=3>Science</th></tr>"
for(var/name in sci)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[sci[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(ser.len > 0)
dat += "<tr><th colspan=3>Service</th></tr>"
for(var/name in ser)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[ser[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(sup.len > 0)
dat += "<tr><th colspan=3>Supply</th></tr>"
for(var/name in sup)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[sup[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(bot.len > 0)
dat += "<tr><th colspan=3>Silicon</th></tr>"
for(var/name in bot)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[bot[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
if(misc.len > 0)
dat += "<tr><th colspan=3>Miscellaneous</th></tr>"
for(var/name in misc)
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[misc[name]]</td><td>[isactive[name]]</td></tr>"
even = !even
dat += "</table>"
dat = replacetext(dat, "\n", "") // so it can be placed on paper correctly
dat = replacetext(dat, "\t", "")
return dat
/*
We can't just insert in HTML into the nanoUI so we need the raw data to play with.
Instead of creating this list over and over when someone leaves their PDA open to the page
we'll only update it when it changes. The PDA_Manifest global list is zeroed out upon any change
using /datum/datacore/proc/manifest_inject(), or manifest_insert()
*/
var/global/list/PDA_Manifest = list()
/datum/datacore/proc/get_manifest_json()
if(PDA_Manifest.len)
return
var/heads[0]
var/sec[0]
var/eng[0]
var/med[0]
var/sci[0]
var/ser[0]
var/sup[0]
var/bot[0]
var/misc[0]
for(var/datum/data/record/t in data_core.general)
var/name = sanitize(t.fields["name"])
var/rank = sanitize(t.fields["rank"])
var/real_rank = t.fields["real_rank"]
var/isactive = t.fields["p_stat"]
var/department = 0
var/depthead = 0 // Department Heads will be placed at the top of their lists.
if(real_rank in command_positions)
heads[++heads.len] = list("name" = name, "rank" = rank, "active" = isactive)
department = 1
depthead = 1
if(rank == "Captain" && heads.len != 1)
heads.Swap(1, heads.len)
if(real_rank in security_positions)
sec[++sec.len] = list("name" = name, "rank" = rank, "active" = isactive)
department = 1
if(depthead && sec.len != 1)
sec.Swap(1, sec.len)
if(real_rank in engineering_positions)
eng[++eng.len] = list("name" = name, "rank" = rank, "active" = isactive)
department = 1
if(depthead && eng.len != 1)
eng.Swap(1, eng.len)
if(real_rank in medical_positions)
med[++med.len] = list("name" = name, "rank" = rank, "active" = isactive)
department = 1
if(depthead && med.len != 1)
med.Swap(1, med.len)
if(real_rank in science_positions)
sci[++sci.len] = list("name" = name, "rank" = rank, "active" = isactive)
department = 1
if(depthead && sci.len != 1)
sci.Swap(1, sci.len)
if(real_rank in service_positions)
ser[++ser.len] = list("name" = name, "rank" = rank, "active" = isactive)
department = 1
if(depthead && ser.len != 1)
ser.Swap(1, ser.len)
if(real_rank in supply_positions)
sup[++sup.len] = list("name" = name, "rank" = rank, "active" = isactive)
department = 1
if(depthead && sup.len != 1)
sup.Swap(1, sup.len)
if(real_rank in nonhuman_positions)
bot[++bot.len] = list("name" = name, "rank" = rank, "active" = isactive)
department = 1
if(!department && !(name in heads))
misc[++misc.len] = list("name" = name, "rank" = rank, "active" = isactive)
PDA_Manifest = list(\
"heads" = heads,\
"sec" = sec,\
"eng" = eng,\
"med" = med,\
"sci" = sci,\
"ser" = ser,\
"sup" = sup,\
"bot" = bot,\
"misc" = misc\
)
return
/datum/datacore/proc/manifest()
for(var/mob/living/carbon/human/H in player_list)
manifest_inject(H)
/datum/datacore/proc/manifest_modify(name, assignment)
if(PDA_Manifest.len)
PDA_Manifest.Cut()
var/datum/data/record/foundrecord
@@ -35,7 +250,8 @@
foundrecord.fields["rank"] = assignment
foundrecord.fields["real_rank"] = real_title
/obj/effect/datacore/proc/manifest_inject(var/mob/living/carbon/human/H)
var/record_id_num = 1001
/datum/datacore/proc/manifest_inject(mob/living/carbon/human/H)
if(PDA_Manifest.len)
PDA_Manifest.Cut()
@@ -50,7 +266,7 @@
else
assignment = "Unassigned"
var/id = add_zero(num2hex(rand(1, 1.6777215E7)), 6) //this was the best they could come up with? A large random number? *sigh*
var/id = num2hex(record_id_num++, 6)
//General Record
@@ -125,8 +341,7 @@
locked += L
return
proc/get_id_photo(var/mob/living/carbon/human/H)
/proc/get_id_photo(mob/living/carbon/human/H)
var/icon/preview_icon = null
var/obj/item/organ/external/head/head_organ = H.get_organ("head")
var/obj/item/organ/internal/eyes/eyes_organ = H.get_int_organ(/obj/item/organ/internal/eyes)
@@ -43,11 +43,11 @@ Bonus
return
/datum/symptom/choking/proc/Choke_stage_3_4(mob/living/M, datum/disease/advance/A)
var/get_damage = sqrt(21+A.totalStageSpeed()*0.5)+sqrt(16+A.totalStealth())
var/get_damage = sqrtor0(21+A.totalStageSpeed()*0.5)+sqrtor0(16+A.totalStealth())
M.adjustOxyLoss(get_damage)
return 1
/datum/symptom/choking/proc/Choke(mob/living/M, datum/disease/advance/A)
var/get_damage = sqrt(21+A.totalStageSpeed()*0.5)+sqrt(16+A.totalStealth()*5)
var/get_damage = sqrtor0(21+A.totalStageSpeed()*0.5)+sqrtor0(16+A.totalStealth()*5)
M.adjustOxyLoss(get_damage)
return 1
@@ -36,6 +36,6 @@ Bonus
return
/datum/symptom/fever/proc/Heat(mob/living/M, datum/disease/advance/A)
var/get_heat = (sqrt(21+A.totalTransmittable()*2))+(sqrt(20+A.totalStageSpeed()*3))
var/get_heat = (sqrtor0(21+A.totalTransmittable()*2))+(sqrtor0(20+A.totalStageSpeed()*3))
M.bodytemperature = min(M.bodytemperature + (get_heat * A.stage), BODYTEMP_HEAT_DAMAGE_LIMIT - 1)
return 1
@@ -45,13 +45,13 @@ Bonus
return
/datum/symptom/fire/proc/Firestacks_stage_4(mob/living/M, datum/disease/advance/A)
var/get_stacks = (sqrt(20+A.totalStageSpeed()*2))-(sqrt(16+A.totalStealth()))
var/get_stacks = (sqrtor0(20+A.totalStageSpeed()*2))-(sqrtor0(16+A.totalStealth()))
M.adjust_fire_stacks(get_stacks)
M.adjustFireLoss(get_stacks/2)
return 1
/datum/symptom/fire/proc/Firestacks_stage_5(mob/living/M, datum/disease/advance/A)
var/get_stacks = (sqrt(20+A.totalStageSpeed()*3))-(sqrt(16+A.totalStealth()))
var/get_stacks = (sqrtor0(20+A.totalStageSpeed()*3))-(sqrtor0(16+A.totalStealth()))
M.adjust_fire_stacks(get_stacks)
M.adjustFireLoss(get_stacks)
return 1
@@ -38,6 +38,6 @@ Bonus
return
/datum/symptom/flesh_eating/proc/Flesheat(mob/living/M, datum/disease/advance/A)
var/get_damage = ((sqrt(16-A.totalStealth()))*5)
var/get_damage = ((sqrtor0(16-A.totalStealth()))*5)
M.adjustBruteLoss(get_damage)
return 1
@@ -34,7 +34,7 @@ Bonus
return
/datum/symptom/heal/proc/Heal(mob/living/M, datum/disease/advance/A)
var/get_damage = (sqrt(20+A.totalStageSpeed())*(1+rand()))
var/get_damage = (sqrtor0(20+A.totalStageSpeed())*(1+rand()))
M.adjustToxLoss(-get_damage)
return 1
@@ -148,7 +148,7 @@ Bonus
level = 5
/datum/symptom/heal/dna/Heal(mob/living/carbon/M, datum/disease/advance/A)
var/amt_healed = (sqrt(20+A.totalStageSpeed()*(3+rand())))-(sqrt(16+A.totalStealth()*rand()))
var/amt_healed = (sqrtor0(20+A.totalStageSpeed()*(3+rand())))-(sqrtor0(16+A.totalStealth()*rand()))
M.adjustBrainLoss(-amt_healed)
//Non-power mutations, excluding race, so the virus does not force monkey -> human transformations.
var/list/unclean_mutations = (not_good_mutations|bad_mutations) - mutations_list[RACEMUT]
@@ -35,6 +35,6 @@ Bonus
return
/datum/symptom/shivering/proc/Chill(mob/living/M, datum/disease/advance/A)
var/get_cold = (sqrt(16+A.totalStealth()*2))+(sqrt(21+A.totalResistance()*2))
var/get_cold = (sqrtor0(16+A.totalStealth()*2))+(sqrtor0(21+A.totalResistance()*2))
M.bodytemperature = min(M.bodytemperature - (get_cold * A.stage), BODYTEMP_COLD_DAMAGE_LIMIT + 1)
return 1
+143
View File
@@ -0,0 +1,143 @@
/datum/outfit
var/name = "Naked"
var/collect_not_del = FALSE
var/uniform = null
var/suit = null
var/back = null
var/belt = null
var/gloves = null
var/shoes = null
var/head = null
var/mask = null
var/l_ear = null
var/r_ear = null
var/glasses = null
var/id = null
var/l_pocket = null
var/r_pocket = null
var/suit_store = null
var/l_hand = null
var/r_hand = null
var/pda = null
var/internals_slot = null //ID of slot containing a gas tank
var/list/backpack_contents = list() // In the list(path=count,otherpath=count) format
/datum/outfit/proc/pre_equip(mob/living/carbon/human/H, visualsOnly = FALSE)
//to be overriden for customization depending on client prefs,species etc
return
// Used to equip an item to the mob. Mainly to prevent copypasta for collect_not_del.
/datum/outfit/proc/equip_item(mob/living/carbon/human/H, path, slot)
var/obj/item/I = new path(H)
if(collect_not_del)
H.equip_or_collect(I, slot)
else
H.equip_to_slot_or_del(I, slot)
/datum/outfit/proc/post_equip(mob/living/carbon/human/H, visualsOnly = FALSE)
//to be overriden for toggling internals, id binding, access etc
return
/datum/outfit/proc/equip(mob/living/carbon/human/H, visualsOnly = FALSE)
pre_equip(H, visualsOnly)
//Start with uniform,suit,backpack for additional slots
if(uniform)
equip_item(H, uniform, slot_w_uniform)
if(suit)
equip_item(H, suit, slot_wear_suit)
if(back)
equip_item(H, back, slot_back)
if(belt)
equip_item(H, belt, slot_belt)
if(gloves)
equip_item(H, gloves, slot_gloves)
if(shoes)
equip_item(H, shoes, slot_shoes)
if(head)
equip_item(H, head, slot_head)
if(mask)
equip_item(H, mask, slot_wear_mask)
if(l_ear)
equip_item(H, l_ear, slot_l_ear)
if(r_ear)
equip_item(H, r_ear, slot_r_ear)
if(glasses)
equip_item(H, glasses, slot_glasses)
if(id)
equip_item(H, id, slot_wear_id)
if(suit_store)
equip_item(H, suit_store, slot_s_store)
if(l_hand)
H.put_in_l_hand(new l_hand(H))
if(r_hand)
H.put_in_r_hand(new r_hand(H))
if(pda)
equip_item(H, pda, slot_wear_pda)
if(!visualsOnly) // Items in pockets or backpack don't show up on mob's icon.
if(l_pocket)
equip_item(H, l_pocket, slot_l_store)
if(r_pocket)
equip_item(H, r_pocket, slot_r_store)
for(var/path in backpack_contents)
var/number = backpack_contents[path]
for(var/i = 0, i < number, i++)
equip_item(H, path, slot_in_backpack)
post_equip(H, visualsOnly)
if(!visualsOnly)
apply_fingerprints(H)
if(internals_slot)
H.internal = H.get_item_by_slot(internals_slot)
H.update_action_buttons_icon()
H.update_body()
return 1
/datum/outfit/proc/apply_fingerprints(mob/living/carbon/human/H)
if(!istype(H))
return
if(H.back)
H.back.add_fingerprint(H, 1) //The 1 sets a flag to ignore gloves
for(var/obj/item/I in H.back.contents)
I.add_fingerprint(H, 1)
if(H.wear_id)
H.wear_id.add_fingerprint(H, 1)
if(H.w_uniform)
H.w_uniform.add_fingerprint(H, 1)
if(H.wear_suit)
H.wear_suit.add_fingerprint(H, 1)
if(H.wear_mask)
H.wear_mask.add_fingerprint(H, 1)
if(H.head)
H.head.add_fingerprint(H, 1)
if(H.shoes)
H.shoes.add_fingerprint(H, 1)
if(H.gloves)
H.gloves.add_fingerprint(H, 1)
if(H.l_ear)
H.l_ear.add_fingerprint(H, 1)
if(H.r_ear)
H.r_ear.add_fingerprint(H, 1)
if(H.glasses)
H.glasses.add_fingerprint(H, 1)
if(H.belt)
H.belt.add_fingerprint(H, 1)
for(var/obj/item/I in H.belt.contents)
I.add_fingerprint(H, 1)
if(H.s_store)
H.s_store.add_fingerprint(H, 1)
if(H.l_store)
H.l_store.add_fingerprint(H, 1)
if(H.r_store)
H.r_store.add_fingerprint(H, 1)
if(H.wear_pda)
H.wear_pda.add_fingerprint(H, 1)
return 1
File diff suppressed because it is too large Load Diff
+11 -3
View File
@@ -1149,6 +1149,13 @@ var/list/all_supply_groups = list(supply_emergency,supply_security,supply_engine
cost = 10
containername = "glass sheets crate"
/datum/supply_packs/materials/wood30
name = "30 Wood Planks Crate"
contains = list(/obj/item/stack/sheet/wood)
amount = 30
cost = 15
containername = "wood planks crate"
/datum/supply_packs/materials/cardboard50
name = "50 Cardboard Sheets Crate"
contains = list(/obj/item/stack/sheet/cardboard)
@@ -1408,6 +1415,7 @@ var/list/all_supply_groups = list(supply_emergency,supply_security,supply_engine
/obj/item/clothing/head/collectable/flatcap,
/obj/item/clothing/head/collectable/pirate,
/obj/item/clothing/head/collectable/kitty,
/obj/item/clothing/head/crown/fancy,
/obj/item/clothing/head/collectable/rabbitears,
/obj/item/clothing/head/collectable/wizard,
/obj/item/clothing/head/collectable/hardhat,
@@ -1527,9 +1535,9 @@ var/list/all_supply_groups = list(supply_emergency,supply_security,supply_engine
/obj/item/weapon/beach_ball)
cost = 20
containername = "polo supply crate"
///////////// Station Goals
///////////// Station Goals
/datum/supply_packs/misc/bsa
name = "Bluespace Artillery Parts"
cost = 150
+18 -15
View File
@@ -21,9 +21,9 @@ var/const/AIRLOCK_WIRE_SAFETY = 512
var/const/AIRLOCK_WIRE_SPEED = 1024
var/const/AIRLOCK_WIRE_LIGHT = 2048
/datum/wires/airlock/CanUse(var/mob/living/L)
/datum/wires/airlock/CanUse(mob/living/L)
var/obj/machinery/door/airlock/A = holder
if(!istype(L, /mob/living/silicon))
if(!issilicon(L))
if(A.isElectrified())
if(A.shock(L, 100))
return 0
@@ -31,20 +31,20 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
return 1
return 0
/datum/wires/airlock/GetInteractWindow()
/datum/wires/airlock/get_status()
. = ..()
var/obj/machinery/door/airlock/A = holder
var/haspower = A.arePowerSystemsOn()
. += ..()
. += text("<br>\n[]<br>\n[]<br>\n[]<br>\n[]<br>\n[]<br>\n[]<br>\n[]",
(A.locked ? "The door bolts have fallen!" : "The door bolts look up."),
((A.lights && haspower) ? "The door bolt lights are on." : "The door bolt lights are off!"),
((haspower) ? "The test light is on." : "The test light is off!"),
((A.aiControlDisabled==0 && !A.emagged && haspower) ? "The 'AI control allowed' light is on." : "The 'AI control allowed' light is off."),
((A.safe==0 && haspower) ? "The 'Check Wiring' light is on." : "The 'Check Wiring' light is off."),
((A.normalspeed==0 && haspower) ? "The 'Check Timing Mechanism' light is on." : "The 'Check Timing Mechanism' light is off."),
((A.emergency && haspower) ? "The emergency lights are on." : "The emergency lights are off."))
/datum/wires/airlock/UpdateCut(var/index, var/mended)
. += "The door bolts [A.locked ? "have fallen!" : "look up."]"
. += "The door bolt lights are [(A.lights && haspower) ? "on." : "off!"]"
. += "The test light is [haspower ? "on." : "off!"]"
. += "The 'AI control allowed' light is [(A.aiControlDisabled == 0 && !A.emagged && haspower) ? "on" : "off"]."
. += "The 'Check Wiring' light is [(A.safe == 0 && haspower) ? "on" : "off"]."
. += "The 'Check Timing Mechanism' light is [(A.normalspeed == 0 && haspower) ? "on" : "off"]."
. += "The emergency lights are [(A.emergency && haspower) ? "on" : "off"]."
/datum/wires/airlock/UpdateCut(index, mended)
var/obj/machinery/door/airlock/A = holder
switch(index)
@@ -113,8 +113,9 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
if(AIRLOCK_WIRE_LIGHT)
A.lights = mended
A.update_icon()
..()
/datum/wires/airlock/UpdatePulsed(var/index)
/datum/wires/airlock/UpdatePulsed(index)
var/obj/machinery/door/airlock/A = holder
switch(index)
@@ -176,4 +177,6 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
if(AIRLOCK_WIRE_LIGHT)
A.lights = !A.lights
A.update_icon()
A.update_icon()
..()
+10 -6
View File
@@ -10,18 +10,20 @@ var/const/AALARM_WIRE_AI_CONTROL = 8
var/const/AALARM_WIRE_AALARM = 16
/datum/wires/alarm/CanUse(var/mob/living/L)
/datum/wires/alarm/CanUse(mob/living/L)
var/obj/machinery/alarm/A = holder
if(A.wiresexposed)
return 1
return 0
/datum/wires/alarm/GetInteractWindow()
/datum/wires/alarm/get_status()
. = ..()
var/obj/machinery/alarm/A = holder
. += ..()
. += text("<br>\n[(A.locked ? "The Air Alarm is locked." : "The Air Alarm is unlocked.")]<br>\n[((A.shorted || (A.stat & (NOPOWER|BROKEN))) ? "The Air Alarm is offline." : "The Air Alarm is working properly!")]<br>\n[(A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")]")
. += "The Air Alarm is [A.locked ? "" : "un"]locked."
. += "The Air Alarm is [(A.shorted || (A.stat & (NOPOWER|BROKEN))) ? "offline." : "working properly!"]"
. += "The 'AI control allowed' light is [A.aidisabled ? "off" : "on"]."
/datum/wires/alarm/UpdateCut(var/index, var/mended)
/datum/wires/alarm/UpdateCut(index, mended)
var/obj/machinery/alarm/A = holder
switch(index)
if(AALARM_WIRE_IDSCAN)
@@ -50,8 +52,9 @@ var/const/AALARM_WIRE_AALARM = 16
if(A.alarm_area.atmosalert(2, A))
A.post_alert(2)
A.update_icon()
..()
/datum/wires/alarm/UpdatePulsed(var/index)
/datum/wires/alarm/UpdatePulsed(index)
var/obj/machinery/alarm/A = holder
switch(index)
if(AALARM_WIRE_IDSCAN)
@@ -92,3 +95,4 @@ var/const/AALARM_WIRE_AALARM = 16
if(A.alarm_area.atmosalert(0, A))
A.post_alert(0)
A.update_icon()
..()
+10 -8
View File
@@ -7,19 +7,21 @@ var/const/APC_WIRE_MAIN_POWER1 = 2
var/const/APC_WIRE_MAIN_POWER2 = 4
var/const/APC_WIRE_AI_CONTROL = 8
/datum/wires/apc/GetInteractWindow()
/datum/wires/apc/get_status()
. = ..()
var/obj/machinery/power/apc/A = holder
. += ..()
. += text("<br>\n[(A.locked ? "The APC is locked." : "The APC is unlocked.")]<br>\n[(A.shorted ? "The APCs power has been shorted." : "The APC is working properly!")]<br>\n[(A.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")]")
. += "The APC is [A.locked ? "" : "un"]locked."
. += A.shorted ? "The APCs power has been shorted." : "The APC is working properly!"
. += "The 'AI control allowed' light is [A.aidisabled ? "off" : "on"]."
/datum/wires/apc/CanUse(var/mob/living/L)
/datum/wires/apc/CanUse(mob/living/L)
var/obj/machinery/power/apc/A = holder
if(A.wiresexposed)
return 1
return 0
/datum/wires/apc/UpdatePulsed(var/index)
/datum/wires/apc/UpdatePulsed(index)
var/obj/machinery/power/apc/A = holder
@@ -51,9 +53,9 @@ var/const/APC_WIRE_AI_CONTROL = 8
A.aidisabled = 0
A.updateDialog()
A.updateDialog()
..()
/datum/wires/apc/UpdateCut(var/index, var/mended)
/datum/wires/apc/UpdateCut(index, mended)
var/obj/machinery/power/apc/A = holder
switch(index)
@@ -75,4 +77,4 @@ var/const/APC_WIRE_AI_CONTROL = 8
else
if(A.aidisabled == 1)
A.aidisabled = 0
A.updateDialog()
..()
+17 -12
View File
@@ -1,5 +1,4 @@
/datum/wires/autolathe
holder_type = /obj/machinery/autolathe
wire_count = 10
@@ -7,10 +6,12 @@ var/const/AUTOLATHE_HACK_WIRE = 1
var/const/AUTOLATHE_SHOCK_WIRE = 2
var/const/AUTOLATHE_DISABLE_WIRE = 4
/datum/wires/autolathe/GetInteractWindow()
/datum/wires/autolathe/get_status()
. = ..()
var/obj/machinery/autolathe/A = holder
. += ..()
. += text("<BR>The red light is [A.disabled ? "off" : "on"].<BR>The green light is [A.shocked ? "off" : "on"].<BR>The blue light is [A.hacked ? "off" : "on"].<BR>")
. += "The red light is [A.disabled ? "off" : "on"]."
. += "The green light is [A.shocked ? "off" : "on"]."
. += "The blue light is [A.hacked ? "off" : "on"]."
/datum/wires/autolathe/CanUse()
var/obj/machinery/autolathe/A = holder
@@ -18,11 +19,6 @@ var/const/AUTOLATHE_DISABLE_WIRE = 4
return 1
return 0
/datum/wires/autolathe/Interact(var/mob/living/user)
if(CanUse(user))
var/obj/machinery/autolathe/V = holder
V.attack_hand(user)
/datum/wires/autolathe/UpdateCut(index, mended)
var/obj/machinery/autolathe/A = holder
switch(index)
@@ -32,6 +28,7 @@ var/const/AUTOLATHE_DISABLE_WIRE = 4
A.shocked = !mended
if(AUTOLATHE_DISABLE_WIRE)
A.disabled = !mended
..()
/datum/wires/autolathe/UpdatePulsed(index)
if(IsIndexCut(index))
@@ -40,19 +37,27 @@ var/const/AUTOLATHE_DISABLE_WIRE = 4
switch(index)
if(AUTOLATHE_HACK_WIRE)
A.adjust_hacked(!A.hacked)
updateUIs()
spawn(50)
if(A && !IsIndexCut(index))
A.adjust_hacked(0)
Interact(usr)
updateUIs()
if(AUTOLATHE_SHOCK_WIRE)
A.shocked = !A.shocked
updateUIs()
spawn(50)
if(A && !IsIndexCut(index))
A.shocked = 0
Interact(usr)
updateUIs()
if(AUTOLATHE_DISABLE_WIRE)
A.disabled = !A.disabled
updateUIs()
spawn(50)
if(A && !IsIndexCut(index))
A.disabled = 0
Interact(usr)
updateUIs()
/datum/wires/autolathe/proc/updateUIs()
nanomanager.update_uis(src)
if(holder)
nanomanager.update_uis(holder)
+10 -12
View File
@@ -5,17 +5,15 @@
holder_type = /obj/machinery/camera
wire_count = 6
/datum/wires/camera/GetInteractWindow()
/datum/wires/camera/get_status()
. = ..()
var/obj/machinery/camera/C = holder
. += "<br>\n[(C.view_range == initial(C.view_range) ? "The focus light is on." : "The focus light is off.")]"
. += "<br>\n[(C.can_use() ? "The power link light is on." : "The power link light is off.")]"
. += "<br>\n[(C.light_disabled ? "The camera light is off." : "The camera light is on.")]"
. += "<br>\n[(C.alarm_on ? "The alarm light is on." : "The alarm light is off.")]"
return .
. += "The focus light is [(C.view_range == initial(C.view_range)) ? "on" : "off"]."
. += "The power link light is [C.can_use() ? "on" : "off"]."
. += "The camera light is [C.light_disabled ? "off" : "on"]."
. += "The alarm light is [C.alarm_on ? "on" : "off"]."
/datum/wires/camera/CanUse(var/mob/living/L)
/datum/wires/camera/CanUse(mob/living/L)
var/obj/machinery/camera/C = holder
if(!C.panel_open)
return 0
@@ -28,7 +26,7 @@ var/const/CAMERA_WIRE_ALARM = 8
var/const/CAMERA_WIRE_NOTHING1 = 16
var/const/CAMERA_WIRE_NOTHING2 = 32
/datum/wires/camera/UpdateCut(var/index, var/mended)
/datum/wires/camera/UpdateCut(index, mended)
var/obj/machinery/camera/C = holder
switch(index)
@@ -48,9 +46,9 @@ var/const/CAMERA_WIRE_NOTHING2 = 32
C.triggerCameraAlarm()
else
C.cancelCameraAlarm()
return
..()
/datum/wires/camera/UpdatePulsed(var/index)
/datum/wires/camera/UpdatePulsed(index)
var/obj/machinery/camera/C = holder
if(IsIndexCut(index))
return
@@ -67,7 +65,7 @@ var/const/CAMERA_WIRE_NOTHING2 = 32
if(CAMERA_WIRE_ALARM)
C.visible_message("[bicon(C)] *beep*", "[bicon(C)] *beep*")
return
..()
/datum/wires/camera/proc/CanDeconstruct()
if(IsIndexCut(CAMERA_WIRE_POWER) && IsIndexCut(CAMERA_WIRE_FOCUS) && IsIndexCut(CAMERA_WIRE_LIGHT) && IsIndexCut(CAMERA_WIRE_NOTHING1) && IsIndexCut(CAMERA_WIRE_NOTHING2))
+6 -4
View File
@@ -6,24 +6,26 @@ var/const/WIRE_EXPLODE = 1
/datum/wires/explosive/proc/explode()
return
/datum/wires/explosive/UpdatePulsed(var/index)
/datum/wires/explosive/UpdatePulsed(index)
switch(index)
if(WIRE_EXPLODE)
explode()
..()
/datum/wires/explosive/UpdateCut(var/index, var/mended)
/datum/wires/explosive/UpdateCut(index, mended)
switch(index)
if(WIRE_EXPLODE)
if(!mended)
explode()
..()
/datum/wires/explosive/gibtonite
holder_type = /obj/item/weapon/twohanded/required/gibtonite
/datum/wires/explosive/gibtonite/CanUse(var/mob/living/L)
/datum/wires/explosive/gibtonite/CanUse(mob/living/L)
return 1
/datum/wires/explosive/gibtonite/UpdateCut(var/index, var/mended)
/datum/wires/explosive/gibtonite/UpdateCut(index, mended)
return
/datum/wires/explosive/gibtonite/explode()
+3 -8
View File
@@ -13,19 +13,13 @@ var/const/WIRE_REMOTE_RX = 64 // remote recv functions
var/const/WIRE_REMOTE_TX = 128 // remote trans status
var/const/WIRE_BEACON_RX = 256 // beacon ping recv
/datum/wires/mulebot/CanUse(var/mob/living/L)
/datum/wires/mulebot/CanUse(mob/living/L)
var/mob/living/simple_animal/bot/mulebot/M = holder
if(M.open)
return 1
return 0
// So the wires do not open a new window, handle the interaction ourselves.
/datum/wires/mulebot/Interact(var/mob/living/user)
if(CanUse(user))
var/mob/living/simple_animal/bot/mulebot/M = holder
M.interact(user)
/datum/wires/mulebot/UpdatePulsed(var/index)
/datum/wires/mulebot/UpdatePulsed(index)
switch(index)
if(WIRE_POWER1, WIRE_POWER2)
holder.visible_message("\blue [bicon(holder)] The charge light flickers.")
@@ -37,6 +31,7 @@ var/const/WIRE_BEACON_RX = 256 // beacon ping recv
holder.visible_message("\blue [bicon(holder)] The drive motor whines briefly.")
else
holder.visible_message("\blue [bicon(holder)] You hear a radio crackle.")
..()
// HELPER PROCS
+22 -15
View File
@@ -7,33 +7,35 @@ var/const/NUCLEARBOMB_WIRE_LIGHT = 1
var/const/NUCLEARBOMB_WIRE_TIMING = 2
var/const/NUCLEARBOMB_WIRE_SAFETY = 4
/datum/wires/nuclearbomb/CanUse(var/mob/living/L)
/datum/wires/nuclearbomb/CanUse(mob/living/L)
var/obj/machinery/nuclearbomb/N = holder
if(N.panel_open)
return 1
return 0
/datum/wires/nuclearbomb/GetInteractWindow()
/datum/wires/nuclearbomb/get_status()
. = ..()
var/obj/machinery/nuclearbomb/N = holder
. += ..()
. += "<BR>The device is [N.timing ? "shaking!" : "still."]<BR>"
. += "The device is is [N.safety ? "quiet" : "whirring"].<BR>"
. += "The lights are [N.lighthack ? "static" : "functional"].<BR>"
. += "The device is [N.timing ? "shaking!" : "still."]"
. += "The device is is [N.safety ? "quiet" : "whirring"]."
. += "The lights are [N.lighthack ? "static" : "functional"]."
/datum/wires/nuclearbomb/UpdatePulsed(var/index)
/datum/wires/nuclearbomb/UpdatePulsed(index)
var/obj/machinery/nuclearbomb/N = holder
switch(index)
if(NUCLEARBOMB_WIRE_LIGHT)
N.lighthack = !N.lighthack
updateUIs()
spawn(100)
N.lighthack = !N.lighthack
updateUIs()
if(NUCLEARBOMB_WIRE_TIMING)
if(N.timing)
spawn
message_admins("[key_name_admin(usr)] pulsed a nuclear bomb's detonation wire, causing it to explode (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[holder.x];Y=[holder.y];Z=[holder.z]'>JMP</a>)")
N.explode()
message_admins("[key_name_admin(usr)] pulsed a nuclear bomb's detonation wire, causing it to explode (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[holder.x];Y=[holder.y];Z=[holder.z]'>JMP</a>)")
N.explode()
if(NUCLEARBOMB_WIRE_SAFETY)
N.safety = !N.safety
updateUIs()
spawn(100)
N.safety = !N.safety
if(N.safety == 1)
@@ -45,15 +47,15 @@ var/const/NUCLEARBOMB_WIRE_SAFETY = 4
N.icon_state = "nuclearbomb1"
else
N.visible_message("\blue The [N] emits a quiet whirling noise!")
/datum/wires/nuclearbomb/UpdateCut(var/index, var/mended)
updateUIs()
/datum/wires/nuclearbomb/UpdateCut(index, mended)
var/obj/machinery/nuclearbomb/N = holder
switch(index)
if(NUCLEARBOMB_WIRE_SAFETY)
if(N.timing)
spawn
message_admins("[key_name_admin(usr)] cut a nuclear bomb's timing wire, causing it to explode (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[holder.x];Y=[holder.y];Z=[holder.z]'>JMP</a>)")
N.explode()
message_admins("[key_name_admin(usr)] cut a nuclear bomb's timing wire, causing it to explode (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[holder.x];Y=[holder.y];Z=[holder.z]'>JMP</a>)")
N.explode()
if(NUCLEARBOMB_WIRE_TIMING)
if(!N.lighthack)
if(N.icon_state == "nuclearbomb2")
@@ -62,3 +64,8 @@ var/const/NUCLEARBOMB_WIRE_SAFETY = 4
bomb_set = 0
if(NUCLEARBOMB_WIRE_LIGHT)
N.lighthack = !N.lighthack
/datum/wires/nuclearbomb/proc/updateUIs()
nanomanager.update_uis(src)
if(holder)
nanomanager.update_uis(holder)
+6 -4
View File
@@ -8,13 +8,13 @@ var/const/PARTICLE_INTERFACE_WIRE = 4 // Determines the interface showing up.
var/const/PARTICLE_LIMIT_POWER_WIRE = 8 // Determines how strong the PA can be.
//var/const/PARTICLE_NOTHING_WIRE = 16 // Blank wire
/datum/wires/particle_acc/control_box/CanUse(var/mob/living/L)
/datum/wires/particle_acc/control_box/CanUse(mob/living/L)
var/obj/machinery/particle_accelerator/control_box/C = holder
if(C.construction_state == 2)
return 1
return 0
/datum/wires/particle_acc/control_box/UpdatePulsed(var/index)
/datum/wires/particle_acc/control_box/UpdatePulsed(index)
var/obj/machinery/particle_accelerator/control_box/C = holder
switch(index)
@@ -29,8 +29,9 @@ var/const/PARTICLE_LIMIT_POWER_WIRE = 8 // Determines how strong the PA can be.
if(PARTICLE_LIMIT_POWER_WIRE)
C.visible_message("[bicon(C)]<b>[C]</b> makes a large whirring noise.")
..()
/datum/wires/particle_acc/control_box/UpdateCut(var/index, var/mended)
/datum/wires/particle_acc/control_box/UpdateCut(index, mended)
var/obj/machinery/particle_accelerator/control_box/C = holder
switch(index)
@@ -49,4 +50,5 @@ var/const/PARTICLE_LIMIT_POWER_WIRE = 8 // Determines how strong the PA can be.
if(PARTICLE_LIMIT_POWER_WIRE)
C.strength_upper_limit = (mended ? 2 : 3)
if(C.strength_upper_limit < C.strength)
C.remove_strength()
C.remove_strength()
..()
+5 -3
View File
@@ -6,13 +6,13 @@ var/const/WIRE_SIGNAL = 1
var/const/WIRE_RECEIVE = 2
var/const/WIRE_TRANSMIT = 4
/datum/wires/radio/CanUse(var/mob/living/L)
/datum/wires/radio/CanUse(mob/living/L)
var/obj/item/device/radio/R = holder
if(R.b_stat)
return 1
return 0
/datum/wires/radio/UpdatePulsed(var/index)
/datum/wires/radio/UpdatePulsed(index)
var/obj/item/device/radio/R = holder
switch(index)
if(WIRE_SIGNAL)
@@ -24,8 +24,9 @@ var/const/WIRE_TRANSMIT = 4
if(WIRE_TRANSMIT)
R.broadcasting = !R.broadcasting && !IsIndexCut(WIRE_SIGNAL)
..()
/datum/wires/radio/UpdateCut(var/index, var/mended)
/datum/wires/radio/UpdateCut(index, mended)
var/obj/item/device/radio/R = holder
switch(index)
if(WIRE_SIGNAL)
@@ -37,3 +38,4 @@ var/const/WIRE_TRANSMIT = 4
if(WIRE_TRANSMIT)
R.broadcasting = mended && !IsIndexCut(WIRE_SIGNAL)
..()
+10 -9
View File
@@ -19,16 +19,15 @@ var/const/BORG_WIRE_CAMERA = 4
var/const/BORG_WIRE_AI_CONTROL = 8 // Not used on MoMMIs
var/const/BORG_WIRE_LAWCHECK = 16 // Not used on MoMMIs
/datum/wires/robot/GetInteractWindow()
/datum/wires/robot/get_status()
. = ..()
var/mob/living/silicon/robot/R = holder
. += text("<br>\n[(R.lawupdate ? "The LawSync light is on." : "The LawSync light is off.")]<br>\n[(R.connected_ai ? "The AI link light is on." : "The AI link light is off.")]")
. += text("<br>\n[((!isnull(R.camera) && R.camera.status == 1) ? "The Camera light is on." : "The Camera light is off.")]<br>\n")
. += text("<br>\n[(R.lockcharge ? "The lockdown light is on." : "The lockdown light is off.")]")
return .
. += "The LawSync light is [R.lawupdate ? "on" : "off"]."
. += "The AI link light is [R.connected_ai ? "on" : "off"]."
. += "The Camera light is [(R.camera && R.camera.status == 1) ? "on" : "off"]."
. += "The lockdown light is [R.lockcharge ? "on" : "off"]."
/datum/wires/robot/UpdateCut(var/index, var/mended)
/datum/wires/robot/UpdateCut(index, mended)
var/mob/living/silicon/robot/R = holder
switch(index)
@@ -57,9 +56,10 @@ var/const/BORG_WIRE_LAWCHECK = 16 // Not used on MoMMIs
if(BORG_WIRE_LOCKED_DOWN)
R.SetLockdown(!mended)
..()
/datum/wires/robot/UpdatePulsed(var/index)
/datum/wires/robot/UpdatePulsed(index)
var/mob/living/silicon/robot/R = holder
switch(index)
@@ -76,8 +76,9 @@ var/const/BORG_WIRE_LAWCHECK = 16 // Not used on MoMMIs
if(BORG_WIRE_LOCKED_DOWN)
R.SetLockdown(!R.lockcharge) // Toggle
..()
/datum/wires/robot/CanUse(var/mob/living/L)
/datum/wires/robot/CanUse(mob/living/L)
var/mob/living/silicon/robot/R = holder
if(R.wiresexposed)
return 1
+11 -9
View File
@@ -10,9 +10,9 @@ var/const/SMARTFRIDGE_WIRE_ELECTRIFY = 1
var/const/SMARTFRIDGE_WIRE_THROW = 2
var/const/SMARTFRIDGE_WIRE_IDSCAN = 4
/datum/wires/smartfridge/CanUse(var/mob/living/L)
/datum/wires/smartfridge/CanUse(mob/living/L)
var/obj/machinery/smartfridge/S = holder
if(!istype(L, /mob/living/silicon))
if(!issilicon(L))
if(S.seconds_electrified)
if(S.shock(L, 100))
return 0
@@ -20,14 +20,14 @@ var/const/SMARTFRIDGE_WIRE_IDSCAN = 4
return 1
return 0
/datum/wires/smartfridge/GetInteractWindow()
/datum/wires/smartfridge/get_status()
. = ..()
var/obj/machinery/smartfridge/S = holder
. += ..()
. += "<BR>The orange light is [S.seconds_electrified ? "off" : "on"].<BR>"
. += "The red light is [S.shoot_inventory ? "off" : "blinking"].<BR>"
. += "A [S.scan_id ? "purple" : "yellow"] light is on.<BR>"
. += "The orange light is [S.seconds_electrified ? "off" : "on"]."
. += "The red light is [S.shoot_inventory ? "off" : "blinking"]."
. += "A [S.scan_id ? "purple" : "yellow"] light is on."
/datum/wires/smartfridge/UpdatePulsed(var/index)
/datum/wires/smartfridge/UpdatePulsed(index)
var/obj/machinery/smartfridge/S = holder
switch(index)
if(SMARTFRIDGE_WIRE_THROW)
@@ -36,8 +36,9 @@ var/const/SMARTFRIDGE_WIRE_IDSCAN = 4
S.seconds_electrified = 30
if(SMARTFRIDGE_WIRE_IDSCAN)
S.scan_id = !S.scan_id
..()
/datum/wires/smartfridge/UpdateCut(var/index, var/mended)
/datum/wires/smartfridge/UpdateCut(index, mended)
var/obj/machinery/smartfridge/S = holder
switch(index)
if(SMARTFRIDGE_WIRE_THROW)
@@ -49,3 +50,4 @@ var/const/SMARTFRIDGE_WIRE_IDSCAN = 4
S.seconds_electrified = -1
if(SMARTFRIDGE_WIRE_IDSCAN)
S.scan_id = 1
..()
+7 -5
View File
@@ -10,13 +10,13 @@ var/const/WIRE_PROCEED = 8 // Lowers the timer, explodes if cut while the bomb
var/const/WIRE_ACTIVATE = 16 // Will start a bombs timer if pulsed, will hint if pulsed while already active, will stop a timer a bomb on cut
/datum/wires/syndicatebomb/CanUse(var/mob/living/L)
/datum/wires/syndicatebomb/CanUse(mob/living/L)
var/obj/machinery/syndicatebomb/P = holder
if(P.open_panel)
return 1
return 0
/datum/wires/syndicatebomb/UpdatePulsed(var/index)
/datum/wires/syndicatebomb/UpdatePulsed(index)
var/obj/machinery/syndicatebomb/P = holder
switch(index)
if(WIRE_BOOM)
@@ -47,8 +47,9 @@ var/const/WIRE_ACTIVATE = 16 // Will start a bombs timer if pulsed, will hint if
else
P.loc.visible_message("<span class='notice'>[bicon(holder)] The bomb seems to hesitate for a moment.</span>")
P.timer += 5
..()
/datum/wires/syndicatebomb/UpdateCut(var/index, var/mended)
/datum/wires/syndicatebomb/UpdateCut(index, mended)
var/obj/machinery/syndicatebomb/P = holder
switch(index)
if(WIRE_EXPLODE)
@@ -58,7 +59,7 @@ var/const/WIRE_ACTIVATE = 16 // Will start a bombs timer if pulsed, will hint if
P.timer = 0
else
P.defused = 1
if(mended)
else
P.defused = 0 //cutting and mending all the wires of an inactive bomb will thus cure any sabotage
if(WIRE_UNBOLT)
if(!mended && P.anchored)
@@ -74,4 +75,5 @@ var/const/WIRE_ACTIVATE = 16 // Will start a bombs timer if pulsed, will hint if
P.loc.visible_message("<span class='notice'>[bicon(holder)] The timer stops! The bomb has been defused!</span>")
P.icon_state = "[initial(P.icon_state)]-inactive[P.open_panel ? "-wires" : ""]"
P.active = 0
P.defused = 1
P.defused = 1
..()
+12 -10
View File
@@ -9,7 +9,7 @@ var/const/VENDING_WIRE_CONTRABAND = 2
var/const/VENDING_WIRE_ELECTRIFY = 4
var/const/VENDING_WIRE_IDSCAN = 8
/datum/wires/vending/CanUse(var/mob/living/L)
/datum/wires/vending/CanUse(mob/living/L)
var/obj/machinery/vending/V = holder
if(!istype(L, /mob/living/silicon))
if(V.seconds_electrified)
@@ -19,15 +19,15 @@ var/const/VENDING_WIRE_IDSCAN = 8
return 1
return 0
/datum/wires/vending/GetInteractWindow()
/datum/wires/vending/get_status()
. = ..()
var/obj/machinery/vending/V = holder
. += ..()
. += "<BR>The orange light is [V.seconds_electrified ? "on" : "off"].<BR>"
. += "The red light is [V.shoot_inventory ? "off" : "blinking"].<BR>"
. += "The green light is [(V.categories & CAT_HIDDEN) ? "on" : "off"].<BR>"
. += "A [V.scan_id ? "purple" : "yellow"] light is on.<BR>"
. += "The orange light is [V.seconds_electrified ? "on" : "off"]."
. += "The red light is [V.shoot_inventory ? "off" : "blinking"]."
. += "The green light is [(V.categories & CAT_HIDDEN) ? "on" : "off"]."
. += "A [V.scan_id ? "purple" : "yellow"] light is on."
/datum/wires/vending/UpdatePulsed(var/index)
/datum/wires/vending/UpdatePulsed(index)
var/obj/machinery/vending/V = holder
switch(index)
if(VENDING_WIRE_THROW)
@@ -38,8 +38,9 @@ var/const/VENDING_WIRE_IDSCAN = 8
V.seconds_electrified = 30
if(VENDING_WIRE_IDSCAN)
V.scan_id = !V.scan_id
..()
/datum/wires/vending/UpdateCut(var/index, var/mended)
/datum/wires/vending/UpdateCut(index, mended)
var/obj/machinery/vending/V = holder
switch(index)
if(VENDING_WIRE_THROW)
@@ -52,4 +53,5 @@ var/const/VENDING_WIRE_IDSCAN = 8
else
V.seconds_electrified = -1
if(VENDING_WIRE_IDSCAN)
V.scan_id = 1
V.scan_id = 1
..()
+81 -86
View File
@@ -26,7 +26,7 @@ var/list/wireColours = list("red", "blue", "green", "black", "orange", "brown",
var/window_x = 370
var/window_y = 470
/datum/wires/New(var/atom/holder)
/datum/wires/New(atom/holder)
..()
src.holder = holder
if(!istype(holder, holder_type))
@@ -68,106 +68,101 @@ var/list/wireColours = list("red", "blue", "green", "black", "orange", "brown",
src.wires[colour] = index
//wires = shuffle(wires)
/datum/wires/proc/get_status()
return list()
/datum/wires/proc/Interact(var/mob/living/user)
/datum/wires/proc/Interact(mob/living/user)
if(user && istype(user) && holder && CanUse(user))
ui_interact(user)
var/html = null
if(holder && CanUse(user))
html = GetInteractWindow()
if(html)
user.set_machine(holder)
else
user.unset_machine()
// No content means no window.
user << browse(null, "window=wires")
return
var/datum/browser/popup = new(user, "wires", holder.name, window_x, window_y)
popup.set_content(html)
popup.set_title_image(user.browse_rsc_icon(holder.icon, holder.icon_state))
popup.open()
/datum/wires/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
ui = nanomanager.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "wires.tmpl", holder.name, window_x, window_y)
ui.open()
/datum/wires/proc/GetInteractWindow()
var/html = "<div class='block'>"
html += "<h3>Exposed Wires</h3>"
html += "<table[table_options]>"
/datum/wires/ui_data(mob/user, ui_key = "main", datum/topic_state/state = default_state)
var/data[0]
var/list/W[0]
for(var/colour in wires)
html += "<tr>"
html += "<td[row_options1]><font color='[colour]'>[capitalize(colour)]</font></td>"
html += "<td[row_options2]>"
html += "<A href='?src=[UID()];action=1;cut=[colour]'>[IsColourCut(colour) ? "Mend" : "Cut"]</A>"
html += " <A href='?src=[UID()];action=1;pulse=[colour]'>Pulse</A>"
html += " <A href='?src=[UID()];action=1;attach=[colour]'>[IsAttached(colour) ? "Detach" : "Attach"] Signaller</A></td></tr>"
html += "</table>"
html += "</div>"
W[++W.len] = list("colour" = capitalize(colour), "cut" = IsColourCut(colour), "attached" = IsAttached(colour))
return html
if(W.len > 0)
data["wires"] = W
var/list/status = get_status()
data["status_len"] = status.len
data["status"] = status
return data
/datum/wires/nano_host()
return holder
/datum/wires/Topic(href, href_list)
..()
if(..())
return 1
if(in_range(holder, usr) && isliving(usr))
var/mob/living/L = usr
if(CanUse(L) && href_list["action"])
var/obj/item/I = L.get_active_hand()
var/colour = lowertext(href_list["wire"])
holder.add_hiddenprint(L)
if(href_list["cut"]) // Toggles the cut/mend status
if(istype(I, /obj/item/weapon/wirecutters))
playsound(holder, 'sound/items/Wirecutter.ogg', 20, 1)
var/colour = href_list["cut"]
CutWireColour(colour)
else
to_chat(L, "<span class='error'>You need wirecutters!</span>")
else if(href_list["pulse"])
if(istype(I, /obj/item/device/multitool))
playsound(holder, 'sound/weapons/empty.ogg', 20, 1)
var/colour = href_list["pulse"]
PulseColour(colour)
else
to_chat(L, "<span class='error'>You need a multitool!</span>")
else if(href_list["attach"])
var/colour = href_list["attach"]
// Detach
if(IsAttached(colour))
var/obj/item/O = Detach(colour)
if(O)
L.put_in_hands(O)
// Attach
else
if(istype(I, /obj/item/device/assembly/signaler))
L.drop_item()
Attach(colour, I)
switch(href_list["action"])
if("cut") // Toggles the cut/mend status
if(istype(I, /obj/item/weapon/wirecutters))
playsound(holder, 'sound/items/Wirecutter.ogg', 20, 1)
CutWireColour(colour)
else
to_chat(L, "<span class='error'>You need a remote signaller!</span>")
to_chat(L, "<span class='error'>You need wirecutters!</span>")
if("pulse")
if(istype(I, /obj/item/device/multitool))
playsound(holder, 'sound/weapons/empty.ogg', 20, 1)
PulseColour(colour)
else
to_chat(L, "<span class='error'>You need a multitool!</span>")
if("attach")
if(IsAttached(colour))
var/obj/item/O = Detach(colour)
if(O)
L.put_in_hands(O)
else
if(istype(I, /obj/item/device/assembly/signaler))
if(L.drop_item())
Attach(colour, I)
else
to_chat(L, "<span class='warning'>[L.get_active_hand()] is stuck to your hand!</span>")
else
to_chat(L, "<span class='error'>You need a remote signaller!</span>")
// Update Window
Interact(usr)
if(href_list["close"])
usr << browse(null, "window=wires")
usr.unset_machine(holder)
nanomanager.update_uis(src)
return 1
//
// Overridable Procs
//
// Called when wires cut/mended.
/datum/wires/proc/UpdateCut(var/index, var/mended)
return
/datum/wires/proc/UpdateCut(index, mended)
if(holder)
nanomanager.update_uis(holder)
// Called when wire pulsed. Add code here.
/datum/wires/proc/UpdatePulsed(var/index)
return
/datum/wires/proc/UpdatePulsed(index)
if(holder)
nanomanager.update_uis(holder)
/datum/wires/proc/CanUse(var/mob/living/L)
/datum/wires/proc/CanUse(mob/living/L)
return 1
/datum/wires/CanUseTopic(mob/user, datum/topic_state/state)
if(!CanUse(user))
return STATUS_CLOSE
return ..()
// Example of use:
/*
@@ -194,15 +189,15 @@ var/const/POWER = 8
// Helper Procs
//
/datum/wires/proc/PulseColour(var/colour)
/datum/wires/proc/PulseColour(colour)
PulseIndex(GetIndex(colour))
/datum/wires/proc/PulseIndex(var/index)
/datum/wires/proc/PulseIndex(index)
if(IsIndexCut(index))
return
UpdatePulsed(index)
/datum/wires/proc/GetIndex(var/colour)
/datum/wires/proc/GetIndex(colour)
if(wires[colour])
var/index = wires[colour]
return index
@@ -213,28 +208,28 @@ var/const/POWER = 8
// Is Index/Colour Cut procs
//
/datum/wires/proc/IsColourCut(var/colour)
/datum/wires/proc/IsColourCut(colour)
var/index = GetIndex(colour)
return IsIndexCut(index)
/datum/wires/proc/IsIndexCut(var/index)
/datum/wires/proc/IsIndexCut(index)
return (index & wires_status)
//
// Signaller Procs
//
/datum/wires/proc/IsAttached(var/colour)
/datum/wires/proc/IsAttached(colour)
if(signallers[colour])
return 1
return 0
/datum/wires/proc/GetAttached(var/colour)
/datum/wires/proc/GetAttached(colour)
if(signallers[colour])
return signallers[colour]
return null
/datum/wires/proc/Attach(var/colour, var/obj/item/device/assembly/signaler/S)
/datum/wires/proc/Attach(colour, obj/item/device/assembly/signaler/S)
if(colour && S)
if(!IsAttached(colour))
signallers[colour] = S
@@ -242,7 +237,7 @@ var/const/POWER = 8
S.connected = src
return S
/datum/wires/proc/Detach(var/colour)
/datum/wires/proc/Detach(colour)
if(colour)
var/obj/item/device/assembly/signaler/S = GetAttached(colour)
if(S)
@@ -252,7 +247,7 @@ var/const/POWER = 8
return S
/datum/wires/proc/Pulse(var/obj/item/device/assembly/signaler/S)
/datum/wires/proc/Pulse(obj/item/device/assembly/signaler/S)
for(var/colour in signallers)
if(S == signallers[colour])
@@ -264,11 +259,11 @@ var/const/POWER = 8
// Cut Wire Colour/Index procs
//
/datum/wires/proc/CutWireColour(var/colour)
/datum/wires/proc/CutWireColour(colour)
var/index = GetIndex(colour)
CutWireIndex(index)
/datum/wires/proc/CutWireIndex(var/index)
/datum/wires/proc/CutWireIndex(index)
if(IsIndexCut(index))
wires_status &= ~index
UpdateCut(index, 1)