mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 08:08:49 +01:00
[MIRROR] Fixes cyborgs in general replenishing stack modules from external sources (#1846)
* Fixes cyborgs in general replenishing stack modules from external sources (#54935) * Cyborg stack fix - Makes cyborgs capable of recycling floor tiles again * Touches up module code - Makes module code slightly more OOP-compliant - Speeds up module creation by an imperceptable amount - Reworks how borg modules handle stacks * Fixes cyborgs in general replenishing stack modules from external sources * Update robot_modules.dm Co-authored-by: TemporalOroboros <TemporalOroboros@gmail.com> Co-authored-by: Gandalf <jzo123@hotmail.com>
This commit is contained in:
co-authored by
TemporalOroboros
Gandalf
parent
463b168692
commit
3bf844af89
@@ -77,50 +77,23 @@
|
||||
. += m
|
||||
|
||||
/obj/item/robot_module/proc/get_or_create_estorage(storage_type)
|
||||
for(var/datum/robot_energy_storage/S in storages)
|
||||
if(istype(S, storage_type))
|
||||
return S
|
||||
|
||||
return new storage_type(src)
|
||||
return (locate(storage_type) in storages) || new storage_type(src)
|
||||
|
||||
/obj/item/robot_module/proc/add_module(obj/item/I, nonstandard, requires_rebuild)
|
||||
if(istype(I, /obj/item/stack))
|
||||
var/obj/item/stack/S = I
|
||||
var/obj/item/stack/sheet_module = I
|
||||
if(ispath(sheet_module.source, /datum/robot_energy_storage))
|
||||
sheet_module.source = get_or_create_estorage(sheet_module.source)
|
||||
|
||||
if(is_type_in_list(S, list(/obj/item/stack/sheet/metal, /obj/item/stack/rods, /obj/item/stack/tile/plasteel)))
|
||||
if(S.custom_materials?.len)
|
||||
if(S.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)])
|
||||
S.cost = S.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)] * 0.25
|
||||
S.source = get_or_create_estorage(/datum/robot_energy_storage/metal)
|
||||
if(istype(sheet_module, /obj/item/stack/sheet/rglass/cyborg))
|
||||
var/obj/item/stack/sheet/rglass/cyborg/rglass_module = sheet_module
|
||||
if(ispath(rglass_module.glasource, /datum/robot_energy_storage))
|
||||
rglass_module.glasource = get_or_create_estorage(rglass_module.glasource)
|
||||
|
||||
else if(istype(S, /obj/item/stack/sheet/glass))
|
||||
S.cost = 500
|
||||
S.source = get_or_create_estorage(/datum/robot_energy_storage/glass)
|
||||
|
||||
else if(istype(S, /obj/item/stack/sheet/rglass/cyborg))
|
||||
var/obj/item/stack/sheet/rglass/cyborg/G = S
|
||||
G.source = get_or_create_estorage(/datum/robot_energy_storage/metal)
|
||||
G.glasource = get_or_create_estorage(/datum/robot_energy_storage/glass)
|
||||
|
||||
else if(istype(S, /obj/item/stack/medical))
|
||||
S.cost = 250
|
||||
S.source = get_or_create_estorage(/datum/robot_energy_storage/medical)
|
||||
|
||||
else if(istype(S, /obj/item/stack/cable_coil))
|
||||
S.cost = 1
|
||||
S.source = get_or_create_estorage(/datum/robot_energy_storage/wire)
|
||||
|
||||
else if(istype(S, /obj/item/stack/marker_beacon))
|
||||
S.cost = 1
|
||||
S.source = get_or_create_estorage(/datum/robot_energy_storage/beacon)
|
||||
|
||||
else if(istype(S, /obj/item/stack/pipe_cleaner_coil))
|
||||
S.cost = 1
|
||||
S.source = get_or_create_estorage(/datum/robot_energy_storage/pipe_cleaner)
|
||||
|
||||
if(S?.source)
|
||||
S.set_custom_materials(null)
|
||||
S.is_cyborg = 1
|
||||
if(istype(sheet_module.source))
|
||||
sheet_module.cost = max(sheet_module.cost, 1) // Must not cost 0 to prevent div/0 errors.
|
||||
sheet_module.set_mats_per_unit(null)
|
||||
sheet_module.is_cyborg = TRUE
|
||||
|
||||
if(I.loc != src)
|
||||
I.forceMove(src)
|
||||
@@ -278,8 +251,8 @@
|
||||
/obj/item/extinguisher/mini,
|
||||
/obj/item/roller/robo,
|
||||
/obj/item/borg/cyborghug/medical,
|
||||
/obj/item/stack/medical/gauze/cyborg,
|
||||
/obj/item/stack/medical/bone_gel/cyborg,
|
||||
/obj/item/stack/medical/gauze,
|
||||
/obj/item/stack/medical/bone_gel,
|
||||
/obj/item/organ_storage,
|
||||
/obj/item/borg/lollipop)
|
||||
radio_channels = list(RADIO_CHANNEL_MEDICAL)
|
||||
@@ -309,12 +282,12 @@
|
||||
/obj/item/assembly/signaler/cyborg,
|
||||
/obj/item/areaeditor/blueprints/cyborg,
|
||||
/obj/item/electroadaptive_pseudocircuit,
|
||||
/obj/item/stack/sheet/metal/cyborg,
|
||||
/obj/item/stack/sheet/glass/cyborg,
|
||||
/obj/item/stack/sheet/metal,
|
||||
/obj/item/stack/sheet/glass,
|
||||
/obj/item/stack/sheet/rglass/cyborg,
|
||||
/obj/item/stack/rods/cyborg,
|
||||
/obj/item/stack/tile/plasteel/cyborg,
|
||||
/obj/item/stack/cable_coil/cyborg)
|
||||
/obj/item/stack/tile/plasteel,
|
||||
/obj/item/stack/cable_coil)
|
||||
radio_channels = list(RADIO_CHANNEL_ENGINEERING)
|
||||
emag_modules = list(/obj/item/borg/stun)
|
||||
cyborg_base_icon = "engineer"
|
||||
@@ -382,7 +355,7 @@
|
||||
/obj/item/assembly/flash/cyborg,
|
||||
/obj/item/screwdriver/cyborg,
|
||||
/obj/item/crowbar/cyborg,
|
||||
/obj/item/stack/tile/plasteel/cyborg,
|
||||
/obj/item/stack/tile/plasteel,
|
||||
/obj/item/soap/nanotrasen,
|
||||
/obj/item/storage/bag/trash/cyborg,
|
||||
/obj/item/melee/flyswatter,
|
||||
@@ -610,7 +583,7 @@
|
||||
/obj/item/crowbar/cyborg,
|
||||
/obj/item/extinguisher/mini,
|
||||
/obj/item/pinpointer/syndicate_cyborg,
|
||||
/obj/item/stack/medical/gauze/cyborg,
|
||||
/obj/item/stack/medical/gauze,
|
||||
/obj/item/gun/medbeam,
|
||||
/obj/item/organ_storage)
|
||||
|
||||
@@ -634,13 +607,13 @@
|
||||
/obj/item/crowbar/cyborg,
|
||||
/obj/item/wirecutters/cyborg,
|
||||
/obj/item/multitool/cyborg,
|
||||
/obj/item/stack/sheet/metal/cyborg,
|
||||
/obj/item/stack/sheet/glass/cyborg,
|
||||
/obj/item/stack/sheet/metal,
|
||||
/obj/item/stack/sheet/glass,
|
||||
/obj/item/stack/sheet/rglass/cyborg,
|
||||
/obj/item/stack/rods/cyborg,
|
||||
/obj/item/stack/tile/plasteel/cyborg,
|
||||
/obj/item/stack/tile/plasteel,
|
||||
/obj/item/dest_tagger/borg,
|
||||
/obj/item/stack/cable_coil/cyborg,
|
||||
/obj/item/stack/cable_coil,
|
||||
/obj/item/pinpointer/syndicate_cyborg,
|
||||
/obj/item/borg_chameleon,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user