This commit is contained in:
Chinsky
2014-03-10 18:48:12 +04:00
47 changed files with 926 additions and 515 deletions

View File

@@ -74,4 +74,26 @@ proc/age2agedescription(age)
if(45 to 60) return "middle-aged"
if(60 to 70) return "aging"
if(70 to INFINITY) return "elderly"
else return "unknown"
else return "unknown"
proc/RoundHealth(health)
switch(health)
if(100 to INFINITY)
return "health100"
if(70 to 100)
return "health80"
if(50 to 70)
return "health60"
if(30 to 50)
return "health40"
if(18 to 30)
return "health25"
if(5 to 18)
return "health10"
if(1 to 5)
return "health1"
if(-99 to 0)
return "health0"
else
return "health-100"
return "0"

View File

@@ -255,11 +255,28 @@ datum/controller/game_controller/proc/process_machines()
last_thing_processed = Machine.type
if(Machine.process() != PROCESS_KILL)
if(Machine)
if(Machine.use_power)
Machine.auto_use_power()
// if(Machine.use_power)
// Machine.auto_use_power()
i++
continue
machines.Cut(i,i+1)
i=1
while(i<=active_areas.len)
var/area/A = active_areas[i]
if(A.powerupdate)
A.powerupdate -= 1
for(var/obj/machinery/M in A)
if(M)
if(M.use_power)
M.auto_use_power()
if(A.apc.len)
i++
continue
active_areas.Cut(i,i+1)
datum/controller/game_controller/proc/process_objects()
var/i = 1

View File

@@ -499,6 +499,9 @@ datum/mind
else if(href_list["implant"])
var/mob/living/carbon/human/H = current
H.hud_updateflag |= (1 << IMPLOYAL_HUD) // updates that players HUD images so secHUD's pick up they are implanted or not.
switch(href_list["implant"])
if("remove")
for(var/obj/item/weapon/implant/loyalty/I in H.contents)
@@ -540,6 +543,8 @@ datum/mind
log_admin("[key_name_admin(usr)] has de-traitor'ed [current].")
else if (href_list["revolution"])
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
switch(href_list["revolution"])
if("clear")
if(src in ticker.mode.revolutionaries)
@@ -633,6 +638,7 @@ datum/mind
usr << "\red Reequipping revolutionary goes wrong!"
else if (href_list["cult"])
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
switch(href_list["cult"])
if("clear")
if(src in ticker.mode.cult)
@@ -682,6 +688,8 @@ datum/mind
usr << "\red Spawning amulet failed!"
else if (href_list["wizard"])
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
switch(href_list["wizard"])
if("clear")
if(src in ticker.mode.wizards)
@@ -710,6 +718,7 @@ datum/mind
usr << "\blue The objectives for wizard [key] have been generated. You can edit them and anounce manually."
else if (href_list["changeling"])
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
switch(href_list["changeling"])
if("clear")
if(src in ticker.mode.changelings)
@@ -744,6 +753,10 @@ datum/mind
domutcheck(current, null)
else if (href_list["nuclear"])
var/mob/living/carbon/human/H = current
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
switch(href_list["nuclear"])
if("clear")
if(src in ticker.mode.syndicates)
@@ -773,7 +786,6 @@ datum/mind
if("lair")
current.loc = get_turf(locate("landmark*Syndicate-Spawn"))
if("dressup")
var/mob/living/carbon/human/H = current
del(H.belt)
del(H.back)
del(H.l_ear)
@@ -800,6 +812,7 @@ datum/mind
usr << "\red No valid nuke found!"
else if (href_list["traitor"])
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
switch(href_list["traitor"])
if("clear")
if(src in ticker.mode.traitors)
@@ -882,6 +895,7 @@ datum/mind
current.radiation -= 50
else if (href_list["silicon"])
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
switch(href_list["silicon"])
if("unmalf")
if(src in ticker.mode.malf_ai)

View File

@@ -14,6 +14,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
*/
/area
var/fire = null
var/atmos = 1
@@ -31,6 +32,8 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
var/eject = null
var/debug = 0
var/powerupdate = 10 //We give everything 10 ticks to settle out it's power usage.
var/requires_power = 1
var/always_unpowered = 0 //this gets overriden to 1 for space in area/New()
@@ -43,7 +46,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
var/used_environ = 0
var/has_gravity = 1
var/list/apc = list()
var/no_air = null
var/area/master // master area used for power calcluations
// (original area before splitting due to sd_DAL)

View File

@@ -13,6 +13,8 @@
master = src //moved outside the spawn(1) to avoid runtimes in lighting.dm when it references loc.loc.master ~Carn
uid = ++global_uid
related = list(src)
active_areas += src
all_areas += src
if(type == /area) // override defaults for space. TODO: make space areas of type /area/space rather than /area
requires_power = 1
@@ -216,6 +218,7 @@
// called when power status changes
/area/proc/power_change()
master.powerupdate = 2
for(var/area/RA in related)
for(var/obj/machinery/M in RA) // for each machine in the area
M.power_change() // reverify power status (to update icons etc.)

View File

@@ -135,6 +135,7 @@
newtraitor << "\red <B>ATTENTION:</B> \black It is time to pay your debt to the Syndicate..."
newtraitor << "<B>You are now a traitor.</B>"
newtraitor.mind.special_role = "traitor"
newtraitor.hud_updateflag |= 1 << SPECIALROLE_HUD
var/obj_count = 1
newtraitor << "\blue Your current objectives:"
if(!config.objectives_disabled)

View File

@@ -208,6 +208,7 @@
if(rev_mind in revolutionaries)
revolutionaries -= rev_mind
rev_mind.special_role = null
rev_mind.current.hud_updateflag |= 1 << SPECIALROLE_HUD
if(beingborged)
rev_mind.current << "\red <FONT size = 3><B>The frame's firmware detects and deletes your neural reprogramming! You remember nothing from the moment you were flashed until now.</B></FONT>"

View File

@@ -304,4 +304,4 @@ mob/living/carbon/human/proc
else if(choice == "No!")
M << "\red You reject this traitorous cause!"
src << "\red <b>[M] does not support the revolution!</b>"
M.mind.rev_cooldown = world.time+50
M.mind.rev_cooldown = world.time+50

View File

@@ -116,6 +116,7 @@
if(config.objectives_disabled)
rev_mind.current << "<font color=blue>Within the rules,</font> try to act as an opposing force to the crew. Further RP and try to make sure other players have </i>fun<i>! If you are confused or at a loss, always adminhelp, and before taking extreme actions, please try to also contact the administration! Think through your actions and make the roleplay immersive! <b>Please remember all rules aside from those without explicit exceptions apply to antagonists.</i></b>"
update_rev_icons_added(rev_mind)
H.hud_updateflag |= 1 << SPECIALROLE_HUD
return 1
/////////////////////////////

View File

@@ -439,6 +439,10 @@ var/global/datum/controller/occupations/job_master
var/obj/item/clothing/glasses/G = H.glasses
G.prescription = 1
// H.update_icons()
H.hud_updateflag |= (1 << ID_HUD)
H.hud_updateflag |= (1 << IMPLOYAL_HUD)
H.hud_updateflag |= (1 << SPECIALROLE_HUD)
return 1

View File

@@ -181,10 +181,12 @@
return
return
/*
/obj/machinery/body_scanconsole/process() //not really used right now
if(stat & (NOPOWER|BROKEN))
return
use_power(250) // power stuff
//use_power(250) // power stuff
// var/mob/M //occupant
// if (!( src.status )) //remove this
@@ -200,6 +202,8 @@
// src.updateDialog()
// return
*/
/obj/machinery/body_scanconsole/attack_paw(user as mob)
return src.attack_hand(user)

View File

