mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-20 18:47:20 +01:00
Robot_module and cyborg stack refactor (#13527)
* robot_module refactor * some fixes 1. adds medical stacks of 25 for the syndi medical borg 2. fixes various construction steps that weren't using `use()` or `get_amount()` * review tweaks + other stuff 1. Makes a bunch of for loops into istypeless loops 2. Adds a readout of the current out of stacks a borg has, in the status panel 3. Slightly reorganizes the medical, syndi medical, engineering and syndi engineering cyborgs items * fixes after upstream merge * blank line for travis * fixes and improvements 1. Fixed welder icon's not updating periodically if you were charging in a borg recharger 2. Fixes solar panels dropping /cyborg type glass when they were deconstructed. 3. Band-aid fix (incase #2 doesn't fix this) for cyborg stack's `source` var being null which resulted in tons of "cannot read null.energy" runtimes * more fixes + constructable frame runtime fix * removes toy sword placeholder remove comment * remove these as well * .amount to .get_amount(), really should have done this before * refactors robot_upgrades to work with the new system - more cleanup - adds documentation - fixed a bug I made where you could delete your robot stack via crafting * moves some unemag logic to the module file, makes more loops typless * farie review * fox review * affected review and more TM bugfixes * fixes comment Co-authored-by: SteelSlayer <SteelSlayer@users.noreply.github.com>
This commit is contained in:
co-authored by
SteelSlayer
parent
663eff7b5e
commit
e4bbd94d6a
@@ -728,3 +728,6 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect
|
||||
if(flags & SLOT_PDA)
|
||||
owner.update_inv_wear_pda()
|
||||
|
||||
/// Called on cyborg items that need special charging behavior. Override as needed for specific items.
|
||||
/obj/item/proc/cyborg_recharge(coeff = 1, emagged = FALSE)
|
||||
return
|
||||
|
||||
@@ -176,6 +176,12 @@
|
||||
..()
|
||||
new /obj/effect/temp_visual/borgflash(get_turf(src))
|
||||
|
||||
/obj/item/flash/cyborg/cyborg_recharge(coeff, emagged)
|
||||
if(broken)
|
||||
broken = FALSE
|
||||
times_used = 0
|
||||
icon_state = "flash"
|
||||
|
||||
/obj/item/flash/cameraflash
|
||||
name = "camera"
|
||||
icon = 'icons/obj/items.dmi'
|
||||
|
||||
@@ -262,6 +262,10 @@
|
||||
/obj/item/lightreplacer/cyborg/janicart_insert(mob/user, obj/structure/janitorialcart/J)
|
||||
return
|
||||
|
||||
/obj/item/lightreplacer/cyborg/cyborg_recharge(coeff, emagged)
|
||||
for(var/I in 1 to coeff)
|
||||
Charge()
|
||||
|
||||
#undef LIGHT_OK
|
||||
#undef LIGHT_EMPTY
|
||||
#undef LIGHT_BROKEN
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
return
|
||||
else if(iscoil(W) && buildstage == 1)
|
||||
var/obj/item/stack/cable_coil/coil = W
|
||||
if(coil.amount < 5)
|
||||
if(coil.get_amount() < 5)
|
||||
to_chat(user, "<span class='warning'>You need more cable for this!</span>")
|
||||
return
|
||||
if(do_after(user, 10 * coil.toolspeed, target = src) && buildstage == 1)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
return 1
|
||||
if(istype(I, /obj/item/stack))
|
||||
var/obj/item/stack/S = I
|
||||
if(S.amount > 1)
|
||||
if(S.get_amount() > 1)
|
||||
var/obj/item/stack/to_add = S.split(user, 1)
|
||||
to_add.forceMove(src)
|
||||
user.visible_message("<span class='notice'>[user] adds one of [S] to [src].</span>", "<span class='notice'>You add one of [S] to [src].</span>")
|
||||
|
||||
@@ -7,19 +7,72 @@
|
||||
icon = 'icons/obj/module.dmi'
|
||||
icon_state = "cyborg_upgrade"
|
||||
origin_tech = "programming=2"
|
||||
var/locked = 0
|
||||
var/installed = 0
|
||||
/// Whether or not the cyborg needs to have a chosen module before they can recieve this upgrade.
|
||||
var/require_module = FALSE
|
||||
/// The type of module this upgrade is compatible with: Engineering, Medical, etc.
|
||||
var/module_type = null
|
||||
/// A list of items, and their replacements that this upgrade should replace on installation, in the format of `item_type_to_replace = replacement_item_type`.
|
||||
var/list/items_to_replace = list()
|
||||
/// A list of replacement items will need to be placed into a cyborg module's `special_rechargable` list after this upgrade is installed.
|
||||
var/list/special_rechargables = list()
|
||||
|
||||
/**
|
||||
* Called when someone clicks on a borg with an upgrade in their hand.
|
||||
*
|
||||
* Arguments:
|
||||
* * R - the cyborg that was clicked on with an upgrade.
|
||||
*/
|
||||
/obj/item/borg/upgrade/proc/action(mob/living/silicon/robot/R)
|
||||
if(!pre_install_checks(R))
|
||||
return
|
||||
if(!do_install(R))
|
||||
return
|
||||
after_install(R)
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* Checks if the upgrade is able to be applied to the cyborg, before actually applying it.
|
||||
*
|
||||
* Arguments:
|
||||
* * R - the cyborg that was clicked on with an upgrade.
|
||||
*/
|
||||
/obj/item/borg/upgrade/proc/pre_install_checks(mob/living/silicon/robot/R)
|
||||
if(R.stat == DEAD)
|
||||
to_chat(usr, "<span class='notice'>[src] will not function on a deceased cyborg.</span>")
|
||||
return TRUE
|
||||
to_chat(usr, "<span class='warning'>[src] will not function on a deceased cyborg.</span>")
|
||||
return FALSE
|
||||
if(module_type && !istype(R.module, module_type))
|
||||
to_chat(R, "Upgrade mounting error! No suitable hardpoint detected!")
|
||||
to_chat(usr, "There's no mounting point for the module!")
|
||||
return TRUE
|
||||
to_chat(R, "<span class='warning'>Upgrade mounting error! No suitable hardpoint detected!</span>")
|
||||
to_chat(usr, "<span class='warning'>There's no mounting point for the module!</span>")
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* Executes code that will modify the cyborg or its module.
|
||||
*
|
||||
* Arguments:
|
||||
* * R - the cyborg we're applying the upgrade to.
|
||||
*/
|
||||
/obj/item/borg/upgrade/proc/do_install(mob/living/silicon/robot/R)
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* Executes code after the module has been installed and the cyborg has been modified in some way.
|
||||
*
|
||||
* Arguments:
|
||||
* * R - the cyborg that we've applied the upgrade to.
|
||||
*/
|
||||
/obj/item/borg/upgrade/proc/after_install(mob/living/silicon/robot/R)
|
||||
for(var/item in items_to_replace)
|
||||
var/replacement_type = items_to_replace[item]
|
||||
var/obj/item/replacement = new replacement_type(R.module)
|
||||
R.module.remove_item_from_lists(item)
|
||||
R.module.basic_modules += replacement
|
||||
|
||||
if(replacement_type in special_rechargables)
|
||||
R.module.special_rechargables += replacement
|
||||
|
||||
R.module.rebuild_modules()
|
||||
return TRUE
|
||||
|
||||
/obj/item/borg/upgrade/reset
|
||||
name = "cyborg module reset board"
|
||||
@@ -27,14 +80,13 @@
|
||||
icon_state = "cyborg_upgrade1"
|
||||
require_module = TRUE
|
||||
|
||||
/obj/item/borg/upgrade/reset/action(mob/living/silicon/robot/R)
|
||||
if(..())
|
||||
return
|
||||
|
||||
/obj/item/borg/upgrade/reset/do_install(mob/living/silicon/robot/R)
|
||||
R.reset_module()
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/item/borg/upgrade/reset/after_install(mob/living/silicon/robot/R)
|
||||
return // We don't need to give them replacement items, or rebuild their module list. It's going to be a blank borg.
|
||||
|
||||
/obj/item/borg/upgrade/rename
|
||||
name = "cyborg reclassification board"
|
||||
desc = "Used to rename a cyborg."
|
||||
@@ -44,9 +96,7 @@
|
||||
/obj/item/borg/upgrade/rename/attack_self(mob/user)
|
||||
heldname = stripped_input(user, "Enter new robot name", "Cyborg Reclassification", heldname, MAX_NAME_LEN)
|
||||
|
||||
/obj/item/borg/upgrade/rename/action(mob/living/silicon/robot/R)
|
||||
if(..())
|
||||
return
|
||||
/obj/item/borg/upgrade/rename/do_install(mob/living/silicon/robot/R)
|
||||
if(!R.allow_rename)
|
||||
to_chat(R, "<span class='warning'>Internal diagnostic error: incompatible upgrade module detected.</span>")
|
||||
return 0
|
||||
@@ -63,7 +113,7 @@
|
||||
desc = "Used to force a reboot of a disabled-but-repaired cyborg, bringing it back online."
|
||||
icon_state = "cyborg_upgrade1"
|
||||
|
||||
/obj/item/borg/upgrade/restart/action(mob/living/silicon/robot/R)
|
||||
/obj/item/borg/upgrade/restart/do_install(mob/living/silicon/robot/R)
|
||||
if(R.health < 0)
|
||||
to_chat(usr, "<span class='warning'>You have to repair the cyborg before using this module!</span>")
|
||||
return 0
|
||||
@@ -88,9 +138,7 @@
|
||||
require_module = TRUE
|
||||
origin_tech = "engineering=4;materials=5;programming=4"
|
||||
|
||||
/obj/item/borg/upgrade/vtec/action(mob/living/silicon/robot/R)
|
||||
if(..())
|
||||
return
|
||||
/obj/item/borg/upgrade/vtec/do_install(mob/living/silicon/robot/R)
|
||||
if(R.speed < 0)
|
||||
to_chat(R, "<span class='notice'>A VTEC unit is already installed!</span>")
|
||||
to_chat(usr, "<span class='notice'>There's no room for another VTEC unit!</span>")
|
||||
@@ -108,10 +156,7 @@
|
||||
require_module = TRUE
|
||||
module_type = /obj/item/robot_module/security
|
||||
|
||||
/obj/item/borg/upgrade/disablercooler/action(mob/living/silicon/robot/R)
|
||||
if(..())
|
||||
return
|
||||
|
||||
/obj/item/borg/upgrade/disablercooler/do_install(mob/living/silicon/robot/R)
|
||||
var/obj/item/gun/energy/disabler/cyborg/T = locate() in R.module.modules
|
||||
if(!T)
|
||||
to_chat(usr, "<span class='notice'>There's no disabler in this unit!</span>")
|
||||
@@ -131,10 +176,7 @@
|
||||
icon_state = "cyborg_upgrade3"
|
||||
origin_tech = "engineering=4;powerstorage=4"
|
||||
|
||||
/obj/item/borg/upgrade/thrusters/action(mob/living/silicon/robot/R)
|
||||
if(..())
|
||||
return
|
||||
|
||||
/obj/item/borg/upgrade/thrusters/do_install(mob/living/silicon/robot/R)
|
||||
if(R.ionpulse)
|
||||
to_chat(usr, "<span class='notice'>This unit already has ion thrusters installed!</span>")
|
||||
return
|
||||
@@ -149,20 +191,9 @@
|
||||
origin_tech = "engineering=4;materials=5"
|
||||
require_module = TRUE
|
||||
module_type = /obj/item/robot_module/miner
|
||||
|
||||
/obj/item/borg/upgrade/ddrill/action(mob/living/silicon/robot/R)
|
||||
if(..())
|
||||
return
|
||||
|
||||
for(var/obj/item/pickaxe/drill/cyborg/D in R.module.modules)
|
||||
qdel(D)
|
||||
for(var/obj/item/shovel/S in R.module.modules)
|
||||
qdel(S)
|
||||
|
||||
R.module.modules += new /obj/item/pickaxe/drill/cyborg/diamond(R.module)
|
||||
R.module.rebuild()
|
||||
|
||||
return TRUE
|
||||
items_to_replace = list(
|
||||
/obj/item/pickaxe/drill/cyborg = /obj/item/pickaxe/drill/cyborg/diamond
|
||||
)
|
||||
|
||||
/obj/item/borg/upgrade/soh
|
||||
name = "mining cyborg satchel of holding"
|
||||
@@ -171,18 +202,9 @@
|
||||
origin_tech = "engineering=4;materials=4;bluespace=4"
|
||||
require_module = TRUE
|
||||
module_type = /obj/item/robot_module/miner
|
||||
|
||||
/obj/item/borg/upgrade/soh/action(mob/living/silicon/robot/R)
|
||||
if(..())
|
||||
return
|
||||
|
||||
for(var/obj/item/storage/bag/ore/cyborg/S in R.module.modules)
|
||||
qdel(S)
|
||||
|
||||
R.module.modules += new /obj/item/storage/bag/ore/holding(R.module)
|
||||
R.module.rebuild()
|
||||
|
||||
return TRUE
|
||||
items_to_replace = list(
|
||||
/obj/item/storage/bag/ore/cyborg = /obj/item/storage/bag/ore/holding
|
||||
)
|
||||
|
||||
/obj/item/borg/upgrade/abductor_engi
|
||||
name = "engineering cyborg abductor upgrade"
|
||||
@@ -191,33 +213,17 @@
|
||||
origin_tech = "engineering=6;materials=6;abductor=3"
|
||||
require_module = TRUE
|
||||
module_type = /obj/item/robot_module/engineering
|
||||
|
||||
/obj/item/borg/upgrade/abductor_engi/action(mob/living/silicon/robot/R)
|
||||
if(..())
|
||||
return
|
||||
|
||||
for(var/obj/item/weldingtool/largetank/cyborg/W in R.module.modules)
|
||||
qdel(W)
|
||||
for(var/obj/item/screwdriver/cyborg/S in R.module.modules)
|
||||
qdel(S)
|
||||
for(var/obj/item/wrench/cyborg/E in R.module.modules)
|
||||
qdel(E)
|
||||
for(var/obj/item/crowbar/cyborg/C in R.module.modules)
|
||||
qdel(C)
|
||||
for(var/obj/item/wirecutters/cyborg/I in R.module.modules)
|
||||
qdel(I)
|
||||
for(var/obj/item/multitool/cyborg/M in R.module.modules)
|
||||
qdel(M)
|
||||
|
||||
R.module.modules += new /obj/item/weldingtool/abductor(R.module)
|
||||
R.module.modules += new /obj/item/wrench/abductor(R.module)
|
||||
R.module.modules += new /obj/item/screwdriver/abductor(R.module)
|
||||
R.module.modules += new /obj/item/crowbar/abductor(R.module)
|
||||
R.module.modules += new /obj/item/wirecutters/abductor(R.module)
|
||||
R.module.modules += new /obj/item/multitool/abductor(R.module)
|
||||
R.module.rebuild()
|
||||
|
||||
return TRUE
|
||||
items_to_replace = list(
|
||||
/obj/item/weldingtool = /obj/item/weldingtool/abductor,
|
||||
/obj/item/wrench = /obj/item/wrench/abductor,
|
||||
/obj/item/screwdriver = /obj/item/screwdriver/abductor,
|
||||
/obj/item/crowbar = /obj/item/crowbar/abductor,
|
||||
/obj/item/wirecutters = /obj/item/wirecutters/abductor,
|
||||
/obj/item/multitool = /obj/item/multitool/abductor
|
||||
)
|
||||
special_rechargables = list(
|
||||
/obj/item/weldingtool/abductor
|
||||
)
|
||||
|
||||
/obj/item/borg/upgrade/abductor_medi
|
||||
name = "medical cyborg abductor upgrade"
|
||||
@@ -226,39 +232,16 @@
|
||||
origin_tech = "biotech=6;materials=6;abductor=3"
|
||||
require_module = TRUE
|
||||
module_type = /obj/item/robot_module/medical
|
||||
|
||||
/obj/item/borg/upgrade/abductor_medi/action(mob/living/silicon/robot/R)
|
||||
if(..())
|
||||
return
|
||||
|
||||
for(var/obj/item/scalpel/laser/laser1/L in R.module.modules)
|
||||
qdel(L)
|
||||
for(var/obj/item/hemostat/H in R.module.modules)
|
||||
qdel(H)
|
||||
for(var/obj/item/retractor/E in R.module.modules)
|
||||
qdel(E)
|
||||
for(var/obj/item/bonegel/B in R.module.modules)
|
||||
qdel(B)
|
||||
for(var/obj/item/FixOVein/F in R.module.modules)
|
||||
qdel(F)
|
||||
for(var/obj/item/bonesetter/S in R.module.modules)
|
||||
qdel(S)
|
||||
for(var/obj/item/circular_saw/C in R.module.modules)
|
||||
qdel(C)
|
||||
for(var/obj/item/surgicaldrill/D in R.module.modules)
|
||||
qdel(D)
|
||||
|
||||
R.module.modules += new /obj/item/scalpel/laser/laser3(R.module) //no abductor laser scalpel, so next best thing.
|
||||
R.module.modules += new /obj/item/hemostat/alien(R.module)
|
||||
R.module.modules += new /obj/item/retractor/alien(R.module)
|
||||
R.module.modules += new /obj/item/bonegel/alien(R.module)
|
||||
R.module.modules += new /obj/item/FixOVein/alien(R.module)
|
||||
R.module.modules += new /obj/item/bonesetter/alien(R.module)
|
||||
R.module.modules += new /obj/item/circular_saw/alien(R.module)
|
||||
R.module.modules += new /obj/item/surgicaldrill/alien(R.module)
|
||||
R.module.rebuild()
|
||||
|
||||
return TRUE
|
||||
items_to_replace = list(
|
||||
/obj/item/scalpel/laser/laser1 = /obj/item/scalpel/laser/laser3, // No abductor laser scalpel, so next best thing.
|
||||
/obj/item/hemostat = /obj/item/hemostat/alien,
|
||||
/obj/item/retractor = /obj/item/retractor/alien,
|
||||
/obj/item/bonegel = /obj/item/bonegel/alien,
|
||||
/obj/item/FixOVein = /obj/item/FixOVein/alien,
|
||||
/obj/item/bonesetter = /obj/item/bonesetter/alien,
|
||||
/obj/item/circular_saw = /obj/item/circular_saw/alien,
|
||||
/obj/item/surgicaldrill = /obj/item/surgicaldrill/alien
|
||||
)
|
||||
|
||||
/obj/item/borg/upgrade/syndicate
|
||||
name = "safety override module"
|
||||
@@ -267,13 +250,11 @@
|
||||
origin_tech = "combat=6;materials=6"
|
||||
require_module = TRUE
|
||||
|
||||
/obj/item/borg/upgrade/syndicate/action(mob/living/silicon/robot/R)
|
||||
if(..())
|
||||
return
|
||||
/obj/item/borg/upgrade/syndicate/do_install(mob/living/silicon/robot/R)
|
||||
if(R.weapons_unlock)
|
||||
to_chat(R, "<span class='warning'>Warning: Safety Overide Protocols have be disabled.</span>")
|
||||
return
|
||||
R.weapons_unlock = 1
|
||||
return // They already had the safety override upgrade, or they're a cyborg type which has this by default.
|
||||
R.weapons_unlock = TRUE
|
||||
to_chat(R, "<span class='warning'>Warning: Safety Overide Protocols have be disabled.</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/item/borg/upgrade/lavaproof
|
||||
@@ -284,9 +265,7 @@
|
||||
require_module = TRUE
|
||||
module_type = /obj/item/robot_module/miner
|
||||
|
||||
/obj/item/borg/upgrade/lavaproof/action(mob/living/silicon/robot/R)
|
||||
if(..())
|
||||
return
|
||||
/obj/item/borg/upgrade/lavaproof/do_install(mob/living/silicon/robot/R)
|
||||
if(istype(R))
|
||||
R.weather_immunities += "lava"
|
||||
return TRUE
|
||||
@@ -303,10 +282,7 @@
|
||||
var/powercost = 10
|
||||
var/mob/living/silicon/robot/cyborg
|
||||
|
||||
/obj/item/borg/upgrade/selfrepair/action(mob/living/silicon/robot/R)
|
||||
if(..())
|
||||
return
|
||||
|
||||
/obj/item/borg/upgrade/selfrepair/do_install(mob/living/silicon/robot/R)
|
||||
var/obj/item/borg/upgrade/selfrepair/U = locate() in R
|
||||
if(U)
|
||||
to_chat(usr, "<span class='warning'>This unit is already equipped with a self-repair module.</span>")
|
||||
|
||||
@@ -17,13 +17,18 @@
|
||||
var/healverb = "bandage"
|
||||
|
||||
/obj/item/stack/medical/attack(mob/living/M, mob/user)
|
||||
if(get_amount() <= 0)
|
||||
if(is_cyborg)
|
||||
to_chat(user, "<span class='warning'>You don't have enough energy to dispense more [singular_name]\s!</span>")
|
||||
return TRUE
|
||||
|
||||
if(!iscarbon(M) && !isanimal(M))
|
||||
to_chat(user, "<span class='danger'>[src] cannot be applied to [M]!</span>")
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
if(!user.IsAdvancedToolUser())
|
||||
to_chat(user, "<span class='danger'>You don't have the dexterity to do this!</span>")
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
|
||||
if(ishuman(M))
|
||||
@@ -167,7 +172,12 @@
|
||||
heal_brute = 25
|
||||
stop_bleeding = 0
|
||||
|
||||
/obj/item/stack/medical/bruise_pack/advanced/cyborg
|
||||
energy_type = /datum/robot_energy_storage/medical/adv_brute_kit
|
||||
is_cyborg = TRUE
|
||||
|
||||
/obj/item/stack/medical/bruise_pack/advanced/cyborg/syndicate
|
||||
energy_type = /datum/robot_energy_storage/medical/adv_brute_kit/syndicate
|
||||
|
||||
//Ointment//
|
||||
|
||||
@@ -208,6 +218,13 @@
|
||||
icon_state = "burnkit"
|
||||
heal_burn = 25
|
||||
|
||||
/obj/item/stack/medical/ointment/advanced/cyborg
|
||||
energy_type = /datum/robot_energy_storage/medical/adv_burn_kit
|
||||
is_cyborg = TRUE
|
||||
|
||||
/obj/item/stack/medical/ointment/advanced/cyborg/syndicate
|
||||
energy_type = /datum/robot_energy_storage/medical/adv_burn_kit/syndicate
|
||||
|
||||
//Medical Herbs//
|
||||
/obj/item/stack/medical/bruise_pack/comfrey
|
||||
name = "\improper Comfrey leaf"
|
||||
@@ -283,6 +300,13 @@
|
||||
H.handle_splints()
|
||||
use(1)
|
||||
|
||||
/obj/item/stack/medical/splint/cyborg
|
||||
energy_type = /datum/robot_energy_storage/medical/splint
|
||||
is_cyborg = TRUE
|
||||
|
||||
/obj/item/stack/medical/splint/cyborg/syndicate
|
||||
energy_type = /datum/robot_energy_storage/medical/splint/syndicate
|
||||
|
||||
/obj/item/stack/medical/splint/tribal
|
||||
name = "tribal splints"
|
||||
icon_state = "tribal_splint"
|
||||
|
||||
@@ -63,3 +63,16 @@
|
||||
to_chat(user, "<span class='notice'>Nothing to fix here.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[src] won't work on that.</span>")
|
||||
|
||||
/obj/item/stack/nanopaste/cyborg
|
||||
energy_type = /datum/robot_energy_storage/medical/nanopaste
|
||||
is_cyborg = TRUE
|
||||
|
||||
/obj/item/stack/nanopaste/cyborg/attack(mob/living/M, mob/user)
|
||||
if(get_amount() <= 0)
|
||||
to_chat(user, "<span class='warning'>You don't have enough energy to dispense more [name]!</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/stack/nanopaste/cyborg/syndicate
|
||||
energy_type = /datum/robot_energy_storage/medical/nanopaste/syndicate
|
||||
|
||||
@@ -21,10 +21,16 @@ GLOBAL_LIST_INIT(rod_recipes, list ( \
|
||||
hitsound = 'sound/weapons/grenadelaunch.ogg'
|
||||
toolspeed = 1
|
||||
usesound = 'sound/items/deconstruct.ogg'
|
||||
merge_type = /obj/item/stack/rods
|
||||
|
||||
/obj/item/stack/rods/cyborg
|
||||
energy_type = /datum/robot_energy_storage/rods
|
||||
is_cyborg = TRUE
|
||||
materials = list()
|
||||
|
||||
/obj/item/stack/rods/cyborg/update_icon()
|
||||
return // icon_state should always be a full stack of rods.
|
||||
|
||||
/obj/item/stack/rods/ten
|
||||
amount = 10
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ GLOBAL_LIST_INIT(glass_recipes, list ( \
|
||||
amount = 50
|
||||
|
||||
/obj/item/stack/sheet/glass/cyborg
|
||||
energy_type = /datum/robot_energy_storage/glass
|
||||
is_cyborg = TRUE
|
||||
materials = list()
|
||||
|
||||
/obj/item/stack/sheet/glass/New(loc, amount)
|
||||
@@ -48,15 +50,15 @@ GLOBAL_LIST_INIT(glass_recipes, list ( \
|
||||
|
||||
/obj/item/stack/sheet/glass/attackby(obj/item/W, mob/user, params)
|
||||
..()
|
||||
if(istype(W,/obj/item/stack/cable_coil))
|
||||
if(istype(W, /obj/item/stack/cable_coil))
|
||||
var/obj/item/stack/cable_coil/CC = W
|
||||
if(CC.amount < 5)
|
||||
if(CC.get_amount() < 5)
|
||||
to_chat(user, "<b>There is not enough wire in this coil. You need 5 lengths.</b>")
|
||||
return
|
||||
CC.use(5)
|
||||
to_chat(user, "<span class='notice'>You attach wire to the [name].</span>")
|
||||
new /obj/item/stack/light_w(user.loc)
|
||||
src.use(1)
|
||||
use(1)
|
||||
else if( istype(W, /obj/item/stack/rods) )
|
||||
var/obj/item/stack/rods/V = W
|
||||
var/obj/item/stack/sheet/rglass/RG = new (user.loc)
|
||||
@@ -97,9 +99,6 @@ GLOBAL_LIST_INIT(reinforced_glass_recipes, list ( \
|
||||
merge_type = /obj/item/stack/sheet/rglass
|
||||
point_value = 4
|
||||
|
||||
/obj/item/stack/sheet/rglass/cyborg
|
||||
materials = list()
|
||||
|
||||
/obj/item/stack/sheet/rglass/New(loc, amount)
|
||||
recipes = GLOB.reinforced_glass_recipes
|
||||
..()
|
||||
@@ -109,6 +108,11 @@ GLOBAL_LIST_INIT(pglass_recipes, list ( \
|
||||
new/datum/stack_recipe/window("fulltile window", /obj/structure/window/full/plasmabasic, 2, time = 0, on_floor = TRUE, window_checks = TRUE) \
|
||||
))
|
||||
|
||||
/obj/item/stack/sheet/rglass/cyborg
|
||||
energy_type = /datum/robot_energy_storage/rglass
|
||||
is_cyborg = TRUE
|
||||
materials = list()
|
||||
|
||||
/obj/item/stack/sheet/plasmaglass
|
||||
name = "plasma glass"
|
||||
desc = "A very strong and very resistant sheet of a plasma-glass alloy."
|
||||
|
||||
@@ -13,25 +13,16 @@
|
||||
flags = CONDUCT
|
||||
max_amount = 60
|
||||
|
||||
/obj/item/stack/light_w/attackby(obj/item/O as obj, mob/user as mob, params)
|
||||
/obj/item/stack/light_w/attackby(obj/item/I, mob/user, params)
|
||||
..()
|
||||
if(istype(O,/obj/item/wirecutters))
|
||||
var/obj/item/stack/cable_coil/CC = new/obj/item/stack/cable_coil(user.loc)
|
||||
if(istype(I, /obj/item/wirecutters))
|
||||
var/obj/item/stack/cable_coil/CC = new(user.loc)
|
||||
CC.amount = 5
|
||||
amount--
|
||||
new/obj/item/stack/sheet/glass(user.loc)
|
||||
if(amount <= 0)
|
||||
user.unEquip(src, 1)
|
||||
qdel(src)
|
||||
use(1)
|
||||
|
||||
if(istype(O,/obj/item/stack/sheet/metal))
|
||||
var/obj/item/stack/sheet/metal/M = O
|
||||
M.amount--
|
||||
if(M.amount <= 0)
|
||||
user.unEquip(src, 1)
|
||||
qdel(M)
|
||||
amount--
|
||||
new/obj/item/stack/tile/light(user.loc)
|
||||
if(amount <= 0)
|
||||
user.unEquip(src, 1)
|
||||
qdel(src)
|
||||
if(istype(I, /obj/item/stack/sheet/metal))
|
||||
var/obj/item/stack/sheet/metal/M = I
|
||||
M.use(1)
|
||||
new /obj/item/stack/tile/light(user.loc)
|
||||
use(1)
|
||||
|
||||
@@ -110,6 +110,8 @@ GLOBAL_LIST_INIT(metal_recipes, list(
|
||||
point_value = 2
|
||||
|
||||
/obj/item/stack/sheet/metal/cyborg
|
||||
energy_type = /datum/robot_energy_storage/metal
|
||||
is_cyborg = TRUE
|
||||
materials = list()
|
||||
|
||||
/obj/item/stack/sheet/metal/fifty
|
||||
@@ -162,6 +164,10 @@ GLOBAL_LIST_INIT(plasteel_recipes, list(
|
||||
recipes = GLOB.plasteel_recipes
|
||||
return ..()
|
||||
|
||||
/obj/item/stack/sheet/wood/cyborg
|
||||
energy_type = /datum/robot_energy_storage/wood
|
||||
is_cyborg = TRUE
|
||||
|
||||
/*
|
||||
* Wood
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,16 @@
|
||||
*/
|
||||
/obj/item/stack
|
||||
origin_tech = "materials=1"
|
||||
var/list/recipes = list() // /datum/stack_recipe
|
||||
/// Whether this stack is a `/cyborg` subtype or not.
|
||||
var/is_cyborg = FALSE
|
||||
/// The energy storage datum that will be used with this stack. Used only with `/cyborg` type stacks.
|
||||
var/datum/robot_energy_storage/source
|
||||
/// Which `robot_energy_storage` to choose when this stack is created in cyborgs. Used only with `/cyborg` type stacks.
|
||||
var/energy_type
|
||||
/// How much energy using 1 sheet from the stack costs. Used only with `/cyborg` type stacks.
|
||||
var/cost = 1
|
||||
/// A list of recipes buildable with this stack.
|
||||
var/list/recipes = list()
|
||||
var/singular_name
|
||||
var/amount = 1
|
||||
var/to_transfer = 0
|
||||
@@ -52,15 +61,27 @@
|
||||
|
||||
/obj/item/stack/examine(mob/user)
|
||||
. = ..()
|
||||
if(in_range(user, src))
|
||||
if(!in_range(user, src))
|
||||
return
|
||||
|
||||
if(is_cyborg)
|
||||
if(singular_name)
|
||||
. += "There are [amount] [singular_name]\s in the stack."
|
||||
. += "There is enough energy for [get_amount()] [singular_name]\s."
|
||||
else
|
||||
. += "There are [amount] [name]\s in the stack."
|
||||
. +="<span class='notice'>Alt-click to take a custom amount.</span>"
|
||||
. += "There is enough energy for [get_amount()]."
|
||||
return
|
||||
|
||||
if(singular_name)
|
||||
. += "There are [amount] [singular_name]\s in the stack."
|
||||
else
|
||||
. += "There are [amount] [name]\s in the stack."
|
||||
. +="<span class='notice'>Alt-click to take a custom amount.</span>"
|
||||
|
||||
/obj/item/stack/proc/add(newamount)
|
||||
amount += newamount
|
||||
if(is_cyborg)
|
||||
source.add_charge(newamount * cost)
|
||||
else
|
||||
amount += newamount
|
||||
update_icon()
|
||||
|
||||
/obj/item/stack/attack_self(mob/user)
|
||||
@@ -87,8 +108,10 @@
|
||||
if(!recipes)
|
||||
return
|
||||
|
||||
if(amount <= 0)
|
||||
if(get_amount() <= 0)
|
||||
user << browse(null, "window=stack")
|
||||
if(is_cyborg)
|
||||
to_chat(user, "<span class='warning'>You don't have enough energy to dispense more [name]!</span>")
|
||||
return
|
||||
|
||||
user.set_machine(src) //for correct work of onclose
|
||||
@@ -98,7 +121,7 @@
|
||||
var/datum/stack_recipe_list/srl = recipe_list[recipes_sublist]
|
||||
recipe_list = srl.recipes
|
||||
|
||||
var/t1 = "Amount Left: [amount]<br>"
|
||||
var/t1 = "Amount Left: [get_amount()]<br>"
|
||||
for(var/i in 1 to recipe_list.len)
|
||||
var/E = recipe_list[i]
|
||||
if(isnull(E))
|
||||
@@ -114,7 +137,7 @@
|
||||
|
||||
if(istype(E, /datum/stack_recipe))
|
||||
var/datum/stack_recipe/R = E
|
||||
var/max_multiplier = round(amount / R.req_amount)
|
||||
var/max_multiplier = round(get_amount() / R.req_amount)
|
||||
var/title
|
||||
var/can_build = 1
|
||||
can_build = can_build && (max_multiplier > 0)
|
||||
@@ -154,7 +177,7 @@
|
||||
list_recipes(usr, text2num(href_list["sublist"]))
|
||||
|
||||
if(href_list["make"])
|
||||
if(amount < 1)
|
||||
if(amount < 0 && !is_cyborg)
|
||||
qdel(src) //Never should happen
|
||||
|
||||
var/list/recipes_list = recipes
|
||||
@@ -167,8 +190,8 @@
|
||||
if(!multiplier || multiplier <= 0 || multiplier > 50) // Href exploit checks
|
||||
multiplier = 1
|
||||
|
||||
if(amount < R.req_amount * multiplier)
|
||||
if(R.req_amount * multiplier>1)
|
||||
if(get_amount() < R.req_amount * multiplier)
|
||||
if(R.req_amount * multiplier > 1)
|
||||
to_chat(usr, "<span class='warning'>You haven't got enough [src] to build \the [R.req_amount * multiplier] [R.title]\s!</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>You haven't got enough [src] to build \the [R.title]!</span>")
|
||||
@@ -195,7 +218,7 @@
|
||||
if(!do_after(usr, R.time, target = usr))
|
||||
return 0
|
||||
|
||||
if(amount < R.req_amount * multiplier)
|
||||
if(get_amount() < R.req_amount * multiplier)
|
||||
return
|
||||
|
||||
var/atom/O
|
||||
@@ -205,6 +228,7 @@
|
||||
O = new R.result_type(usr.drop_location())
|
||||
O.setDir(usr.dir)
|
||||
use(R.req_amount * multiplier)
|
||||
updateUsrDialog()
|
||||
|
||||
R.post_build(src, O)
|
||||
|
||||
@@ -231,6 +255,8 @@
|
||||
/obj/item/stack/use(used, check = TRUE)
|
||||
if(check && zero_amount())
|
||||
return FALSE
|
||||
if(is_cyborg)
|
||||
return source.use_charge(used * cost)
|
||||
if(amount < used)
|
||||
return FALSE
|
||||
amount -= used
|
||||
@@ -240,6 +266,8 @@
|
||||
return TRUE
|
||||
|
||||
/obj/item/stack/proc/get_amount()
|
||||
if(is_cyborg)
|
||||
return round(source.energy / cost)
|
||||
return amount
|
||||
|
||||
/obj/item/stack/proc/get_max_amount()
|
||||
@@ -258,7 +286,7 @@
|
||||
return F
|
||||
|
||||
/obj/item/stack/attack_hand(mob/user)
|
||||
if(user.is_in_inactive_hand(src) && amount > 1)
|
||||
if(user.is_in_inactive_hand(src) && get_amount() > 1)
|
||||
change_stack(user, 1)
|
||||
if(src && usr.machine == src)
|
||||
spawn(0)
|
||||
@@ -272,6 +300,8 @@
|
||||
return
|
||||
if(!in_range(src, user))
|
||||
return
|
||||
if(is_cyborg)
|
||||
return
|
||||
if(!ishuman(usr))
|
||||
return
|
||||
if(amount < 1)
|
||||
@@ -305,11 +335,9 @@
|
||||
// Returns TRUE if the stack amount is zero.
|
||||
// Also qdels the stack gracefully if it is.
|
||||
/obj/item/stack/proc/zero_amount()
|
||||
if(is_cyborg)
|
||||
return source.energy < cost
|
||||
if(amount < 1)
|
||||
if(isrobot(loc))
|
||||
var/mob/living/silicon/robot/R = loc
|
||||
if(locate(src) in R.module.modules)
|
||||
R.module.modules -= src
|
||||
if(ismob(loc))
|
||||
var/mob/living/L = loc // At this stage, stack code is so horrible and atrocious, I wouldn't be all surprised ghosts can somehow have stacks. If this happens, then the world deserves to burn.
|
||||
L.unEquip(src, TRUE)
|
||||
@@ -325,7 +353,10 @@
|
||||
if(QDELETED(S) || QDELETED(src) || S == src) //amusingly this can cause a stack to consume itself, let's not allow that.
|
||||
return FALSE
|
||||
var/transfer = get_amount()
|
||||
transfer = min(transfer, S.max_amount - S.amount)
|
||||
if(S.is_cyborg)
|
||||
transfer = min(transfer, round((S.source.max_energy - S.source.energy) / S.cost))
|
||||
else
|
||||
transfer = min(transfer, S.max_amount - S.amount)
|
||||
if(transfer <= 0)
|
||||
return
|
||||
if(pulledby)
|
||||
@@ -333,6 +364,7 @@
|
||||
S.copy_evidences(src)
|
||||
S.add(transfer)
|
||||
use(transfer)
|
||||
return transfer
|
||||
|
||||
/obj/item/stack/proc/copy_evidences(obj/item/stack/from)
|
||||
blood_DNA = from.blood_DNA
|
||||
|
||||
@@ -61,8 +61,13 @@
|
||||
icon_state = "tile-wood"
|
||||
origin_tech = "biotech=1"
|
||||
turf_type = /turf/simulated/floor/wood
|
||||
merge_type = /obj/item/stack/tile/wood
|
||||
resistance_flags = FLAMMABLE
|
||||
|
||||
/obj/item/stack/tile/wood/cyborg
|
||||
energy_type = /datum/robot_energy_storage/wood_tile
|
||||
is_cyborg = TRUE
|
||||
|
||||
//Carpets
|
||||
/obj/item/stack/tile/carpet
|
||||
name = "carpet"
|
||||
@@ -101,6 +106,10 @@
|
||||
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 100, "acid" = 70)
|
||||
resistance_flags = FIRE_PROOF
|
||||
|
||||
/obj/item/stack/tile/plasteel/cyborg
|
||||
energy_type = /datum/robot_energy_storage/metal_tile
|
||||
is_cyborg = TRUE
|
||||
|
||||
//Light
|
||||
/obj/item/stack/tile/light
|
||||
name = "light tiles"
|
||||
|
||||
@@ -177,6 +177,9 @@
|
||||
update_torch()
|
||||
..()
|
||||
|
||||
/obj/item/weldingtool/cyborg_recharge(coeff, emagged)
|
||||
if(reagents.check_and_add("fuel", maximum_fuel, 2 * coeff))
|
||||
update_icon()
|
||||
|
||||
/obj/item/weldingtool/largetank
|
||||
name = "industrial welding tool"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
return
|
||||
else
|
||||
if(loaded.amount < max_amount)
|
||||
var/amount = min(loaded.amount + C.amount, max_amount)
|
||||
var/amount = min(loaded.amount + C.get_amount(), max_amount)
|
||||
C.use(amount - loaded.amount)
|
||||
loaded.amount = amount
|
||||
else
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
desc = "squirts smokey liquids."
|
||||
icon = 'icons/mob/alien.dmi'
|
||||
icon_state = "borg-spray-smoke"
|
||||
list_reagents = list("water" = 50)
|
||||
|
||||
/obj/item/reagent_containers/spray/alien/smoke/afterattack(atom/A as mob|obj, mob/user as mob)
|
||||
if(istype(A, /obj/structure/reagent_dispensers) && get_dist(src,A) <= 1)
|
||||
@@ -45,17 +46,29 @@
|
||||
smoke.start()
|
||||
playsound(user.loc, 'sound/effects/bamf.ogg', 50, 2)
|
||||
|
||||
/obj/item/reagent_containers/spray/alien/smoke/cyborg_recharge(coeff, emagged)
|
||||
reagents.check_and_add("water", volume, 2 * coeff)
|
||||
|
||||
/obj/item/reagent_containers/spray/alien/acid
|
||||
name = "acid synthesizer"
|
||||
desc = "squirts burny liquids."
|
||||
icon = 'icons/mob/alien.dmi'
|
||||
icon_state = "borg-spray-acid"
|
||||
list_reagents = list("facid" = 125, "sacid" = 125)
|
||||
|
||||
/obj/item/reagent_containers/spray/alien/acid/cyborg_recharge(coeff, emagged)
|
||||
reagents.check_and_add("facid", volume / 2, 2 * coeff) // Volume / 2 here becuase there should be an even amount of both chems.
|
||||
reagents.check_and_add("sacid", volume / 2, 2 * coeff)
|
||||
|
||||
/obj/item/reagent_containers/spray/alien/stun
|
||||
name = "paralytic toxin synthesizer"
|
||||
desc = "squirts viagra."
|
||||
icon = 'icons/mob/alien.dmi'
|
||||
icon_state = "borg-spray-stun"
|
||||
list_reagents = list("ether" = 250)
|
||||
|
||||
/obj/item/reagent_containers/spray/alien/stun/cyborg_recharge(coeff, emagged)
|
||||
reagents.check_and_add("ether", volume, 2 * coeff)
|
||||
|
||||
//SKREEEEEEEEEEEE tool
|
||||
|
||||
|
||||
@@ -180,3 +180,6 @@
|
||||
sleep(2)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/extinguisher/cyborg_recharge(coeff, emagged)
|
||||
reagents.check_and_add("water", max_water, 5 * coeff)
|
||||
|
||||
@@ -314,7 +314,7 @@
|
||||
//Therefore, make a new stack internally that has the remainder.
|
||||
// -Sayu
|
||||
|
||||
if(S.amount > S.max_amount)
|
||||
if(S.get_amount() > S.max_amount)
|
||||
var/obj/item/stack/sheet/temp = new S.type(src)
|
||||
temp.amount = S.amount - S.max_amount
|
||||
S.amount = S.max_amount
|
||||
|
||||
@@ -206,6 +206,11 @@
|
||||
return TRUE
|
||||
..()
|
||||
|
||||
/obj/item/melee/baton/cyborg_recharge(coeff, emagged)
|
||||
if(cell)
|
||||
cell.charge = cell.maxcharge
|
||||
update_icon()
|
||||
|
||||
//Makeshift stun baton. Replacement for stun gloves.
|
||||
/obj/item/melee/baton/cattleprod
|
||||
name = "stunprod"
|
||||
|
||||
Reference in New Issue
Block a user