Dev-freeze into dev merge.

This commit is contained in:
Zuhayr
2015-05-30 00:31:12 +09:30
56 changed files with 1727 additions and 858 deletions
+1 -1
View File
@@ -778,7 +778,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(confirm != "Yes") return
var/choice
if(ticker.mode.name == "revolution" || ticker.mode.name == "AI malfunction" || ticker.mode.name == "confliction")
if(ticker.mode.name == "revolution" || ticker.mode.name == "confliction")
choice = input("The shuttle will just return if you call it. Call anyway?") in list("Confirm", "Cancel")
if(choice == "Confirm")
emergency_shuttle.auto_recall = 1 //enable auto-recall
@@ -12,7 +12,7 @@
name = "mounted grenade launcher"
desc = "A shoulder-mounted micro-explosive dispenser."
selectable = 1
icon_state = "grenade_launcher"
icon_state = "grenadelauncher"
interface_name = "integrated grenade launcher"
interface_desc = "Discharges loaded grenades against the wearer's location."
@@ -10,7 +10,7 @@
name = "active camouflage module"
desc = "A robust hardsuit-integrated stealth module."
icon_state = "stealth"
icon_state = "cloak"
toggleable = 1
disruptable = 1
@@ -202,13 +202,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
statpanel("Status")
if (client.statpanel == "Status")
stat(null, "Station Time: [worldtime2text()]")
if(ticker)
if(ticker.mode)
//world << "DEBUG: ticker not null"
if(ticker.mode.name == "AI malfunction")
//world << "DEBUG: malf mode ticker test"
if(malf.revealed)
stat(null, "Time left: [max(malf.hack_time/(malf.hacked_apcs.len/3), 0)]")
if(emergency_shuttle)
var/eta_status = emergency_shuttle.get_status_panel_eta()
if(eta_status)
+1
View File
@@ -8,6 +8,7 @@
icon = 'icons/mob/eye.dmi'
icon_state = "default-eye"
alpha = 127
density = 0
var/sprint = 10
var/cooldown = 0
@@ -54,9 +54,6 @@
stat(null, "Intent: [a_intent]")
stat(null, "Move Mode: [m_intent]")
if(ticker && ticker.mode && ticker.mode.name == "AI malfunction")
if(malf.revealed)
stat(null, "Time left: [max(malf.hack_time/(malf.hacked_apcs/3), 0)]")
if(emergency_shuttle)
var/eta_status = emergency_shuttle.get_status_panel_eta()
if(eta_status)
@@ -236,7 +236,7 @@
/mob/living/carbon/human/proc/get_damageable_organs()
var/list/obj/item/organ/external/parts = list()
for(var/obj/item/organ/external/O in organs)
if(O.brute_dam + O.burn_dam < O.max_damage)
if(O.is_damageable())
parts += O
return parts
@@ -118,8 +118,12 @@
else if(E.is_malfunctioning())
if(E.body_part == HAND_LEFT)
if(!l_hand)
continue
drop_from_inventory(l_hand)
else
if(!r_hand)
continue
drop_from_inventory(r_hand)
emote("me", 1, "drops what they were holding, their [E.name] malfunctioning!")
+177 -46
View File
@@ -56,26 +56,30 @@ var/list/ai_verbs_default = list(
var/obj/item/device/multitool/aiMulti = null
var/obj/item/device/radio/headset/heads/ai_integrated/aiRadio = null
var/custom_sprite = 0 //For our custom sprites
//Hud stuff
//MALFUNCTION
var/datum/AI_Module/module_picker/malf_picker
var/processing_time = 100
var/list/datum/AI_Module/current_modules = list()
var/fire_res_on_core = 0
var/control_disabled = 0 // Set to 1 to stop AI from interacting via Click() -- TLE
var/malfhacking = 0 // More or less a copy of the above var, so that malf AIs can hack and still get new cyborgs -- NeoFite
var/obj/machinery/power/apc/malfhack = null
var/explosive = 0 //does the AI explode when it dies?
var/mob/living/silicon/ai/parent = null
var/camera_light_on = 0 //Defines if the AI toggled the light on the camera it's looking through.
var/datum/trackable/track = null
var/last_announcement = ""
var/control_disabled = 0
var/datum/announcement/priority/announcement
var/obj/machinery/ai_powersupply/psupply = null // Backwards reference to AI's powersupply object.
//NEWMALF VARIABLES
var/malfunctioning = 0 // Master var that determines if AI is malfunctioning.
var/datum/malf_hardware/hardware = null // Installed piece of hardware.
var/datum/malf_research/research = null // Malfunction research datum.
var/obj/machinery/power/apc/hack = null // APC that is currently being hacked.
var/list/hacked_apcs = null // List of all hacked APCs
var/APU_power = 0 // If set to 1 AI runs on APU power
var/hacking = 0 // Set to 1 if AI is hacking APC, cyborg, other AI, or running system override.
var/system_override = 0 // Set to 1 if system override is initiated, 2 if succeeded.
var/hack_can_fail = 1 // If 0, all abilities have zero chance of failing.
var/hack_fails = 0 // This increments with each failed hack, and determines the warning message text.
var/errored = 0 // Set to 1 if runtime error occurs. Only way of this happening i can think of is admin fucking up with varedit.
var/bombing_core = 0 // Set to 1 if core auto-destruct is activated
var/bombing_station = 0 // Set to 1 if station nuke auto-destruct is activated
var/override_CPUStorage = 0 // Bonus/Penalty CPU Storage. For use by admins/testers.
var/override_CPURate = 0 // Bonus/Penalty CPU generation rate. For use by admins/testers.
/mob/living/silicon/ai/proc/add_ai_verbs()
src.verbs |= ai_verbs_default
@@ -203,17 +207,6 @@ var/list/ai_verbs_default = list(
set src = usr.contents
return 0
/mob/living/silicon/ai/proc/system_integrity()
return (health-config.health_threshold_dead)/2
// this function shows the health of the pAI in the Status panel
/mob/living/silicon/ai/show_system_integrity()
// An AI doesn't become inoperable until -100% (or whatever config.health_threshold_dead is set to)
if(!src.stat)
stat(null, text("System integrity: [system_integrity()]%"))
else
stat(null, text("Systems nonfunctional"))
/mob/living/silicon/ai/SetName(pickedName as text)
..()
announcement.announcer = pickedName
@@ -240,6 +233,7 @@ var/list/ai_verbs_default = list(
/obj/machinery/ai_powersupply/New(var/mob/living/silicon/ai/ai=null)
powered_ai = ai
powered_ai.psupply = src
if(isnull(powered_ai))
qdel(src)
@@ -250,10 +244,17 @@ var/list/ai_verbs_default = list(
/obj/machinery/ai_powersupply/process()
if(!powered_ai || powered_ai.stat & DEAD)
qdel()
return
if(powered_ai.psupply != src) // For some reason, the AI has different powersupply object. Delete this one, it's no longer needed.
qdel(src)
if(powered_ai.APU_power)
use_power = 0
return
if(!powered_ai.anchored)
loc = powered_ai.loc
use_power = 0
use_power(50000) // Less optimalised but only called if AI is unwrenched. This prevents usage of wrenching as method to keep AI operational without power. Intellicard is for that.
if(powered_ai.anchored)
use_power = 2
@@ -312,14 +313,7 @@ var/list/ai_verbs_default = list(
if("Lonestar") icon_state = "ai-lonestar"
if("Nanotrasen") icon_state = "ai-nanotrasen"
else icon_state = "ai"
//else
//usr <<"You can only change your display once!"
//return
// displays the malf_ai information if the AI is the malf
/mob/living/silicon/ai/show_malf_ai()
if(malf && malf.hacked_apcs.len >= 3)
stat(null, "Time until station control secured: [max(malf.hack_time/(malf.hacked_apcs/3), 0)] seconds")
// this verb lets the ai see the stations manifest
/mob/living/silicon/ai/proc/ai_roster()
@@ -420,11 +414,7 @@ var/list/ai_verbs_default = list(
/mob/living/silicon/ai/emp_act(severity)
if (prob(30))
switch(pick(1,2))
if(1)
view_core()
if(2)
ai_call_shuttle()
view_core()
..()
/mob/living/silicon/ai/Topic(href, href_list)
@@ -545,13 +535,6 @@ var/list/ai_verbs_default = list(
src << "\blue Switched to [network] camera network."
//End of code by Mord_Sith
/mob/living/silicon/ai/proc/choose_modules()
set category = "Malfunction"
set name = "Choose Module"
malf_picker.use(src)
/mob/living/silicon/ai/proc/ai_statuschange()
set category = "AI Commands"
set name = "AI Status"
@@ -711,5 +694,153 @@ var/list/ai_verbs_default = list(
/mob/living/silicon/ai/proc/is_in_chassis()
return istype(loc, /turf)
/mob/living/silicon/ai/ex_act(var/severity)
if(severity == 1.0)
qdel(src)
return
..()
// NEWMALF FUNCTIONS/PROCEDURES
// Sets up malfunction-related variables, research system and such.
/mob/living/silicon/ai/proc/setup_for_malf()
var/mob/living/silicon/ai/user = src
// Setup Variables
malfunctioning = 1
research = new/datum/malf_research()
research.owner = src
hacked_apcs = list()
recalc_cpu()
verbs += new/datum/game_mode/malfunction/verb/ai_select_hardware()
verbs += new/datum/game_mode/malfunction/verb/ai_select_research()
verbs += new/datum/game_mode/malfunction/verb/ai_help()
// And greet user with some OOC info.
user << "You are malfunctioning, you do not have to follow any laws."
user << "Use ai-help command to view relevant information about your abilities"
// Safely remove malfunction status, fixing hacked APCs and resetting variables.
/mob/living/silicon/ai/proc/stop_malf()
var/mob/living/silicon/ai/user = src
// Generic variables
malfunctioning = 0
sleep(10)
research = null
// Fix hacked APCs
if(hacked_apcs)
for(var/obj/machinery/power/apc/A in hacked_apcs)
A.hacker = null
hacked_apcs = null
// Reset our verbs
src.verbs = null
add_ai_verbs()
// Let them know.
user << "You are no longer malfunctioning. Your abilities have been removed."
// Called every tick. Checks if AI is malfunctioning. If yes calls Process on research datum which handles all logic.
/mob/living/silicon/ai/proc/malf_process()
if(!malfunctioning)
return
if(!research)
if(!errored)
errored = 1
error("malf_process() called on AI without research datum. Report this.")
message_admins("ERROR: malf_process() called on AI without research datum. If admin modified one of the AI's vars revert the change and don't modify variables directly, instead use ProcCall or admin panels.")
spawn(1200)
errored = 0
return
recalc_cpu()
if(APU_power || aiRestorePowerRoutine != 0)
research.process(1)
else
research.process(0)
// Recalculates CPU time gain and storage capacities.
/mob/living/silicon/ai/proc/recalc_cpu()
// AI Starts with these values.
var/cpu_gain = 0.01
var/cpu_storage = 10
// Off-Station APCs should not count towards CPU generation.
for(var/obj/machinery/power/apc/A in hacked_apcs)
if(A.z in config.station_levels)
cpu_gain += 0.002
cpu_storage += 10
research.max_cpu = cpu_storage + override_CPUStorage
if(hardware && istype(hardware, /datum/malf_hardware/dual_ram))
research.max_cpu = research.max_cpu * 1.5
research.stored_cpu = min(research.stored_cpu, research.max_cpu)
research.cpu_increase_per_tick = cpu_gain + override_CPURate
if(hardware && istype(hardware, /datum/malf_hardware/dual_cpu))
research.cpu_increase_per_tick = research.cpu_increase_per_tick * 2
// Starts AI's APU generator
/mob/living/silicon/ai/proc/start_apu(var/shutup = 0)
if(!hardware || !istype(hardware, /datum/malf_hardware/apu_gen))
if(!shutup)
src << "You do not have an APU generator and you shouldn't have this verb. Report this."
return
if(hardware_integrity() < 50)
if(!shutup)
src << "<span class='notice'>Starting APU... <b>FAULT</b>(System Damaged)</span>"
return
if(!shutup)
src << "Starting APU... ONLINE"
APU_power = 1
// Stops AI's APU generator
/mob/living/silicon/ai/proc/stop_apu(var/shutup = 0)
if(!hardware || !istype(hardware, /datum/malf_hardware/apu_gen))
return
if(APU_power)
APU_power = 0
if(!shutup)
src << "Shutting down APU... DONE"
// Returns percentage of AI's remaining backup capacitor charge (maxhealth - oxyloss).
/mob/living/silicon/ai/proc/backup_capacitor()
return ((200 - getOxyLoss()) / 2)
// Returns percentage of AI's remaining hardware integrity (maxhealth - (bruteloss + fireloss))
/mob/living/silicon/ai/proc/hardware_integrity()
return (health-config.health_threshold_dead)/2
// Shows capacitor charge and hardware integrity information to the AI in Status tab.
/mob/living/silicon/ai/show_system_integrity()
if(!src.stat)
stat(null, text("Hardware integrity: [hardware_integrity()]%"))
stat(null, text("Internal capacitor: [backup_capacitor()]%"))
else
stat(null, text("Systems nonfunctional"))
// Shows AI Malfunction related information to the AI.
/mob/living/silicon/ai/show_malf_ai()
if(src.is_malf())
if(src.hacked_apcs)
stat(null, "Hacked APCs: [src.hacked_apcs.len]")
stat(null, "System Status: [src.hacking ? "Busy" : "Stand-By"]")
if(src.research)
stat(null, "Available CPU: [src.research.stored_cpu] TFlops")
stat(null, "Maximal CPU: [src.research.max_cpu] TFlops")
stat(null, "CPU generation rate: [src.research.cpu_increase_per_tick] TFlops/s")
stat(null, "Current research focus: [src.research.focus ? src.research.focus.name : "None"]")
if(src.research.focus)
stat(null, "Research completed: [round(src.research.focus.invested, 0.1)]/[round(src.research.focus.price)]")
if(system_override == 1)
stat(null, "SYSTEM OVERRIDE INITIATED")
else if(system_override == 2)
stat(null, "SYSTEM OVERRIDE COMPLETED")
// Cleaner proc for creating powersupply for an AI.
/mob/living/silicon/ai/proc/create_powersupply()
if(psupply)
del(psupply)
psupply = new/obj/machinery/ai_powersupply(src)
#undef AI_CHECK_WIRELESS
#undef AI_CHECK_RADIO
@@ -13,10 +13,6 @@
remove_ai_verbs(src)
if(explosive)
spawn(10)
explosion(src.loc, 3, 6, 12, 15)
for(var/obj/machinery/ai_status_display/O in world)
spawn( 0 )
O.mode = 2
+10 -2
View File
@@ -17,15 +17,23 @@
msg += "It looks slightly charred.\n"
else
msg += "<B>Its casing is melted and heat-warped!</B>\n"
if (src.getOxyLoss())
if (src.getOxyLoss() > 175)
msg += "<B>It seems to be running on backup power. Its display is blinking a \"BACKUP POWER CRITICAL\" warning.</B>\n"
else if(src.getOxyLoss() > 100)
msg += "<B>It seems to be running on backup power. Its display is blinking a \"BACKUP POWER LOW\" warning.</B>\n"
else
msg += "It seems to be running on backup power.\n"
if (src.stat == UNCONSCIOUS)
msg += "It is non-responsive and displaying the text: \"RUNTIME: Sensory Overload, stack 26/3\".\n"
msg += "</span>"
msg += "*---------*</span>"
if(hardware && (hardware.owner == src))
msg += "<br>"
msg += hardware.get_examine_desc()
user << msg
user.showLaws(src)
return
/mob/proc/showLaws(var/mob/living/silicon/S)
+35 -54
View File
@@ -12,90 +12,71 @@
src.updatehealth()
if (src.malfhack)
if (src.malfhack.aidisabled)
src << "\red ERROR: APC access disabled, hack attempt canceled."
src.malfhacking = 0
src.malfhack = null
if (src.health <= config.health_threshold_dead)
if (!hardware_integrity() || !backup_capacitor())
death()
return
// If our powersupply object was destroyed somehow, create new one.
if(!psupply)
create_powersupply()
if (src.machine)
if (!( src.machine.check_eye(src) ))
src.reset_view(null)
// Handle power damage (oxy)
if(src:aiRestorePowerRoutine != 0)
// Lost power
if(aiRestorePowerRoutine != 0 && !APU_power)
// Lose power
adjustOxyLoss(1)
else
// Gain Power
aiRestorePowerRoutine = 0 // Necessary if AI activated it's APU AFTER losing primary power.
adjustOxyLoss(-1)
// Handle EMP-stun
handle_stunned()
//stage = 1
//if (istype(src, /mob/living/silicon/ai)) // Are we not sure what we are?
malf_process()
if(APU_power && (hardware_integrity() < 50))
src << "<span class='notice'><b>APU GENERATOR FAILURE! (System Damaged)</b></span>"
stop_apu(1)
var/blind = 0
//stage = 2
var/area/loc = null
if (istype(T, /turf))
//stage = 3
loc = T.loc
if (istype(loc, /area))
//stage = 4
if (!loc.power_equip && !istype(src.loc,/obj/item))
//stage = 5
if (!loc.power_equip && !istype(src.loc,/obj/item) && !APU_power)
blind = 1
if (!blind) //lol? if(!blind) #if(src.blind.layer) <--something here is clearly wrong :P
//I'll get back to this when I find out how this is -supposed- to work ~Carn //removed this shit since it was confusing as all hell --39kk9t
//stage = 4.5
if (!blind)
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.sight |= SEE_OBJS
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_LIVING
//Congratulations! You've found a way for AI's to run without using power!
//Todo: Without snowflaking up master_controller procs find a way to make AI use_power but only when APC's clear the area usage the tick prior
// since mobs are in master_controller before machinery. We also have to do it in a manner where we don't reset the entire area's need to update
// the power usage.
//
// We can probably create a new machine that resides inside of the AI contents that uses power using the idle_usage of 1000 and nothing else and
// be fine.
/*
var/area/home = get_area(src)
if(!home) return//something to do with malf fucking things up I guess. <-- aisat is gone. is this still necessary? ~Carn
if(home.powered(EQUIP))
home.use_power(1000, EQUIP)
*/
if (src:aiRestorePowerRoutine==2)
if (aiRestorePowerRoutine==2)
src << "Alert cancelled. Power has been restored without our assistance."
src:aiRestorePowerRoutine = 0
aiRestorePowerRoutine = 0
src.blind.layer = 0
return
else if (src:aiRestorePowerRoutine==3)
else if (aiRestorePowerRoutine==3)
src << "Alert cancelled. Power has been restored."
src:aiRestorePowerRoutine = 0
aiRestorePowerRoutine = 0
src.blind.layer = 0
return
else if (APU_power)
aiRestorePowerRoutine = 0
src.blind.layer = 0
return
else
//stage = 6
var/area/current_area = get_area(src)
if (lacks_power())
//If our area lacks equipment power, and is not magically powered (i.e. centcom), or if we are in space and not carded, lose power.
if (src:aiRestorePowerRoutine==0)
src:aiRestorePowerRoutine = 1
if (aiRestorePowerRoutine==0)
aiRestorePowerRoutine = 1
//Blind the AI
@@ -118,7 +99,7 @@
if (loc.power_equip)
if (!istype(T, /turf/space))
src << "Alert cancelled. Power has been restored without our assistance."
src:aiRestorePowerRoutine = 0
aiRestorePowerRoutine = 0
src.blind.layer = 0
return
src << "Fault confirmed: missing external power. Shutting down main control system to save power."
@@ -127,7 +108,7 @@
sleep(50)
if (istype(T, /turf/space))
src << "Unable to verify! No power connection detected!"
src:aiRestorePowerRoutine = 2
aiRestorePowerRoutine = 2
return
src << "Connection verified. Searching for APC in power network."
sleep(50)
@@ -148,7 +129,7 @@
if (loc.power_equip)
if (!istype(T, /turf/space))
src << "Alert cancelled. Power has been restored without our assistance."
src:aiRestorePowerRoutine = 0
aiRestorePowerRoutine = 0
src.blind.layer = 0 //This, too, is a fix to issue 603
return
switch(PRP)
@@ -163,9 +144,9 @@
theAPC.operating = 1
theAPC.equipment = 3
theAPC.update()
src:aiRestorePowerRoutine = 3
aiRestorePowerRoutine = 3
src << "Here are your current laws:"
src.show_laws()
show_laws()
sleep(50)
theAPC = null
@@ -178,6 +159,8 @@
process_med_hud(src,0,src.eyeobj)
/mob/living/silicon/ai/proc/lacks_power()
if(APU_power)
return 0
var/turf/T = get_turf(src)
var/area/A = get_area(src)
return ((!A.power_equip) && A.requires_power == 1 || istype(T, /turf/space)) && !istype(src.loc,/obj/item)
@@ -186,11 +169,9 @@
if(status_flags & GODMODE)
health = 100
stat = CONSCIOUS
setOxyLoss(0)
else
if(fire_res_on_core)
health = 100 - getOxyLoss() - getToxLoss() - getBruteLoss()
else
health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss()
health = 100 - getFireLoss() - getBruteLoss() // Oxyloss is not part of health as it represents AIs backup power. AI is immune against ToxLoss as it is machine.
/mob/living/silicon/ai/rejuvenate()
..()
@@ -1,5 +0,0 @@
/mob/living/silicon/ai/say(var/message)
if(parent && istype(parent) && parent.stat != 2)
return parent.say(message)
//If there is a defined "parent" AI, it is actually an AI, and it is alive, anything the AI tries to say is said by the parent instead.
return ..(message)
@@ -409,19 +409,6 @@
C.toggled = 1
src << "\red You enable [C.name]."
// this function shows information about the malf_ai gameplay type in the status screen
/mob/living/silicon/robot/show_malf_ai()
..()
for (var/datum/mind/malfai in malf.current_antagonists)
if(connected_ai)
if(connected_ai.mind == malfai)
if(malf.hacked_apcs >= 3)
stat(null, "Time until station control secured: [max(malf.hack_time/(malf.hacked_apcs/3), 0)] seconds")
else if(malf.revealed)
stat(null, "Time left: [max(malf.hack_time/(malf.hacked_apcs.len/3), 0)]")
return 0
// this function displays jetpack pressure in the stat panel
/mob/living/silicon/robot/proc/show_jetpack_pressure()
// if you have a jetpack, show the internal tank pressure
+6 -5
View File
@@ -191,15 +191,16 @@ var/list/organ_cache = list()
W.time_inflicted = world.time
/obj/item/organ/proc/take_damage(amount, var/silent=0)
if(src.robotic == 2)
if(src.status & ORGAN_ROBOT)
src.damage += (amount * 0.8)
else
src.damage += amount
if(owner && parent_organ)
var/obj/item/organ/external/parent = owner.get_organ(parent_organ)
if(parent && !silent)
owner.custom_pain("Something inside your [parent.name] hurts a lot.", 1)
//only show this if the organ is not robotic
if(owner && parent_organ)
var/obj/item/organ/external/parent = owner.get_organ(parent_organ)
if(parent && !silent)
owner.custom_pain("Something inside your [parent.name] hurts a lot.", 1)
/obj/item/organ/proc/robotize() //Being used to make robutt hearts, etc
robotic = 2
+4 -1
View File
@@ -138,6 +138,9 @@
DAMAGE PROCS
****************************************************/
/obj/item/organ/external/proc/is_damageable(var/additional_damage = 0)
return (vital || brute_dam + burn_dam + additional_damage < max_damage)
/obj/item/organ/external/take_damage(brute, burn, sharp, edge, used_weapon = null, list/forbidden_limbs = list())
if((brute <= 0) && (burn <= 0))
return 0
@@ -168,7 +171,7 @@
// If the limbs can break, make sure we don't exceed the maximum damage a limb can take before breaking
// Non-vital organs are limited to max_damage. You can't kill someone by bludeonging their arm all the way to 200 -- you can
// push them faster into paincrit though, as the additional damage is converted into shock.
if(vital || (brute_dam + burn_dam + brute + burn) < max_damage || !config.limbs_can_break)
if(is_damageable(brute + burn) || !config.limbs_can_break)
if(brute)
if(can_cut)
createwound( CUT, brute )
+11 -7
View File
@@ -8,7 +8,10 @@ mob/var/next_pain_time = 0
// partname is the name of a body part
// amount is a num from 1 to 100
mob/living/carbon/proc/pain(var/partname, var/amount, var/force, var/burning = 0)
if(stat >= 2) return
if(stat >= 1)
return
if(species && (species.flags & NO_PAIN))
return
if(analgesic > 40)
return
if(world.time < next_pain_time && !force)
@@ -48,10 +51,10 @@ mob/living/carbon/proc/pain(var/partname, var/amount, var/force, var/burning = 0
// message is the custom message to be displayed
// flash_strength is 0 for weak pain flash, 1 for strong pain flash
mob/living/carbon/human/proc/custom_pain(var/message, var/flash_strength)
if(stat >= 1) return
if(species && species.flags & NO_PAIN) return
if(stat >= 1)
return
if(species.flags & NO_PAIN)
return
if(reagents.has_reagent("tramadol"))
return
if(reagents.has_reagent("oxycodone"))
@@ -71,7 +74,7 @@ mob/living/carbon/human/proc/custom_pain(var/message, var/flash_strength)
mob/living/carbon/human/proc/handle_pain()
// not when sleeping
if(species && species.flags & NO_PAIN) return
if(species.flags & NO_PAIN) return
if(stat >= 2) return
if(analgesic > 70)
@@ -79,7 +82,7 @@ mob/living/carbon/human/proc/handle_pain()
var/maxdam = 0
var/obj/item/organ/external/damaged_organ = null
for(var/obj/item/organ/external/E in organs)
if(E.status & ORGAN_DEAD) continue
if(E.status & (ORGAN_DEAD|ORGAN_ROBOT)) continue
var/dam = E.get_damage()
// make the choice of the organ depend on damage,
// but also sometimes use one of the less damaged ones
@@ -91,6 +94,7 @@ mob/living/carbon/human/proc/handle_pain()
// Damage to internal organs hurts a lot.
for(var/obj/item/organ/I in internal_organs)
if(I.status & (ORGAN_DEAD|ORGAN_ROBOT)) continue
if(I.damage > 2) if(prob(2))
var/obj/item/organ/external/parent = get_organ(I.parent_organ)
src.custom_pain("You feel a sharp pain in your [parent.name]", 1)
+60 -97
View File
@@ -83,17 +83,13 @@
var/lastused_charging = 0
var/lastused_total = 0
var/main_status = 0
var/mob/living/silicon/ai/hacker = null // Malfunction var. If set AI hacked the APC and has full control.
var/wiresexposed = 0
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
var/beenhit = 0 // used for counting how many times it has been hit, used for Aliens at the moment
var/mob/living/silicon/ai/occupier = null
var/longtermpower = 10
var/datum/wires/apc/wires = null
var/update_state = -1
@@ -156,22 +152,16 @@
init()
else
area = get_area(src)
area.apc |= src
area.apc = src
opened = 1
operating = 0
name = "[area.name] APC"
stat |= MAINT
src.update_icon()
/obj/machinery/power/apc/initialize()
..()
src.update()
/obj/machinery/power/apc/Destroy()
if(operating && malf && src.z in config.station_levels) //if (is_type_in_list(get_area(src), the_station_areas))
malf.hacked_apcs -= src
area.apc -= src
src.update()
area.apc = null
area.power_light = 0
area.power_equip = 0
area.power_environ = 0
@@ -185,6 +175,11 @@
if(terminal)
qdel(terminal)
terminal = null
// Malf AI, removes the APC from AI's hacked APCs list.
if((hacker) && (hacker.hacked_apcs) && (src in hacker.hacked_apcs))
hacker.hacked_apcs -= src
..()
/obj/machinery/power/apc/proc/make_terminal()
@@ -210,7 +205,7 @@
else
src.area = get_area_name(areastring)
name = "\improper [area.name] APC"
area.apc |= src
area.apc = src
update_icon()
make_terminal()
@@ -237,8 +232,8 @@
else
if (stat & MAINT)
user << "The cover is closed. Something wrong with it: it doesn't work."
else if (malfhack)
user << "The cover is broken. It may be hard to force it open."
else if (hacker)
user << "The cover is locked."
else
user << "The cover is closed."
@@ -342,7 +337,7 @@
update_state |= UPSTATE_OPENED1
if(opened==2)
update_state |= UPSTATE_OPENED2
else if(emagged || malfai)
else if(emagged || hacker)
update_state |= UPSTATE_BLUESCREEN
else if(wiresexposed)
update_state |= UPSTATE_WIREEXP
@@ -421,7 +416,7 @@
if(do_after(user, 50))
if (has_electronics==1)
has_electronics = 0
if ((stat & BROKEN) || malfhack)
if ((stat & BROKEN))
user.visible_message(\
"<span class='warning'>[user.name] has broken the power control board inside [src.name]!</span>",\
"<span class='notice'>You broke the charred power control board and remove the remains.</span>",
@@ -435,7 +430,7 @@
else if (opened!=2) //cover isn't removed
opened = 0
update_icon()
else if (istype(W, /obj/item/weapon/crowbar) && !((stat & BROKEN) || malfhack) )
else if (istype(W, /obj/item/weapon/crowbar) && !((stat & BROKEN) || hacker) )
if(coverlocked && !(stat & MAINT))
user << "<span class='warning'>The cover is locked and cannot be opened.</span>"
return
@@ -497,6 +492,8 @@
user << "You must close the panel"
else if(stat & (BROKEN|MAINT))
user << "Nothing happens."
else if(hacker)
user << "<span class='warning'>Access denied.</span>"
else
if(src.allowed(usr) && !isWireCut(APC_WIRE_IDSCAN))
locked = !locked
@@ -504,7 +501,7 @@
update_icon()
else
user << "<span class='warning'>Access denied.</span>"
else if (istype(W, /obj/item/weapon/card/emag) && !(emagged || malfhack)) // trying to unlock with an emag card
else if (istype(W, /obj/item/weapon/card/emag) && !(emagged || hacker)) // trying to unlock with an emag card
if(opened)
user << "You must close the cover to swipe an ID card."
else if(wiresexposed)
@@ -566,7 +563,7 @@
new /obj/item/stack/cable_coil(loc,10)
user << "<span class='notice'>You cut the cables and dismantle the power terminal.</span>"
qdel(terminal)
else if (istype(W, /obj/item/weapon/module/power_control) && opened && has_electronics==0 && !((stat & BROKEN) || malfhack))
else if (istype(W, /obj/item/weapon/module/power_control) && opened && has_electronics==0 && !((stat & BROKEN)))
user.visible_message("<span class='warning'>[user.name] inserts the power control board into [src].</span>", \
"You start to insert the power control board into the frame...")
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
@@ -575,7 +572,7 @@
has_electronics = 1
user << "<span class='notice'>You place the power control board inside the frame.</span>"
qdel(W)
else if (istype(W, /obj/item/weapon/module/power_control) && opened && has_electronics==0 && ((stat & BROKEN) || malfhack))
else if (istype(W, /obj/item/weapon/module/power_control) && opened && has_electronics==0 && ((stat & BROKEN)))
user << "<span class='warning'>You cannot put the board inside, the frame is damaged.</span>"
return
else if (istype(W, /obj/item/weapon/weldingtool) && opened && has_electronics==0 && !terminal)
@@ -589,7 +586,7 @@
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
if(do_after(user, 50))
if(!src || !WT.remove_fuel(3, user)) return
if (emagged || malfhack || (stat & BROKEN) || opened==2)
if (emagged || (stat & BROKEN) || opened==2)
new /obj/item/stack/material/steel(loc)
user.visible_message(\
"<span class='warning'>[src] has been cut apart by [user.name] with the weldingtool.</span>",\
@@ -612,7 +609,7 @@
"<span class='notice'>You replace the damaged APC frontal panel with a new one.</span>")
qdel(W)
update_icon()
else if (istype(W, /obj/item/apc_frame) && opened && ((stat & BROKEN) || malfhack))
else if (istype(W, /obj/item/apc_frame) && opened && ((stat & BROKEN) || hacker))
if (has_electronics)
user << "<span class='warning'>You cannot repair this APC until you remove the electronics still inside.</span>"
return
@@ -624,13 +621,14 @@
"You replace the damaged APC frame with new one.")
qdel(W)
stat &= ~BROKEN
malfai = null
malfhack = 0
// Malf AI, removes the APC from AI's hacked APCs list.
if(hacker && hacker.hacked_apcs && src in hacker.hacked_apcs)
hacker.hacked_apcs -= src
if (opened==2)
opened = 1
update_icon()
else
if (((stat & BROKEN) || malfhack) \
if (((stat & BROKEN) || hacker) \
&& !opened \
&& W.force >= 5 \
&& W.w_class >= 3.0 \
@@ -716,21 +714,6 @@
return ui_interact(user)
/obj/machinery/power/apc/proc/get_malf_status(mob/user)
if (malf && (user.mind in malf.current_antagonists) && istype(user, /mob/living/silicon/ai))
if (src.malfai == (user:parent ? user:parent : user))
if (src.occupier == user)
return 3 // 3 = User is shunted in this APC
else if (istype(user.loc, /obj/machinery/power/apc))
return 4 // 4 = User is shunted in another APC
else
return 2 // 2 = APC hacked by user, and user is in its core.
else
return 1 // 1 = APC not hacked.
else
return 0 // 0 = User is not a Malf AI
/obj/machinery/power/apc/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
if(!user)
return
@@ -746,7 +729,6 @@
"totalCharging" = round(lastused_charging),
"coverLocked" = coverlocked,
"siliconUser" = istype(user, /mob/living/silicon),
"malfStatus" = get_malf_status(user),
"powerChannels" = list(
list(
@@ -836,23 +818,22 @@
return 0
autoflag = 5
if (istype(user, /mob/living/silicon))
var/permit = 0 // Malfunction variable. If AI hacks APC it can control it even without AI control wire.
var/mob/living/silicon/ai/AI = user
var/mob/living/silicon/robot/robot = user
if ( \
src.aidisabled || \
malfhack && istype(malfai) && \
( \
(istype(AI) && (malfai!=AI && malfai != AI.parent)) || \
(istype(robot) && (robot in malfai.connected_robots)) \
) \
)
if(hacker)
if(hacker == AI)
permit = 1
else if(istype(robot) && robot.connected_ai && robot.connected_ai == hacker) // Cyborgs can use APCs hacked by their AI
permit = 1
if(aidisabled && !permit)
if(!loud)
user << "<span class='danger'>\The [src] have AI control disabled!</span>"
return 0
else
if ((!in_range(src, user) || !istype(src.loc, /turf)))
if ((!in_range(src, user) || !istype(src.loc, /turf) || hacker)) // AI-hacked APCs cannot be controlled by other AIs, unlinked cyborgs or humans.
return 0
var/mob/living/carbon/human/H = user
if (istype(H))
if(H.getBrainLoss() >= 60)
@@ -909,28 +890,6 @@
if(istype(usr, /mob/living/silicon))
src.overload_lighting()
else if (href_list["malfhack"])
var/mob/living/silicon/ai/malfai = usr
if(get_malf_status(malfai)==1)
if (malfai.malfhacking)
malfai << "You are already hacking an APC."
return 1
malfai << "Beginning override of APC systems. This takes some time, and you cannot perform other actions during the process."
malfai.malfhack = src
malfai.malfhacking = 1
sleep(600)
if(src)
if (!src.aidisabled)
malfai.malfhack = null
malfai.malfhacking = 0
locked = 1
if(usr:parent)
src.malfai = usr:parent
else
src.malfai = usr
malfai << "Hack complete. The APC is now under your exclusive control."
update_icon()
else if (href_list["toggleaccess"])
if(istype(usr, /mob/living/silicon))
if(emagged || (stat & (BROKEN|MAINT)))
@@ -947,25 +906,21 @@
update_icon()
/obj/machinery/power/apc/proc/ion_act()
//intended to be exactly the same as an AI malf attack
if(!src.malfhack && src.z in config.station_levels)
if(prob(3))
src.locked = 1
if (src.cell.charge > 0)
// world << "\red blew APC in [src.loc.loc]"
src.cell.charge = 0
cell.corrupt()
src.malfhack = 1
update_icon()
var/datum/effect/effect/system/smoke_spread/smoke = new /datum/effect/effect/system/smoke_spread()
smoke.set_up(3, 0, src.loc)
smoke.attach(src)
smoke.start()
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(3, 1, src)
s.start()
visible_message("<span class='danger'>The [src.name] suddenly lets out a blast of smoke and some sparks!</span>", \
"<span class='danger'>You hear sizzling electronics.</span>")
if(prob(3))
src.locked = 1
if (src.cell.charge > 0)
src.cell.charge = 0
cell.corrupt()
update_icon()
var/datum/effect/effect/system/smoke_spread/smoke = new /datum/effect/effect/system/smoke_spread()
smoke.set_up(3, 0, src.loc)
smoke.attach(src)
smoke.start()
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(3, 1, src)
s.start()
visible_message("<span class='danger'>The [src.name] suddenly lets out a blast of smoke and some sparks!</span>", \
"<span class='danger'>You hear sizzling electronics.</span>")
/obj/machinery/power/apc/surplus()
@@ -1168,8 +1123,6 @@ obj/machinery/power/apc/proc/autoset(var/val, var/on)
/obj/machinery/power/apc/emp_act(severity)
if(cell)
cell.emp_act(severity)
if(occupier)
occupier.emp_act(severity)
lighting = 0
equipment = 0
@@ -1246,4 +1199,14 @@ obj/machinery/power/apc/proc/autoset(var/val, var/on)
else
return 0
// Malfunction: Transfers APC under AI's control
/obj/machinery/power/apc/proc/ai_hack(var/mob/living/silicon/ai/A = null)
if(!A || !A.hacked_apcs || hacker || aidisabled || A.stat == DEAD)
return 0
src.hacker = A
A.hacked_apcs += src
locked = 1
update_icon()
return 1
#undef APC_UPDATE_ICON_COOLDOWN
+2 -3
View File
@@ -149,7 +149,6 @@
return C
return null
/area/proc/get_apc()
var/obj/machinery/power/apc/FINDME = locate() in src
if (FINDME)
return FINDME
return apc
@@ -119,19 +119,19 @@
M.add_chemical_effect(CE_ALCOHOL, 1)
if(dose / strength_mod >= strength) // Early warning
if(dose * strength_mod >= strength) // Early warning
M.make_dizzy(6) // It is decreased at the speed of 3 per tick
if(dose / strength_mod >= strength * 2) // Slurring
if(dose * strength_mod >= strength * 2) // Slurring
M.slurring = max(M.slurring, 30)
if(dose / strength_mod >= strength * 3) // Confusion - walking in random directions
if(dose * strength_mod >= strength * 3) // Confusion - walking in random directions
M.confused = max(M.confused, 20)
if(dose / strength_mod >= strength * 4) // Blurry vision
if(dose * strength_mod >= strength * 4) // Blurry vision
M.eye_blurry = max(M.eye_blurry, 10)
if(dose / strength_mod >= strength * 5) // Drowsyness - periodically falling asleep
if(dose * strength_mod >= strength * 5) // Drowsyness - periodically falling asleep
M.drowsyness = max(M.drowsyness, 20)
if(dose / strength_mod >= strength * 6) // Toxic dose
if(dose * strength_mod >= strength * 6) // Toxic dose
M.add_chemical_effect(CE_ALCOHOL_TOXIC, toxicity)
if(dose / strength_mod >= strength * 7) // Pass out
if(dose * strength_mod >= strength * 7) // Pass out
M.paralysis = max(M.paralysis, 20)
M.sleeping = max(M.sleeping, 30)
+20 -25
View File
@@ -12,6 +12,21 @@
var/shield_generate_power = 7500 //how much power we use when regenerating
var/shield_idle_power = 1500 //how much power we use when just being sustained.
/obj/machinery/shield/malfai
name = "emergency forcefield"
desc = "A weak forcefield which seems to be projected by the station's emergency atmosphere containment field"
health = max_health/2 // Half health, it's not suposed to resist much.
/obj/machinery/shield/malfai/process()
health -= 0.5 // Slowly lose integrity over time
check_failure()
/obj/machinery/shield/proc/check_failure()
if (src.health <= 0)
visible_message("<span class='notice'>\The [src] dissipates!</span>")
qdel(src)
return
/obj/machinery/shield/New()
src.set_dir(pick(1,2,3,4))
..()
@@ -38,12 +53,7 @@
//Play a fitting sound
playsound(src.loc, 'sound/effects/EMPulse.ogg', 75, 1)
if (src.health <= 0)
visible_message("\blue The [src] dissipates!")
qdel(src)
return
check_failure()
opacity = 1
spawn(20) if(src) opacity = 0
@@ -51,12 +61,7 @@
/obj/machinery/shield/meteorhit()
src.health -= max_health*0.75 //3/4 health as damage
if(src.health <= 0)
visible_message("\blue The [src] dissipates!")
qdel(src)
return
check_failure()
opacity = 1
spawn(20) if(src) opacity = 0
return
@@ -64,10 +69,7 @@
/obj/machinery/shield/bullet_act(var/obj/item/projectile/Proj)
health -= Proj.damage
..()
if(health <=0)
visible_message("\blue The [src] dissipates!")
qdel(src)
return
check_failure()
opacity = 1
spawn(20) if(src) opacity = 0
@@ -98,7 +100,7 @@
/obj/machinery/shield/hitby(AM as mob|obj)
//Let everyone know we've been hit!
visible_message("\red <B>[src] was hit by [AM].</B>")
visible_message("<span class='notice'><B>\[src] was hit by [AM].</B></span>")
//Super realistic, resource-intensive, real-time damage calculations.
var/tforce = 0
@@ -112,11 +114,7 @@
//This seemed to be the best sound for hitting a force field.
playsound(src.loc, 'sound/effects/EMPulse.ogg', 100, 1)
//Handle the destruction of the shield
if (src.health <= 0)
visible_message("\blue The [src] dissipates!")
qdel(src)
return
check_failure()
//The shield becomes dense to absorb the blow.. purely asthetic.
opacity = 1
@@ -124,9 +122,6 @@
..()
return
/obj/machinery/shieldgen
name = "Emergency shield projector"
desc = "Used to seal minor hull breaches."
+4 -4
View File
@@ -3,15 +3,15 @@
if(air_group || (height==0)) return 1
if(istype(mover,/obj/item/projectile))
return (check_cover(mover,target))
if(istype(mover) && mover.checkpass(PASSTABLE))
return 1
if(locate(/obj/structure/table) in get_turf(mover))
return 1
if (flipped == 1)
if (get_dir(loc, target) == dir)
return !density
else
return 1
if(istype(mover) && mover.checkpass(PASSTABLE))
return 1
if(locate(/obj/structure/table) in get_turf(mover))
return 1
return 0
//checks if projectile 'P' from turf 'from' can hit whatever is behind the table. Returns 1 if it can, 0 if bullet stops.