@@ -10,7 +10,7 @@
var/id
use_power = 1
idle_power_usage = 2
active_power_usage = 4
active_power_usage = 5
/obj/machinery/meter/New()
..()
@@ -30,7 +30,7 @@
icon_state = "meter0"
return 0
use_power(5)
//use_power(5)
var/datum/gas_mixture/environment = target.return_air()
if(!environment)

View File

@@ -273,7 +273,7 @@
src.locked = 0
if (!src.mess)
icon_state = "pod_0"
use_power(200)
//use_power(200)
return
return

View File

@@ -525,6 +525,8 @@ What a mess.*/
if ("Change Criminal Status")
if (active2)
for(var/mob/living/carbon/human/H in player_list)
H.hud_updateflag |= 1 << WANTED_HUD
switch(href_list["criminal2"])
if("none")
active2.fields["criminal"] = "None"

View File

@@ -14,16 +14,25 @@
var/global/max_n_of_items = 999 // Sorry but the BYOND infinite loop detector doesn't look things over 1000.
var/icon_on = "smartfridge"
var/icon_off = "smartfridge-off"
var/icon_panel = "smartfridge-panel"
var/item_quants = list()
var/ispowered = 1 //starts powered
var/isbroken = 0
var/seconds_electrified = 0;
var/shoot_inventory = 0
var/locked = 0
var/panel_open = 0 //Hacking a smartfridge
var/wires = 7
var/const/WIRE_SHOCK = 1
var/const/WIRE_SHOOTINV = 2
var/const/WIRE_SCANID = 3 //Only used by the secure smartfridge, but required by the cut, mend and pulse procs.
/obj/machinery/smartfridge/proc/accept_check(var/obj/item/O as obj)
if(istype(O,/obj/item/weapon/reagent_containers/food/snacks/grown/) || istype(O,/obj/item/seeds/))
return 1
return 0
/obj/machinery/smartfridge/seeds
name = "\improper MegaSeed Servitor"
desc = "When you need seeds fast!"
@@ -37,16 +46,46 @@
return 1
return 0
/obj/machinery/smartfridge/extract
/obj/machinery/smartfridge/secure/extract
name = "\improper Slime Extract Storage"
desc = "A refrigerated storage unit for slime extracts"
req_access_txt = "47"
/obj/machinery/smartfridge/extract/accept_check(var/obj/item/O as obj)
/obj/machinery/smartfridge/secure/extract/accept_check(var/obj/item/O as obj)
if(istype(O,/obj/item/slime_extract))
return 1
return 0
/obj/machinery/smartfridge/secure/medbay
name = "\improper Refrigerated Medicine Storage"
desc = "A refrigerated storage unit for storing medicine and chemicals."
icon_state = "smartfridge" //To fix the icon in the map editor.
icon_on = "smartfridge_chem"
req_one_access_txt = "5;33"
/obj/machinery/smartfridge/secure/medbay/accept_check(var/obj/item/O as obj)
if(istype(O,/obj/item/weapon/reagent_containers/glass/))
return 1
if(istype(O,/obj/item/weapon/storage/pill_bottle/))
return 1
if(istype(O,/obj/item/weapon/reagent_containers/pill/))
return 1
return 0
/obj/machinery/smartfridge/secure/virology
name = "\improper Refrigerated Virus Storage"
desc = "A refrigerated storage unit for storing viral material."
req_access_txt = "39"
icon_state = "smartfridge_virology"
icon_on = "smartfridge_virology"
icon_off = "smartfridge_virology-off"
/obj/machinery/smartfridge/secure/virology/accept_check(var/obj/item/O as obj)
if(istype(O,/obj/item/weapon/reagent_containers/glass/beaker/vial/))
return 1
if(istype(O,/obj/item/weapon/virusdish/))
return 1
return 0
/obj/machinery/smartfridge/chemistry
name = "\improper Smart Chemical Storage"
@@ -70,6 +109,13 @@
if(istype(O,/obj/item/weapon/reagent_containers/glass) || istype(O,/obj/item/weapon/reagent_containers/food/drinks) || istype(O,/obj/item/weapon/reagent_containers/food/condiment))
return 1
/obj/machinery/smartfridge/process()
if(!src.ispowered)
return
if(src.seconds_electrified > 0)
src.seconds_electrified--
if(src.shoot_inventory && prob(2))
src.throw_item()
/obj/machinery/smartfridge/power_change()
if( powered() )
@@ -136,6 +182,26 @@
updateUsrDialog()
/obj/machinery/smartfridge/secure/attackby(var/obj/item/O as obj, var/mob/user as mob)
if (istype(O, /obj/item/weapon/card/emag))
src.emagged = 1
user << "You short out the product lock on [src]"
return
else if(istype(O, /obj/item/weapon/screwdriver))
src.panel_open = !src.panel_open
user << "You [src.panel_open ? "open" : "close"] the maintenance panel."
src.overlays.Cut()
if(src.panel_open)
src.overlays += image(src.icon, src.icon_panel)
src.updateUsrDialog()
return
else if(istype(O, /obj/item/device/multitool)||istype(O, /obj/item/weapon/wirecutters))
if(src.panel_open)
attack_hand(user)
return
..()
return
/obj/machinery/smartfridge/attack_paw(mob/user as mob)
return src.attack_hand(user)
@@ -144,6 +210,9 @@
/obj/machinery/smartfridge/attack_hand(mob/user as mob)
user.set_machine(src)
if(src.seconds_electrified != 0)
if(src.shock(user, 100))
return
interact(user)
/*******************
@@ -176,8 +245,28 @@
dat += "<br>"
dat += "</TT>"
if(panel_open)
//One of the wires does absolutely nothing.
var/list/vendwires = list(
"Blue" = 1,
"Red" = 2,
"Black" = 3
)
dat += "<br><hr><br><B>Access Panel</B><br>"
for(var/wiredesc in vendwires)
var/is_uncut = src.wires & APCWireColorToFlag[vendwires[wiredesc]]
dat += "[wiredesc] wire: "
if(!is_uncut)
dat += "<a href='?src=\ref[src];cutwire=[vendwires[wiredesc]]'>Mend</a>"
else
dat += "<a href='?src=\ref[src];cutwire=[vendwires[wiredesc]]'>Cut</a> "
dat += "<a href='?src=\ref[src];pulsewire=[vendwires[wiredesc]]'>Pulse</a> "
dat += "<br>"
dat += "<br>"
dat += "The orange light is [(src.seconds_electrified == 0) ? "off" : "on"].<BR>"
dat += "The red light is [src.shoot_inventory ? "off" : "blinking"].<BR>"
user << browse("<HEAD><TITLE>[src] Supplies</TITLE></HEAD><TT>[dat]</TT>", "window=smartfridge")
onclose(user, "smartfridge")
return
/obj/machinery/smartfridge/Topic(href, href_list)
@@ -185,21 +274,191 @@
return
usr.set_machine(src)
var/N = href_list["vend"]
var/amount = text2num(href_list["amount"])
if ((href_list["cutwire"]) && (src.panel_open))
var/twire = text2num(href_list["cutwire"])
if (!( istype(usr.get_active_hand(), /obj/item/weapon/wirecutters) ))
usr << "You need wirecutters!"
return
if (src.isWireColorCut(twire))
src.mend(twire)
else
src.cut(twire)
else if ((href_list["pulsewire"]) && (src.panel_open))
var/twire = text2num(href_list["pulsewire"])
if (!istype(usr.get_active_hand(), /obj/item/device/multitool))
usr << "You need a multitool!"
return
if (src.isWireColorCut(twire))
usr << "You can't pulse a cut wire."
return
else
src.pulse(twire)
else if (href_list["vend"])
var/N = href_list["vend"]
var/amount = text2num(href_list["amount"])
if(item_quants[N] <= 0) // Sanity check, there are probably ways to press the button when it shouldn't be possible.
return
if(item_quants[N] <= 0) // Sanity check, there are probably ways to press the button when it shouldn't be possible.
return
item_quants[N] = max(item_quants[N] - amount, 0)
var/i = amount
for(var/obj/O in contents)
if(O.name == N)
O.loc = src.loc
i--
if(i <= 0)
break
item_quants[N] = max(item_quants[N] - amount, 0)
var/i = amount
for(var/obj/O in contents)
if(O.name == N)
O.loc = src.loc
i--
if(i <= 0)
break
src.add_fingerprint(usr)
src.updateUsrDialog()
return
/*************
* Hacking
**************/
/obj/machinery/smartfridge/proc/cut(var/wireColor)
var/wireFlag = APCWireColorToFlag[wireColor]
var/wireIndex = APCWireColorToIndex[wireColor]
src.wires &= ~wireFlag
switch(wireIndex)
if(WIRE_SHOCK)
src.seconds_electrified = -1
if (WIRE_SHOOTINV)
if(!src.shoot_inventory)
src.shoot_inventory = 1
if(WIRE_SCANID)
src.locked = 1
/obj/machinery/smartfridge/proc/mend(var/wireColor)
var/wireFlag = APCWireColorToFlag[wireColor]
var/wireIndex = APCWireColorToIndex[wireColor] //not used in this function
src.wires |= wireFlag
switch(wireIndex)
if(WIRE_SHOCK)
src.seconds_electrified = 0
if (WIRE_SHOOTINV)
src.shoot_inventory = 0
if(WIRE_SCANID)
src.locked = 0
/obj/machinery/smartfridge/proc/pulse(var/wireColor)
var/wireIndex = APCWireColorToIndex[wireColor]
switch(wireIndex)
if(WIRE_SHOCK)
src.seconds_electrified = 30
if (WIRE_SHOOTINV)
src.shoot_inventory = !src.shoot_inventory
if(WIRE_SCANID)
src.locked = -1
/obj/machinery/smartfridge/proc/isWireColorCut(var/wireColor)
var/wireFlag = APCWireColorToFlag[wireColor]
return ((src.wires & wireFlag) == 0)
/obj/machinery/smartfridge/proc/isWireCut(var/wireIndex)
var/wireFlag = APCIndexToFlag[wireIndex]
return ((src.wires & wireFlag) == 0)
/obj/machinery/smartfridge/proc/throw_item()
var/obj/throw_item = null
var/mob/living/target = locate() in view(7,src)
if(!target)
return 0
for (var/O in item_quants)
if(item_quants[O] <= 0) //Try to use a record that actually has something to dump.
continue
item_quants[O]--
for(var/obj/T in contents)
if(T.name == O)
T.loc = src.loc
throw_item = T
break
break
if(!throw_item)
return 0
spawn(0)
throw_item.throw_at(target,16,3)
src.visible_message("\red <b>[src] launches [throw_item.name] at [target.name]!</b>")
return 1
/obj/machinery/smartfridge/proc/shock(mob/user, prb)
if(!src.ispowered) // unpowered, no shock
return 0
if(!prob(prb))
return 0
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(5, 1, src)
s.start()
if (electrocute_mob(user, get_area(src), src, 0.7))
return 1
else
return 0
/************************
* Secure SmartFridges
*************************/
/obj/machinery/smartfridge/secure/Topic(href, href_list)
usr.set_machine(src)
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))))
if ((!src.allowed(usr)) && (!src.emagged) && (src.locked != -1) && href_list["vend"]) //For SECURE VENDING MACHINES YEAH
usr << "\red Access denied." //Unless emagged of course
return
..()
return
/obj/machinery/smartfridge/secure/interact(mob/user as mob)
if(!src.ispowered)
return
var/dat = "<TT><b>Select an item:</b><br>"
if (contents.len == 0)
dat += "<font color = 'red'>No product loaded!</font>"
else
for (var/O in item_quants)
if(item_quants[O] > 0)
var/N = item_quants[O]
dat += "<FONT color = 'blue'><B>[capitalize(O)]</B>:"
dat += " [N] </font>"
dat += "<a href='byond://?src=\ref[src];vend=[O];amount=1'>Vend</A> "
if(N > 5)
dat += "(<a href='byond://?src=\ref[src];vend=[O];amount=5'>x5</A>)"
if(N > 10)
dat += "(<a href='byond://?src=\ref[src];vend=[O];amount=10'>x10</A>)"
if(N > 25)
dat += "(<a href='byond://?src=\ref[src];vend=[O];amount=25'>x25</A>)"
if(N > 1)
dat += "(<a href='?src=\ref[src];vend=[O];amount=[N]'>All</A>)"
dat += "<br>"
dat += "</TT>"
if(panel_open)
var/list/vendwires = list(
"Violet" = 1,
"Orange" = 2,
"Green" = 3
)
dat += "<br><hr><br><B>Access Panel</B><br>"
for(var/wiredesc in vendwires)
var/is_uncut = src.wires & APCWireColorToFlag[vendwires[wiredesc]]
dat += "[wiredesc] wire: "
if(!is_uncut)
dat += "<a href='?src=\ref[src];cutwire=[vendwires[wiredesc]]'>Mend</a>"
else
dat += "<a href='?src=\ref[src];cutwire=[vendwires[wiredesc]]'>Cut</a> "
dat += "<a href='?src=\ref[src];pulsewire=[vendwires[wiredesc]]'>Pulse</a> "
dat += "<br>"
dat += "<br>"
dat += "The orange light is [(src.seconds_electrified == 0) ? "off" : "on"].<BR>"
//dat += "The red light is [src.shoot_inventory ? "off" : "blinking"].<BR>"
dat += "The green light is [src.locked == 1 ? "off" : "[src.locked == -1 ? "blinking" : "on"]"].<BR>"
user << browse("<HEAD><TITLE>[src] Supplies</TITLE></HEAD><TT>[dat]</TT>", "window=smartfridge")
return
//TODO: Make smartfridges hackable. - JoeyJo0

