12/21 modernizations from TG live (#103)
* sync (#3) * shuttle auto call * Merge /vore into /master (#39) * progress * Compile errors fixed No idea if it's test worthy tho as conflicts with race overhaul and narky removal. * Update admins.txt * efforts continue Fuck grab code, seriously * grab code is cancer * Execute the Narkism Do not hesitate. Show no mercy. * holy shit grab code is awful * have I bitched about grab code My bitching, let me show you it * código de agarre es una mierda No really it is * yeah I don't even know anymore. * Lolnope. Fuck grab code * I'm not even sure what to fix anymore * Self eating is not an acceptable fate * Taste the void, son. * My code doesn't pass it's own sanity check. Maybe it's a sign of things to come. * uncommented and notes * It Works and I Don't Know Why (#38) * shuttle auto call * it works and I don't know why * Subsystem 12/21 Most Recent TG subsystem folder * globalvars 12/21 Tossed out the flavor_misc and parallax files * Onclick 12/21 as well as .dme updates * _defines 12/21 ommited old _MC.dm * _HELPERS 12/21 Preserved snowflake placement of furry sprites * _defeines/genetics reapplied narkism holdover for snowflake races. * Oops forgot mutant colors * modules porting 12/21 + Sounds/icons Admin, Client and most of mob life files ommitted * enviroment file * Admin optimizations ahelp log system kept * Mob ports 12/21 Flavor text preserved * datums ported 12/21 * Game ported 12/21 * batch of duplicate fixes/dogborg work Dogborgs need to be modernized to refractored borg standards. * moar fixes * Maps and futher compile fixes
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
/obj/item/weapon/computer_hardware
|
||||
name = "hardware"
|
||||
desc = "Unknown Hardware."
|
||||
icon = 'icons/obj/module.dmi'
|
||||
icon_state = "std_mod"
|
||||
|
||||
w_class = WEIGHT_CLASS_TINY // w_class limits which devices can contain this component.
|
||||
// 1: PDAs/Tablets, 2: Laptops, 3-4: Consoles only
|
||||
var/obj/item/device/modular_computer/holder = null
|
||||
// Computer that holds this hardware, if any.
|
||||
|
||||
var/power_usage = 0 // If the hardware uses extra power, change this.
|
||||
var/enabled = 1 // If the hardware is turned off set this to 0.
|
||||
var/critical = 0 // Prevent disabling for important component, like the CPU.
|
||||
var/can_install = 1 // Prevents direct installation of removable media.
|
||||
var/damage = 0 // Current damage level
|
||||
var/max_damage = 100 // Maximal damage level.
|
||||
var/damage_malfunction = 20 // "Malfunction" threshold. When damage exceeds this value the hardware piece will semi-randomly fail and do !!FUN!! things
|
||||
var/damage_failure = 50 // "Failure" threshold. When damage exceeds this value the hardware piece will not work at all.
|
||||
var/malfunction_probability = 10// Chance of malfunction when the component is damaged
|
||||
var/device_type
|
||||
|
||||
/obj/item/weapon/computer_hardware/New(var/obj/L)
|
||||
..()
|
||||
pixel_x = rand(-8, 8)
|
||||
pixel_y = rand(-8, 8)
|
||||
|
||||
/obj/item/weapon/computer_hardware/Destroy()
|
||||
if(holder)
|
||||
holder.uninstall_component(src)
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/weapon/computer_hardware/attackby(obj/item/I, mob/living/user)
|
||||
// Multitool. Runs diagnostics
|
||||
if(istype(I, /obj/item/device/multitool))
|
||||
user << "***** DIAGNOSTICS REPORT *****"
|
||||
diagnostics(user)
|
||||
user << "******************************"
|
||||
return 1
|
||||
|
||||
// Cable coil. Works as repair method, but will probably require multiple applications and more cable.
|
||||
if(istype(I, /obj/item/stack/cable_coil))
|
||||
var/obj/item/stack/S = I
|
||||
if(obj_integrity == max_integrity)
|
||||
user << "<span class='warning'>\The [src] doesn't seem to require repairs.</span>"
|
||||
return 1
|
||||
if(S.use(1))
|
||||
user << "<span class='notice'>You patch up \the [src] with a bit of \the [I].</span>"
|
||||
obj_integrity = min(obj_integrity + 10, max_integrity)
|
||||
return 1
|
||||
|
||||
if(try_insert(I, user))
|
||||
return 1
|
||||
|
||||
return ..()
|
||||
|
||||
// Called on multitool click, prints diagnostic information to the user.
|
||||
/obj/item/weapon/computer_hardware/proc/diagnostics(var/mob/user)
|
||||
user << "Hardware Integrity Test... (Corruption: [damage]/[max_damage]) [damage > damage_failure ? "FAIL" : damage > damage_malfunction ? "WARN" : "PASS"]"
|
||||
|
||||
// Handles damage checks
|
||||
/obj/item/weapon/computer_hardware/proc/check_functionality()
|
||||
if(!enabled) // Disabled.
|
||||
return FALSE
|
||||
|
||||
if(damage > damage_failure) // Too damaged to work at all.
|
||||
return FALSE
|
||||
|
||||
if(damage > damage_malfunction) // Still working. Well, sometimes...
|
||||
if(prob(malfunction_probability))
|
||||
return FALSE
|
||||
|
||||
return TRUE // Good to go.
|
||||
|
||||
/obj/item/weapon/computer_hardware/examine(var/mob/user)
|
||||
. = ..()
|
||||
if(damage > damage_failure)
|
||||
user << "<span class='danger'>It seems to be severely damaged!</span>"
|
||||
else if(damage > damage_malfunction)
|
||||
user << "<span class='warning'>It seems to be damaged!</span>"
|
||||
else if(damage)
|
||||
user << "<span class='notice'>It seems to be slightly damaged.</span>"
|
||||
|
||||
// Component-side compatibility check.
|
||||
/obj/item/weapon/computer_hardware/proc/can_install(obj/item/device/modular_computer/M, mob/living/user = null)
|
||||
return can_install
|
||||
|
||||
// Called when component is installed into PC.
|
||||
/obj/item/weapon/computer_hardware/proc/on_install(obj/item/device/modular_computer/M, mob/living/user = null)
|
||||
return
|
||||
|
||||
// Called when component is removed from PC.
|
||||
/obj/item/weapon/computer_hardware/proc/on_remove(obj/item/device/modular_computer/M, mob/living/user = null)
|
||||
try_eject(forced = 1)
|
||||
|
||||
// Called when someone tries to insert something in it - paper in printer, card in card reader, etc.
|
||||
/obj/item/weapon/computer_hardware/proc/try_insert(obj/item/I, mob/living/user = null)
|
||||
return FALSE
|
||||
|
||||
// Called when someone tries to eject something from it - card from card reader, etc.
|
||||
/obj/item/weapon/computer_hardware/proc/try_eject(slot=0, mob/living/user = null, forced = 0)
|
||||
return FALSE
|
||||
Reference in New Issue
Block a user