View File

@@ -75,4 +75,4 @@
..(severity)
return
power_change()
..(severity)
..(severity)

View File

@@ -67,8 +67,10 @@ Class Procs:
Checks to see if area that contains the object has power available for power
channel given in 'chan'.
use_power(amount, chan=EQUIP) 'modules/power/power.dm'
use_power(amount, chan=EQUIP, autocalled) 'modules/power/power.dm'
Deducts 'amount' from the power channel 'chan' of the area that contains the object.
If it's autocalled then everything is normal, if something else calls use_power we are going to
need to recalculate the power two ticks in a row.
power_change() 'modules/power/power.dm'
Called by the area that contains the object when ever that area under goes a
@@ -159,9 +161,9 @@ Class Procs:
if(!powered(power_channel))
return 0
if(src.use_power == 1)
use_power(idle_power_usage,power_channel)
use_power(idle_power_usage,power_channel, 1)
else if(src.use_power >= 2)
use_power(active_power_usage,power_channel)
use_power(active_power_usage,power_channel, 1)
return 1
/obj/machinery/Topic(href, href_list)
@@ -189,6 +191,10 @@ Class Procs:
return 1
src.add_fingerprint(usr)
var/area/A = get_area(src)
A.powerupdate = 1
return 0
/obj/machinery/attack_ai(mob/user as mob)
@@ -228,6 +234,10 @@ Class Procs:
return 1
src.add_fingerprint(user)
var/area/A = get_area(src)
A.powerupdate = 1
return 0
/obj/machinery/proc/RefreshParts() //Placeholder proc for machines that are built using frames.

View File

@@ -47,8 +47,11 @@
affected.implants += src.imp
imp.part = affected
H.hud_updateflag |= 1 << IMPLOYAL_HUD
src.imp = null
update()
return

View File

@@ -6,6 +6,8 @@ var/global/obj/effect/overlay/plmaster = null
var/global/obj/effect/overlay/slmaster = null
var/global/list/active_areas = list()
var/global/list/all_areas = list()
var/global/list/machines = list()
var/global/list/processing_objects = list()
var/global/list/active_diseases = list()
@@ -114,7 +116,7 @@ var/list/reg_dna = list( )
var/mouse_respawn_time = 5 //Amount of time that must pass between a player dying as a mouse and repawning as a mouse. In minutes.
var/CELLRATE = 0.002 // multiplier for watts per tick <> cell storage (eg: .002 means if there is a load of 1000 watts, 20 units will be taken from a cell per second)
var/CHARGELEVEL = 0.001 // Cap for how fast cells charge, as a percentage-per-tick (.001 means cellcharge is capped to 1% per second)
var/CHARGELEVEL = 0.0005 // Cap for how fast cells charge, as a percentage-per-tick (.001 means cellcharge is capped to 1% per second)
var/shuttle_z = 2 //default
var/airtunnel_start = 68 // default

View File

@@ -14,80 +14,25 @@
name = "Health Scanner HUD"
desc = "A heads-up display that scans the humans in view and provides accurate data about their health status."
icon_state = "healthhud"
proc
RoundHealth(health)
RoundHealth(health)
switch(health)
if(100 to INFINITY)
return "health100"
if(70 to 100)
return "health80"
if(50 to 70)
return "health60"
if(30 to 50)
return "health40"
if(18 to 30)
return "health25"
if(5 to 18)
return "health10"
if(1 to 5)
return "health1"
if(-99 to 0)
return "health0"
else
return "health-100"
return "0"
process_hud(var/mob/M)
if(!M) return
if(!M.client) return
var/client/C = M.client
var/image/holder
for(var/mob/living/carbon/human/patient in view(get_turf(M)))
if(M.see_invisible < patient.invisibility)
continue
var/foundVirus = 0
for(var/datum/disease/D in patient.viruses)
if(!D.hidden[SCANNER])
foundVirus++
for (var/ID in patient.virus2)
if (ID in virusDB)
foundVirus = 1
break
if(!C) continue
holder = patient.hud_list[HEALTH_HUD]
if(patient.stat == 2)
holder.icon_state = "hudhealth-100"
else
holder.icon_state = "hud[RoundHealth(patient.health)]"
C.images += holder
holder = patient.hud_list[STATUS_HUD]
if(patient.stat == 2)
holder.icon_state = "huddead"
else if(patient.status_flags & XENO_HOST)
holder.icon_state = "hudxeno"
else if(foundVirus)
holder.icon_state = "hudill"
else if(patient.has_brain_worms())
var/mob/living/simple_animal/borer/B = patient.has_brain_worms()
if(B.controlling)
holder.icon_state = "hudbrainworm"
else
holder.icon_state = "hudhealthy"
else
holder.icon_state = "hudhealthy"
C.images += holder
/obj/item/clothing/glasses/hud/health/process_hud(var/mob/M)
if(!M) return
if(!M.client) return
var/client/C = M.client
for(var/mob/living/carbon/human/patient in view(get_turf(M)))
if(M.see_invisible < patient.invisibility)
continue
C.images += patient.hud_list[HEALTH_HUD]
C.images += patient.hud_list[STATUS_HUD]
/obj/item/clothing/glasses/hud/security
name = "Security HUD"
desc = "A heads-up display that scans the humans in view and provides accurate data about their ID status and security records."
icon_state = "securityhud"
var/global/list/jobs[0]
/obj/item/clothing/glasses/hud/security/jensenshades
name = "Augmented shades"
@@ -98,62 +43,16 @@
invisa_view = 2
/obj/item/clothing/glasses/hud/security/process_hud(var/mob/M)
if(!M) return
if(!M.client) return
var/client/C = M.client
var/image/holder
for(var/mob/living/carbon/human/perp in view(get_turf(M)))
if(M.see_invisible < perp.invisibility)
continue
if(!C) continue
var/perpname = perp.name
holder = perp.hud_list[ID_HUD]
if(perp.wear_id)
var/obj/item/weapon/card/id/I = perp.wear_id.GetID()
if(I)
perpname = I.registered_name
holder.icon_state = "hud[ckey(I.GetJobName())]"
C.images += holder
else
perpname = perp.name
holder.icon_state = "hudunknown"
C.images += holder
else
perpname = perp.name
holder.icon_state = "hudunknown"
C.images += holder
for(var/datum/data/record/E in data_core.general)
if(E.fields["name"] == perpname)
holder = perp.hud_list[WANTED_HUD]
for (var/datum/data/record/R in data_core.security)
if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "*Arrest*"))
holder.icon_state = "hudwanted"
C.images += holder
break
else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Incarcerated"))
holder.icon_state = "hudprisoner"
C.images += holder
break
else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Parolled"))
holder.icon_state = "hudparolled"
C.images += holder
break
else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Released"))
holder.icon_state = "hudreleased"
C.images += holder
break
for(var/obj/item/weapon/implant/I in perp)
if(I.implanted)
if(istype(I,/obj/item/weapon/implant/tracking))
holder = perp.hud_list[IMPTRACK_HUD]
holder.icon_state = "hud_imp_tracking"
C.images += holder
if(istype(I,/obj/item/weapon/implant/loyalty))
holder = perp.hud_list[IMPLOYAL_HUD]
holder.icon_state = "hud_imp_loyal"
C.images += holder
if(istype(I,/obj/item/weapon/implant/chem))
holder = perp.hud_list[IMPCHEM_HUD]
holder.icon_state = "hud_imp_chem"
C.images += holder
C.images += perp.hud_list[ID_HUD]
C.images += perp.hud_list[WANTED_HUD]
C.images += perp.hud_list[IMPTRACK_HUD]
C.images += perp.hud_list[IMPLOYAL_HUD]
C.images += perp.hud_list[IMPCHEM_HUD]

View File

@@ -102,10 +102,11 @@ Works together with spawning an observer, noted above.
for(var/image/hud in client.images)
if(copytext(hud.icon_state,1,4) == "hud")
client.images.Remove(hud)
if(antagHUD)
var/list/target_list = list()
for(var/mob/living/target in oview(src))
if( target.mind&&(target.mind.special_role||issilicon(target)) )
for(var/mob/living/target in oview(src, 14))
if(target.mind&&(target.mind.special_role||issilicon(target)) )
target_list += target
if(target_list.len)
assess_targets(target_list, src)
@@ -113,91 +114,19 @@ Works together with spawning an observer, noted above.
process_medHUD(src)
// Direct copied from medical HUD glasses proc, used to determine what health bar to put over the targets head.
/mob/dead/proc/RoundHealth(var/health)
switch(health)
if(100 to INFINITY)
return "health100"
if(70 to 100)
return "health80"
if(50 to 70)
return "health60"
if(30 to 50)
return "health40"
if(18 to 30)
return "health25"
if(5 to 18)
return "health10"
if(1 to 5)
return "health1"
if(-99 to 0)
return "health0"
else
return "health-100"
return "0"
// Pretty much a direct copy of Medical HUD stuff, except will show ill if they are ill instead of also checking for known illnesses.
/mob/dead/proc/process_medHUD(var/mob/M)
var/client/C = M.client
var/image/holder
for(var/mob/living/carbon/human/patient in oview(M))
var/foundVirus = 0
if(patient.virus2.len)
foundVirus = 1
if(!C) return
holder = patient.hud_list[HEALTH_HUD]
if(patient.stat == 2)
holder.icon_state = "hudhealth-100"
else
holder.icon_state = "hud[RoundHealth(patient.health)]"
C.images += holder
holder = patient.hud_list[STATUS_HUD]
if(patient.stat == 2)
holder.icon_state = "huddead"
else if(patient.status_flags & XENO_HOST)
holder.icon_state = "hudxeno"
else if(foundVirus)
holder.icon_state = "hudill"
else if(patient.has_brain_worms())
var/mob/living/simple_animal/borer/B = patient.has_brain_worms()
if(B.controlling)
holder.icon_state = "hudbrainworm"
else
holder.icon_state = "hudhealthy"
else
holder.icon_state = "hudhealthy"
C.images += holder
/mob/dead/proc/assess_targets(list/target_list, mob/dead/observer/U)
var/icon/tempHud = 'icons/mob/hud.dmi'
for(var/mob/living/target in target_list)
if(iscarbon(target))
switch(target.mind.special_role)
if("traitor","Syndicate")
U.client.images += image(tempHud,target,"hudsyndicate")
if("Revolutionary")
U.client.images += image(tempHud,target,"hudrevolutionary")
if("Head Revolutionary")
U.client.images += image(tempHud,target,"hudheadrevolutionary")
if("Cultist")
U.client.images += image(tempHud,target,"hudcultist")
if("Changeling")
U.client.images += image(tempHud,target,"hudchangeling")
if("Wizard","Fake Wizard")
U.client.images += image(tempHud,target,"hudwizard")
if("Hunter","Sentinel","Drone","Queen")
U.client.images += image(tempHud,target,"hudalien")
if("Death Commando")
U.client.images += image(tempHud,target,"huddeathsquad")
if("Ninja")
U.client.images += image(tempHud,target,"hudninja")
else//If we don't know what role they have but they have one.
U.client.images += image(tempHud,target,"hudunknown1")
/mob/dead/proc/process_medHUD(var/mob/M)
var/client/C = M.client
for(var/mob/living/carbon/human/patient in oview(M, 14))
C.images += patient.hud_list[HEALTH_HUD]
C.images += patient.hud_list[STATUS_HUD_OOC]
/mob/dead/proc/assess_targets(list/target_list, mob/dead/observer/U)
var/client/C = U.client
for(var/mob/living/carbon/human/target in target_list)
C.images += target.hud_list[SPECIALROLE_HUD]
/*
else//If the silicon mob has no law datum, no inherent laws, or a law zero, add them to the hud.
var/mob/living/silicon/silicon_target = target
if(!silicon_target.laws||(silicon_target.laws&&(silicon_target.laws.zeroth||!silicon_target.laws.inherent.len))||silicon_target.mind.special_role=="traitor")
@@ -205,8 +134,9 @@ Works together with spawning an observer, noted above.
U.client.images += image(tempHud,silicon_target,"hudmalborg")
else
U.client.images += image(tempHud,silicon_target,"hudmalai")
return 1
*/
return 1
/mob/proc/ghostize(var/can_reenter_corpse = 1)
if(key)
var/mob/dead/observer/ghost = new(src) //Transfer safety to observer spawning proc.

View File

@@ -4,7 +4,7 @@
voice_name = "unknown"
icon = 'icons/mob/human.dmi'
icon_state = "body_m_s"
var/list/hud_list = list()
var/list/hud_list[9]
var/datum/species/species //Contains icon generation and language information, set during New().
var/embedded_flag //To check if we've need to roll for damage on movement while an item is imbedded in us.
@@ -54,8 +54,16 @@
dna = new /datum/dna(null)
dna.species=species.name
for(var/i=0;i<7;i++) // 2 for medHUDs and 5 for secHUDs
hud_list += image('icons/mob/hud.dmi', src, "hudunknown")
hud_list[HEALTH_HUD] = image('icons/mob/hud.dmi', src, "hudhealth100")
hud_list[STATUS_HUD] = image('icons/mob/hud.dmi', src, "hudhealthy")
hud_list[ID_HUD] = image('icons/mob/hud.dmi', src, "hudunknown")
hud_list[WANTED_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[IMPLOYAL_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[IMPCHEM_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[IMPTRACK_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[SPECIALROLE_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[STATUS_HUD_OOC] = image('icons/mob/hud.dmi', src, "hudhealthy")
..()
@@ -553,6 +561,7 @@
modified = 1
spawn()
hud_updateflag |= 1 << WANTED_HUD
if(istype(usr,/mob/living/carbon/human))
var/mob/living/carbon/human/U = usr
U.handle_regular_hud_updates()

View File

@@ -47,6 +47,7 @@
take_overall_damage(amount, 0)
else
heal_overall_damage(-amount, 0)
hud_updateflag |= 1 << HEALTH_HUD
/mob/living/carbon/human/adjustFireLoss(var/amount)
if(species && species.burn_mod)
@@ -56,6 +57,7 @@
take_overall_damage(0, amount)
else
heal_overall_damage(0, -amount)
hud_updateflag |= 1 << HEALTH_HUD
/mob/living/carbon/human/Stun(amount)
if(HULK in mutations) return
@@ -97,6 +99,8 @@
if (O.status & ORGAN_MUTATED)
O.unmutate()
src << "<span class = 'notice'>Your [O.display_name] is shaped normally again.</span>"
hud_updateflag |= 1 << HEALTH_HUD
////////////////////////////////////////////
//Returns a list of damaged organs
@@ -124,6 +128,7 @@
var/datum/organ/external/picked = pick(parts)
if(picked.heal_damage(brute,burn))
UpdateDamageIcon()
hud_updateflag |= 1 << HEALTH_HUD
updatehealth()
//Damages ONE external organ, organ gets randomly selected from damagable ones.
@@ -135,6 +140,7 @@
var/datum/organ/external/picked = pick(parts)
if(picked.take_damage(brute,burn,sharp))
UpdateDamageIcon()
hud_updateflag |= 1 << HEALTH_HUD
updatehealth()
@@ -156,6 +162,7 @@
parts -= picked
updatehealth()
hud_updateflag |= 1 << HEALTH_HUD
if(update) UpdateDamageIcon()
// damage MANY external organs, in random order
@@ -175,6 +182,7 @@
parts -= picked
updatehealth()
hud_updateflag |= 1 << HEALTH_HUD
if(update) UpdateDamageIcon()
@@ -200,6 +208,7 @@ This function restores all organs.
if(istype(E, /datum/organ/external))
if (E.heal_damage(brute, burn))
UpdateDamageIcon()
hud_updateflag |= 1 << HEALTH_HUD
else
return 0
return
@@ -243,6 +252,7 @@ This function restores all organs.
// Will set our damageoverlay icon to the next level, which will then be set back to the normal level the next mob.Life().
updatehealth()
hud_updateflag |= 1 << HEALTH_HUD
//Embedded projectile code.
if(!organ) return

View File

@@ -63,6 +63,9 @@
in_stasis = istype(loc, /obj/structure/closet/body_bag/cryobag) && loc:opened == 0
if(in_stasis) loc:used++
if(life_tick%30==15)
hud_updateflag = 1022
//No need to update all of these procs if the guy is dead.
if(stat != DEAD && !in_stasis)
if(air_master.current_cycle%4==2 || failed_last_breath) //First, resolve location and get a breath
@@ -1125,6 +1128,10 @@
proc/handle_regular_hud_updates()
if(!client) return 0
if(hud_updateflag)
handle_hud_list()
for(var/image/hud in client.images)
if(copytext(hud.icon_state,1,4) == "hud") //ugly, but icon comparison is worse, I believe
client.images.Remove(hud)
@@ -1544,6 +1551,148 @@
return temp
/*
Called by life(), instead of having the individual hud items update icons each tick and check for status changes
we only set those statuses and icons upon changes. Then those HUD items will simply add those pre-made images.
This proc below is only called when those HUD elements need to change as determined by the mobs hud_updateflag.
*/
/mob/living/carbon/human/proc/handle_hud_list()
if(hud_updateflag & 1 << HEALTH_HUD)
var/image/holder = hud_list[HEALTH_HUD]
if(stat == 2)
holder.icon_state = "hudhealth-100" // X_X
else
holder.icon_state = "hud[RoundHealth(health)]"
hud_list[HEALTH_HUD] = holder
if(hud_updateflag & 1 << STATUS_HUD)
var/foundVirus = 0
for(var/datum/disease/D in viruses)
if(!D.hidden[SCANNER])
foundVirus++
for (var/ID in virus2)
if (ID in virusDB)
foundVirus = 1
break
var/image/holder = hud_list[STATUS_HUD]
var/image/holder2 = hud_list[STATUS_HUD_OOC]
if(stat == 2)
holder.icon_state = "huddead"
holder2.icon_state = "huddead"
else if(status_flags & XENO_HOST)
holder.icon_state = "hudxeno"
holder2.icon_state = "hudxeno"
else if(foundVirus)
holder.icon_state = "hudill"
else if(has_brain_worms())
var/mob/living/simple_animal/borer/B = has_brain_worms()
if(B.controlling)
holder.icon_state = "hudbrainworm"
else
holder.icon_state = "hudhealthy"
holder2.icon_state = "hudbrainworm"
else
holder.icon_state = "hudhealthy"
if(virus2.len)
holder2.icon_state = "hudill"
else
holder2.icon_state = "hudhealthy"
hud_list[STATUS_HUD] = holder
hud_list[STATUS_HUD_OOC] = holder2
if(hud_updateflag & 1 << ID_HUD)
var/image/holder = hud_list[ID_HUD]
if(wear_id)
var/obj/item/weapon/card/id/I = wear_id.GetID()
if(I)
holder.icon_state = "hud[ckey(I.GetJobName())]"
else
holder.icon_state = "hudunknown"
else
holder.icon_state = "hudunknown"
hud_list[ID_HUD] = holder
if(hud_updateflag & 1 << WANTED_HUD)
var/image/holder = hud_list[WANTED_HUD]
holder.icon_state = "hudblank"
var/perpname = name
if(wear_id)
var/obj/item/weapon/card/id/I = wear_id.GetID()
if(I)
perpname = I.registered_name
for(var/datum/data/record/E in data_core.general)
if(E.fields["name"] == perpname)
for (var/datum/data/record/R in data_core.security)
if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "*Arrest*"))
holder.icon_state = "hudwanted"
break
else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Incarcerated"))
holder.icon_state = "hudprisoner"
break
else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Parolled"))
holder.icon_state = "hudparolled"
break
else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Released"))
holder.icon_state = "hudreleased"
break
hud_list[WANTED_HUD] = holder
if(hud_updateflag & 1 << IMPLOYAL_HUD || hud_updateflag & 1 << IMPCHEM_HUD || hud_updateflag & 1 << IMPTRACK_HUD)
var/image/holder1 = hud_list[IMPTRACK_HUD]
var/image/holder2 = hud_list[IMPLOYAL_HUD]
var/image/holder3 = hud_list[IMPCHEM_HUD]
holder1.icon_state = "hudblank"
holder2.icon_state = "hudblank"
holder3.icon_state = "hudblank"
for(var/obj/item/weapon/implant/I in src)
if(I.implanted)
if(istype(I,/obj/item/weapon/implant/tracking))
holder1.icon_state = "hud_imp_tracking"
if(istype(I,/obj/item/weapon/implant/loyalty))
holder2.icon_state = "hud_imp_loyal"
if(istype(I,/obj/item/weapon/implant/chem))
holder3.icon_state = "hud_imp_chem"
hud_list[IMPTRACK_HUD] = holder1
hud_list[IMPLOYAL_HUD] = holder2
hud_list[IMPCHEM_HUD] = holder3
if(hud_updateflag & 1 << SPECIALROLE_HUD)
var/image/holder = hud_list[SPECIALROLE_HUD]
holder.icon_state = "hudblank"
switch(mind.special_role)
if("traitor","Syndicate")
holder.icon_state = "hudsyndicate"
if("Revolutionary")
holder.icon_state = "hudrevolutionary"
if("Head Revolutionary")
holder.icon_state = "hudheadrevolutionary"
if("Cultist")
holder.icon_state = "hudcultist"
if("Changeling")
holder.icon_state = "hudchangeling"
if("Wizard","Fake Wizard")
holder.icon_state = "hudwizard"
if("Death Commando")
holder.icon_state = "huddeathsquad"
if("Ninja")
holder.icon_state = "hudninja"
hud_list[SPECIALROLE_HUD] = holder
hud_updateflag = 0
#undef HUMAN_MAX_OXYLOSS
#undef HUMAN_CRIT_MAX_OXYLOSS

View File

@@ -516,6 +516,10 @@ proc/get_damage_icon_part(damage_state, body_part)
overlays_standing[ID_LAYER] = null
else
overlays_standing[ID_LAYER] = null
hud_updateflag |= 1 << ID_HUD
hud_updateflag |= 1 << WANTED_HUD
if(update_icons) update_icons()
/mob/living/carbon/human/update_inv_gloves(var/update_icons=1)

View File

@@ -264,6 +264,8 @@
if (C.legcuffed && !initial(C.legcuffed))
C.drop_from_inventory(C.legcuffed)
C.legcuffed = initial(C.legcuffed)
hud_updateflag |= 1 << HEALTH_HUD
hud_updateflag |= 1 << STATUS_HUD
/mob/living/proc/rejuvenate()
@@ -310,7 +312,9 @@
// make the icons look correct
regenerate_icons()
hud_updateflag |= 1 << HEALTH_HUD
hud_updateflag |= 1 << STATUS_HUD
return
/mob/living/proc/UpdateDamageIcon()

View File

@@ -5,6 +5,8 @@
var/maxHealth = 100 //Maximum health that should be possible.
var/health = 100 //A mob's health
var/hud_updateflag = 0
//Damage related vars, NOTE: THESE SHOULD ONLY BE MODIFIED BY PROCS
var/bruteloss = 0.0 //Brutal damage caused by brute force (punching, being clubbed by a toolbox ect... this also accounts for pressure damage)
var/oxyloss = 0.0 //Oxygen depravation damage (no air in lungs)
@@ -35,4 +37,4 @@
var/tod = null // Time of death
var/update_slimes = 1
var/silent = null //Can't talk. Value goes down every life proc.
var/silent = null //Can't talk. Value goes down every life proc.

View File

@@ -115,6 +115,17 @@ var/list/ai_list = list()
src << "<b>These laws may be changed by other players, or by you being the traitor.</b>"
job = "AI"
hud_list[HEALTH_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[STATUS_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[ID_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[WANTED_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[IMPLOYAL_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[IMPCHEM_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[IMPTRACK_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[SPECIALROLE_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
ai_list += src
..()
return

View File

@@ -126,6 +126,18 @@
var/datum/robot_component/cell_component = components["power cell"]
cell_component.wrapped = cell
cell_component.installed = 1
hud_list[HEALTH_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[STATUS_HUD] = image('icons/mob/hud.dmi', src, "hudhealth100")
hud_list[ID_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[WANTED_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[IMPLOYAL_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[IMPCHEM_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[IMPTRACK_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[SPECIALROLE_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
playsound(loc, 'sound/voice/liveagain.ogg', 75, 1)

View File

@@ -7,7 +7,7 @@
var/list/alarms_to_show = list()
var/list/alarms_to_clear = list()
immune_to_ssd = 1
var/list/hud_list[9]
var/list/alarm_types_show = list("Motion" = 0, "Fire" = 0, "Atmosphere" = 0, "Power" = 0, "Camera" = 0)
var/list/alarm_types_clear = list("Motion" = 0, "Fire" = 0, "Atmosphere" = 0, "Power" = 0, "Camera" = 0)
@@ -191,4 +191,4 @@
dat += data_core.get_manifest(1) // make it monochrome
dat += "<br>"
src << browse(dat, "window=airoster")
onclose(src, "airoster")
onclose(src, "airoster")

View File

@@ -53,7 +53,7 @@
var/areastring = null
var/obj/item/weapon/cell/cell
var/start_charge = 90 // initial cell charge %
var/cell_type = 2500 // 0=no cell, 1=regular, 2=high-cap (x5) <- old, now it's just 0=no cell, otherwise dictate cellcapacity by changing this value. 1 used to be 1000, 2 was 2500
var/cell_type = 5000 // 0=no cell, 1=regular, 2=high-cap (x5) <- old, now it's just 0=no cell, otherwise dictate cellcapacity by changing this value. 1 used to be 1000, 2 was 2500
var/opened = 0 //0=closed, 1=opened, 2=cover removed
var/shorted = 0
var/lighting = 3
@@ -78,6 +78,8 @@
powernet = 0 // set so that APCs aren't found as powernet nodes //Hackish, Horrible, was like this before I changed it :(
var/malfhack = 0 //New var for my changes to AI malf. --NeoFite
var/mob/living/silicon/ai/malfai = null //See above --NeoFite
var/debug= 0
var/autoflag= 0 // 0 = off, 1= eqp and lights off, 2 = eqp off, 3 = all on.
// luminosity = 1
var/has_electronics = 0 // 0 - none, 1 - plugged in, 2 - secured by screwdriver
var/overload = 1 //used for the Blackout malf module
@@ -142,6 +144,7 @@
init()
else
area = src.loc.loc:master
area.apc |= src
opened = 1
operating = 0
name = "[area.name] APC"
@@ -168,6 +171,7 @@
cell.charge = start_charge * cell.maxcharge / 100.0 // (convert percentage to actual value)
var/area/A = src.loc.loc
//if area isn't specified use current
if(isarea(A) && src.areastring == null)
@@ -176,6 +180,7 @@
else
src.area = get_area_name(areastring)
name = "\improper [area.name] APC"
area.apc |= src
update_icon()
make_terminal()
@@ -918,6 +923,7 @@
if(user.lying)
user << "\red You must stand to use this [src]!"
return 0
autoflag = 5
if (istype(user, /mob/living/silicon))
var/mob/living/silicon/ai/AI = user
var/mob/living/silicon/robot/robot = user
@@ -1153,20 +1159,11 @@
return
/*
if (equipment > 1) // off=0, off auto=1, on=2, on auto=3
use_power(src.equip_consumption, EQUIP)
if (lighting > 1) // off=0, off auto=1, on=2, on auto=3
use_power(src.light_consumption, LIGHT)
if (environ > 1) // off=0, off auto=1, on=2, on auto=3
use_power(src.environ_consumption, ENVIRON)
area.calc_lighting() */
lastused_light = area.usage(LIGHT)
lastused_equip = area.usage(EQUIP)
lastused_environ = area.usage(ENVIRON)
area.clear_usage()
if(area.powerupdate)
area.clear_usage()
lastused_total = lastused_light + lastused_equip + lastused_environ
@@ -1190,13 +1187,15 @@
perapc = terminal.powernet.perapc
//if(debug)
// world.log << "Status: [main_status] - Excess: [excess] - Last Equip: [lastused_equip] - Last Light: [lastused_light] - Longterm: [longtermpower]"
//world << "Status: [main_status] - Excess: [excess] - Last Equip: [lastused_equip] - Last Light: [lastused_light]"
if(cell && !shorted)
var/cell_charge = cell.charge
var/cell_maxcharge = cell.maxcharge
// draw power from cell as before
var/cellused = min(cell.charge, CELLRATE * lastused_total) // clamp deduction to a max, amount left in cell
var/cellused = min(cell_charge, CELLRATE * lastused_total) // clamp deduction to a max, amount left in cell
cell.use(cellused)
if(excess > 0 || perapc > lastused_total) // if power excess, or enough anyway, recharge the cell
@@ -1207,19 +1206,21 @@
else // no excess, and not enough per-apc
if( (cell.charge/CELLRATE+perapc) >= lastused_total) // can we draw enough from cell+grid to cover last usage?
if( (cell_charge/CELLRATE+perapc) >= lastused_total) // can we draw enough from cell+grid to cover last usage?
cell.charge = min(cell.maxcharge, cell.charge + CELLRATE * perapc) //recharge with what we can
cell_charge = min(cell_maxcharge, cell_charge + CELLRATE * perapc) //recharge with what we can
cell.charge = cell_charge
add_load(perapc) // so draw what we can from the grid
charging = 0
else // not enough power available to run the last tick!
else if (autoflag != 0) // not enough power available to run the last tick!
charging = 0
chargecount = 0
// This turns everything off in the case that there is still a charge left on the battery, just not enough to run the room.
equipment = autoset(equipment, 0)
lighting = autoset(lighting, 0)
environ = autoset(environ, 0)
autoflag = 0
// set channels depending on how much charge we have left
@@ -1230,39 +1231,44 @@
else if(longtermpower > -10)
longtermpower -= 2
if(cell.charge <= 0) // zero charge, turn all off
equipment = autoset(equipment, 0)
lighting = autoset(lighting, 0)
environ = autoset(environ, 0)
area.poweralert(0, src)
else if(cell.percent() < 15 && longtermpower < 0) // <15%, turn off lighting & equipment
equipment = autoset(equipment, 2)
lighting = autoset(lighting, 2)
environ = autoset(environ, 1)
area.poweralert(0, src)
else if(cell.percent() < 30 && longtermpower < 0) // <30%, turn off equipment
equipment = autoset(equipment, 2)
lighting = autoset(lighting, 1)
environ = autoset(environ, 1)
area.poweralert(0, src)
else // otherwise all can be on
equipment = autoset(equipment, 1)
lighting = autoset(lighting, 1)
environ = autoset(environ, 1)
area.poweralert(1, src)
if(cell.percent() > 75)
if(cell_charge >= 1250 || longtermpower > 0) // Put most likely at the top so we don't check it last, effeciency 101
if(autoflag != 3)
equipment = autoset(equipment, 1)
lighting = autoset(lighting, 1)
environ = autoset(environ, 1)
autoflag = 3
area.poweralert(1, src)
if(cell_charge >= 4000)
area.poweralert(1, src)
else if(cell_charge < 1250 && longtermpower < 0) // <30%, turn off equipment
if(autoflag != 2)
equipment = autoset(equipment, 2)
lighting = autoset(lighting, 1)
environ = autoset(environ, 1)
area.poweralert(0, src)
autoflag = 2
else if(cell_charge < 750 && longtermpower < 0) // <15%, turn off lighting & equipment
if(autoflag != 1)
equipment = autoset(equipment, 2)
lighting = autoset(lighting, 2)
environ = autoset(environ, 1)
area.poweralert(0, src)
autoflag = 1
else if(cell_charge <= 0) // zero charge, turn all off
if(autoflag != 0)
equipment = autoset(equipment, 0)
lighting = autoset(lighting, 0)
environ = autoset(environ, 0)
area.poweralert(0, src)
autoflag = 0
// now trickle-charge the cell
if(chargemode && charging == 1 && operating)
if(excess > 0) // check to make sure we have enough to charge
// Max charge is perapc share, capped to cell capacity, or % per second constant (Whichever is smallest)
/* var/ch = min(perapc, (cell.maxcharge - cell.charge), (cell.maxcharge*CHARGELEVEL))
add_load(ch) // Removes the power we're taking from the grid
cell.give(ch) // actually recharge the cell
*/
var/ch = min(perapc*CELLRATE, (cell.maxcharge - cell.charge), (cell.maxcharge*CHARGELEVEL))
var/ch = min(perapc*CELLRATE, (cell_maxcharge - cell_charge), (cell_maxcharge*CHARGELEVEL))
add_load(ch/CELLRATE) // Removes the power we're taking from the grid
cell.give(ch) // actually recharge the cell
@@ -1272,12 +1278,12 @@
// show cell as fully charged if so
if(cell.charge >= cell.maxcharge)
if(cell.charge >= cell_maxcharge)
charging = 2
if(chargemode)
if(!charging)
if(excess > cell.maxcharge*CHARGELEVEL)
if(excess > cell_maxcharge*CHARGELEVEL)
chargecount++
else
chargecount = 0
@@ -1299,6 +1305,8 @@
lighting = autoset(lighting, 0)
environ = autoset(environ, 0)
area.poweralert(0, src)
autoflag = 0
// update icon & area power if anything changed

View File

@@ -603,9 +603,11 @@
#define LIGHTING_POWER_FACTOR 20 //20W per unit luminosity
/*
/obj/machinery/light/process()//TODO: remove/add this from machines to save on processing as needed ~Carn PRIORITY
if(on)
use_power(luminosity * LIGHTING_POWER_FACTOR, LIGHT)
*/
// called when area power state changes
/obj/machinery/light/power_change()

View File

@@ -54,13 +54,15 @@
// increment the power usage stats for an area
/obj/machinery/proc/use_power(var/amount, var/chan = -1) // defaults to power_channel
/obj/machinery/proc/use_power(var/amount, var/chan = -1, var/autocalled = 0) // defaults to power_channel
var/area/A = src.loc.loc // make sure it's in an area
if(!A || !isarea(A) || !A.master)
return
if(chan == -1)
chan = power_channel
A.master.use_power(amount, chan)
if(!autocalled)
A.master.powerupdate = 2 // Decremented by 2 each GC tick, since it's not auto power change we're going to update power twice.
/obj/machinery/proc/power_change() // called whenever the power settings of the containing area change
// by default, check equipment channel & set flag

View File

@@ -370,7 +370,7 @@ var/list/solars_list = list()
if(stat & (NOPOWER | BROKEN))
return
use_power(250)
//use_power(250)
if(track==1 && nexttime < world.time && trackdir*trackrate)
// Increments nexttime using itself and not world.time to prevent drift
nexttime = nexttime + 6000/trackrate

View File

@@ -37,7 +37,8 @@
/mob/living/simple_animal/cow,
/mob/living/simple_animal/hostile/retaliate/goat,
/obj/machinery/computer/centrifuge,
/obj/machinery/sleeper )
/obj/machinery/sleeper,
/obj/machinery/smartfridge/ )
New()
..()

View File

@@ -22,6 +22,8 @@
var/flush_every_ticks = 30 //Every 30 ticks it will look whether it is ready to flush
var/flush_count = 0 //this var adds 1 once per tick. When it reaches flush_every_ticks it resets and tries to flush.
var/last_sound = 0
active_power_usage = 600
idle_power_usage = 100
// create a new disposal
// find the attached trunk (if present) and init gas resvr.
@@ -340,6 +342,7 @@
// timed process
// charge the gas reservoir and perform flush if ready
process()
use_power = 0
if(stat & BROKEN) // nothing can happen if broken
return
@@ -363,13 +366,13 @@
if(stat & NOPOWER) // won't charge if no power
return
use_power(100) // base power usage
use_power = 1
if(mode != 1) // if off or ready, no need to charge
return
// otherwise charge
use_power(500) // charging power usage
use_power = 2
var/atom/L = loc // recharging from loc turf

View File

@@ -182,6 +182,8 @@
"\blue You take [obj] out of incision on [target]'s [affected.display_name]s with \the [tool]." )
affected.implants -= obj
target.hud_updateflag |= 1 << IMPLOYAL_HUD
//Handle possessive brain borers.
if(istype(obj,/mob/living/simple_animal/borer))
var/mob/living/simple_animal/borer/worm = obj

View File

@@ -28,7 +28,8 @@
/obj/machinery/disease2/diseaseanalyser/process()
if(stat & (NOPOWER|BROKEN))
return
use_power(500)
//use_power(500)
if(scanning)
scanning -= 1
@@ -59,4 +60,4 @@
dish = null
src.state("\The [src.name] buzzes")
pause = 0
return
return

View File

@@ -72,7 +72,7 @@
if(stat & (NOPOWER|BROKEN))
return
use_power(500)
//use_power(500)
if(curing)
curing -= 1
@@ -151,4 +151,4 @@
var/obj/item/weapon/virusdish/dish = new/obj/item/weapon/virusdish(src.loc)
dish.virus2 = virus2
state("\The [src.name] pings", "blue")
state("\The [src.name] pings", "blue")

View File

@@ -79,6 +79,7 @@
for(var/datum/disease2/effectholder/e in effects)
e.effect.deactivate(mob)
mob.virus2.Remove("[uniqueID]")
mob.hud_updateflag |= 1 << STATUS_HUD
/datum/disease2/disease/proc/minormutate()
//uniqueID = rand(0,10000)
@@ -175,6 +176,7 @@ proc/virus2_lesser_infection()
for(var/mob/living/carbon/human/G in player_list)
if(G.client && G.stat != DEAD)
candidates += G
if(!candidates.len) return
candidates = shuffle(candidates)

View File

@@ -7,7 +7,7 @@
var/analysed = 0
var/obj/item/weapon/virusdish/dish = null
var/burning = 0
var/splicing = 0
var/scanning = 0
@@ -90,7 +90,7 @@
/obj/machinery/computer/diseasesplicer/process()
if(stat & (NOPOWER|BROKEN))
return
use_power(500)
//use_power(500)
if(scanning)
scanning -= 1

View File

@@ -80,6 +80,7 @@ proc/airborne_can_reach(turf/source, turf/target)
D.minormutate()
// log_debug("Adding virus")
M.virus2["[D.uniqueID]"] = D
M.hud_updateflag |= 1 << STATUS_HUD
//Infects mob M with random lesser disease, if he doesn't have one
/proc/infect_mob_random_lesser(var/mob/living/carbon/M)
@@ -87,12 +88,14 @@ proc/airborne_can_reach(turf/source, turf/target)
D.makerandom()
D.infectionchance = 1
M.virus2["[D.uniqueID]"] = D
M.hud_updateflag |= 1 << STATUS_HUD
//Infects mob M with random greated disease, if he doesn't have one
/proc/infect_mob_random_greater(var/mob/living/carbon/M)
var/datum/disease2/disease/D = new /datum/disease2/disease
D.makerandom(1)
M.virus2["[D.uniqueID]"] = D
M.hud_updateflag |= 1 << STATUS_HUD
//Fancy prob() function.
/proc/dprob(var/p)
@@ -138,4 +141,4 @@ proc/airborne_can_reach(turf/source, turf/target)
for (var/ID in victim.virus2)
var/datum/disease2/disease/V = victim.virus2[ID]
if(V && V.spreadtype != vector) continue
infect_virus2(src,V)
infect_virus2(src,V)

View File

@@ -691,13 +691,15 @@ var/list/be_special_flags = list(
#define RIGHT 2
// for secHUDs and medHUDs and variants. The number is the location of the image on the list hud_list of humans.
#define HEALTH_HUD 1 // dead, alive, sick, health status
#define STATUS_HUD 2 // a simple line rounding the mob's number health
#define HEALTH_HUD 1 // a simple line rounding the mob's number health
#define STATUS_HUD 2 // alive, dead, diseased, etc.
#define ID_HUD 3 // the job asigned to your ID
#define WANTED_HUD 4 // wanted, released, parroled, security status
#define IMPLOYAL_HUD 5 // loyality implant
#define IMPLOYAL_HUD 5 // loyality implant
#define IMPCHEM_HUD 6 // chemical implant
#define IMPTRACK_HUD 7 // tracking implant
#define IMPTRACK_HUD 7 // tracking implant
#define SPECIALROLE_HUD 8 // AntagHUD image
#define STATUS_HUD_OOC 9 // STATUS_HUD without virus db check for someone being ill.
//Pulse levels, very simplified
#define PULSE_NONE 0 //so !M.pulse checks would be possible
@@ -758,4 +760,4 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse
#define COLOR_PINK "#FF00FF"
#define COLOR_YELLOW "#FFFF00"
#define COLOR_ORANGE "#FF9900"
#define COLOR_WHITE "#FFFFFF"
#define COLOR_WHITE "#FFFFFF"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 KiB

After

Width:  |  Height:  |  Size: 310 KiB

File diff suppressed because it is too large Load Diff