diff --git a/citadel.dme b/citadel.dme index b213a43eea20..47c8a0e6d24a 100644 --- a/citadel.dme +++ b/citadel.dme @@ -288,6 +288,7 @@ #include "code\__DEFINES\overmaps\misc.dm" #include "code\__DEFINES\overmaps\overmap.dm" #include "code\__DEFINES\power\balancing.dm" +#include "code\__DEFINES\power\cell.dm" #include "code\__DEFINES\power\power.dm" #include "code\__DEFINES\preferences\data_keys_character.dm" #include "code\__DEFINES\preferences\data_keys_global.dm" @@ -819,6 +820,7 @@ #include "code\datums\design\designs\ammo\shotgun.dm" #include "code\datums\design\designs\ammo\smg.dm" #include "code\datums\design\designs\devices\assemblies.dm" +#include "code\datums\design\designs\devices\cells.dm" #include "code\datums\design\designs\devices\devices.dm" #include "code\datums\design\designs\machines\assemblies.dm" #include "code\datums\design\designs\machines\circuits.dm" @@ -4313,7 +4315,6 @@ #include "code\modules\power\cable.dm" #include "code\modules\power\cable_ender.dm" #include "code\modules\power\cable_heavyduty.dm" -#include "code\modules\power\cell.dm" #include "code\modules\power\crypto_miner.dm" #include "code\modules\power\fractal_reactor.dm" #include "code\modules\power\generator.dm" @@ -4330,8 +4331,17 @@ #include "code\modules\power\antimatter\containment_jar.dm" #include "code\modules\power\antimatter\control.dm" #include "code\modules\power\antimatter\shielding.dm" -#include "code\modules\power\cells\device_cells.dm" -#include "code\modules\power\cells\power_cells.dm" +#include "code\modules\power\cells\cell.dm" +#include "code\modules\power\cells\cells_legacy.dm" +#include "code\modules\power\cells\power_cell.dm" +#include "code\modules\power\cells\datums\basic.dm" +#include "code\modules\power\cells\datums\infinite.dm" +#include "code\modules\power\cells\datums\microfission.dm" +#include "code\modules\power\cells\datums\regen.dm" +#include "code\modules\power\cells\types\large.dm" +#include "code\modules\power\cells\types\medium.dm" +#include "code\modules\power\cells\types\small.dm" +#include "code\modules\power\cells\types\weapon.dm" #include "code\modules\power\engines\rust\_setup.dm" #include "code\modules\power\engines\rust\fusion_circuits.dm" #include "code\modules\power\engines\rust\fusion_reactions.dm" diff --git a/code/__DEFINES/power/balancing.dm b/code/__DEFINES/power/balancing.dm index d966ee58b549..b3a607b152de 100644 --- a/code/__DEFINES/power/balancing.dm +++ b/code/__DEFINES/power/balancing.dm @@ -2,18 +2,21 @@ //* Cells +#define CELLRATE_DEFAULT 0.5 /// the closest thing we'll get to a cvar - cellrate is kJ per cell unit. kJ to avoid float precision loss. -GLOBAL_VAR_INIT(cellrate, 0.5) -/** - * current calculations - * cellrate 0.5 = 0.5 kj/unit - * for 10k cell, 5000kj - * 1 Wh = 60J-S*60s/m = 3600J = 3.6kJ - * 10k cell --> 1388.89 Wh - * damn, future cells be pogging - */ -/// the closest thing we'll get to a cvar - affects cell use_scaled - higher = things use less energy. handheld devices usually use this. -GLOBAL_VAR_INIT(cellefficiency, 1) +GLOBAL_VAR_INIT(cellrate, CELLRATE_DEFAULT) + +#define POWER_CELL_CAPACITY_BASE 1000 + +#define POWER_CELL_MULTIPLIER_SMALL (1.2) +#define POWER_CELL_MULTIPLIER_MEDIUM (1.2 * 5) +#define POWER_CELL_MULTIPLIER_LARGE (1.2 * 5 * 5) +#define POWER_CELL_MULTIPLIER_WEAPON (1.2 * 2.5) + +#define POWER_CELL_CAPACITY_MULTIPLIER_SMALL (POWER_CELL_CAPACITY_BASE * POWER_CELL_MULTIPLIER_SMALL) +#define POWER_CELL_CAPACITY_MULTIPLIER_MEDIUM (POWER_CELL_CAPACITY_BASE * POWER_CELL_MULTIPLIER_MEDIUM) +#define POWER_CELL_CAPACITY_MULTIPLIER_LARGE (POWER_CELL_CAPACITY_BASE * POWER_CELL_MULTIPLIER_LARGE) +#define POWER_CELL_CAPACITY_MULTIPLIER_WEAPON (POWER_CELL_CAPACITY_BASE * POWER_CELL_MULTIPLIER_WEAPON) //* Computers diff --git a/code/__DEFINES/power/cell.dm b/code/__DEFINES/power/cell.dm new file mode 100644 index 000000000000..032f140ec01a --- /dev/null +++ b/code/__DEFINES/power/cell.dm @@ -0,0 +1,70 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 silicons *// + +//* /obj/item/cell/var/cell_type *// + +/// handheld devices +#define CELL_TYPE_SMALL (1<<1) +/// medium size devices like inducers, bulky handheld equipment, etc +#define CELL_TYPE_MEDIUM (1<<2) +/// mecha, apcs, large drills, etc +#define CELL_TYPE_LARGE (1<<3) +/// energy weapons that don't use special cells / specific other types +#define CELL_TYPE_WEAPON (1<<4) + +DEFINE_BITFIELD_NEW(cell_type, list( + /obj/item/cell = list( + "cell_type", + ), + /datum/object_system/cell_slot = list( + "cell_type", + ), +), list( + BITFIELD_NEW("Small", CELL_TYPE_SMALL), + BITFIELD_NEW("Medium", CELL_TYPE_MEDIUM), + BITFIELD_NEW("Large", CELL_TYPE_LARGE), + BITFIELD_NEW("Weapon", CELL_TYPE_WEAPON), +)) + +/// generate /small, /medium, /large, and /weapon cells for a power cell datum +#define POWER_CELL_GENERATE_TYPES(DATUM_TYPEPATH, CELL_TYPEPATH, PROTOTYPE_ID) \ +/obj/item/cell/small##CELL_TYPEPATH { \ + name = "small power cell (" + ##DATUM_TYPEPATH::cell_name + ")"; \ + desc = "A small power cell used in handheld electronics. " + ##DATUM_TYPEPATH::cell_desc; \ + prototype_id = "cell-" + ##PROTOTYPE_ID + "-small"; \ + max_charge = /obj/item/cell/small::max_charge * ##DATUM_TYPEPATH::typegen_capacity_multiplier_small * ##DATUM_TYPEPATH::typegen_capacity_multiplier; \ + stripe_color = ##DATUM_TYPEPATH::typegen_visual_stripe_color; \ + indicator_color = ##DATUM_TYPEPATH::typegen_visual_indicator_color; \ + typegen_active = TRUE; \ + cell_datum = ##DATUM_TYPEPATH; \ +} \ +/obj/item/cell/medium##CELL_TYPEPATH { \ + name = "medium power cell (" + ##DATUM_TYPEPATH::cell_name + ")"; \ + desc = "A decently sized cell used in many pieces of modern equipment. " + ##DATUM_TYPEPATH::cell_desc; \ + prototype_id = "cell-" + ##PROTOTYPE_ID + "-medium"; \ + max_charge = /obj/item/cell/medium::max_charge * ##DATUM_TYPEPATH::typegen_capacity_multiplier_medium * ##DATUM_TYPEPATH::typegen_capacity_multiplier; \ + stripe_color = ##DATUM_TYPEPATH::typegen_visual_stripe_color; \ + indicator_color = ##DATUM_TYPEPATH::typegen_visual_indicator_color; \ + typegen_active = TRUE; \ + cell_datum = ##DATUM_TYPEPATH; \ +} \ +/obj/item/cell/large##CELL_TYPEPATH { \ + name = "large power cell (" + ##DATUM_TYPEPATH::cell_name + ")"; \ + desc = "A bulky power cell used in industrial equipment and power supply systems. " + ##DATUM_TYPEPATH::cell_desc; \ + prototype_id = "cell-" + ##PROTOTYPE_ID + "-large"; \ + max_charge = /obj/item/cell/large::max_charge * ##DATUM_TYPEPATH::typegen_capacity_multiplier_large * ##DATUM_TYPEPATH::typegen_capacity_multiplier; \ + stripe_color = ##DATUM_TYPEPATH::typegen_visual_stripe_color; \ + indicator_color = ##DATUM_TYPEPATH::typegen_visual_indicator_color; \ + typegen_active = TRUE; \ + cell_datum = ##DATUM_TYPEPATH; \ +} \ +/obj/item/cell/weapon##CELL_TYPEPATH { \ + name = "weapon power cell (" + ##DATUM_TYPEPATH::cell_name + ")"; \ + desc = "A power cell accepted by many kinds of handheld weaponry. " + ##DATUM_TYPEPATH::cell_desc; \ + prototype_id = "cell-" + ##PROTOTYPE_ID + "-weapon"; \ + max_charge = /obj/item/cell/weapon::max_charge + ##DATUM_TYPEPATH::typegen_capacity_multiplier_weapon * ##DATUM_TYPEPATH::typegen_capacity_multiplier; \ + stripe_color = ##DATUM_TYPEPATH::typegen_visual_stripe_color; \ + indicator_color = ##DATUM_TYPEPATH::typegen_visual_indicator_color; \ + typegen_active = TRUE; \ + cell_datum = ##DATUM_TYPEPATH; \ +} diff --git a/code/__DEFINES/power/power.dm b/code/__DEFINES/power/power.dm index cc8e4bb4ca30..132965ea4919 100644 --- a/code/__DEFINES/power/power.dm +++ b/code/__DEFINES/power/power.dm @@ -147,7 +147,8 @@ * #define SMESMAXOUTPUT 250000 */ -/* cells */ +//* Cells *// + // Cells practically use their own power systems // "Use power from cell" for **handheld/portable devices**, semantically, should always use cell units and not a "real unit" // This way we can tweak balance with just cellrate. @@ -175,6 +176,18 @@ #define DYNAMIC_CELL_UNITS_TO_KWM(U) (((U) * GLOB.cellrate) / (60)) #define DYNAMIC_CELL_UNITS_TO_WM(U) (((U) * GLOB.cellrate) / (60 / 1000)) +//* Cells - Static; These use CELLRATE_DEFAULT *// + +#define STATIC_KW_TO_CELL_UNITS(KW, DT) ((KW) * (DT) / CELLRATE_DEFAULT) +#define STATIC_W_TO_CELL_UNITS(W, DT) (((W) * 0.001) * (DT) / CELLRATE_DEFAULT) +#define STATIC_J_TO_CELL_UNITS(J) (((J) * 0.001) / CELLRATE_DEFAULT) +#define STATIC_KJ_TO_CELL_UNITS(KJ) ((KJ) / CELLRATE_DEFAULT) + +#define STATIC_CELL_UNITS_TO_KW(U, DT) ((U) * CELLRATE_DEFAULT / (DT)) +#define STATIC_CELL_UNITS_TO_W(U, DT) ((U) * CELL_RATE_DEFAULT / (DT) * 1000) +#define STATIC_CELL_UNITS_TO_J(U) ((U) * CELL_RATE_DEFAULT * 1000) +#define STATIC_CELL_UNITS_TO_KJ(U) ((U) * CELL_RATE_DEFAULT) + /** * LEGACY ENUMS * diff --git a/code/__DEFINES/radiation/simulation.dm b/code/__DEFINES/radiation/simulation.dm index 8cade0aea763..a95001033ebe 100644 --- a/code/__DEFINES/radiation/simulation.dm +++ b/code/__DEFINES/radiation/simulation.dm @@ -32,6 +32,8 @@ #define RAD_FALLOFF_ENGINE_SINGULARITY 0.5 /// materials #define RAD_FALLOFF_MATERIALS 0.5 +/// breached microfission cell +#define RAD_FALLOFF_CELL_MICROFISSION 0.5 //! Pulse - Z Falloff //* Keep in mind that these are low because things are usually really far away and the point of Z rad is to hit most things. @@ -53,6 +55,10 @@ #define RAD_INTENSITY_STANDALONE_DEFIB 100 /// standalone shockpaddles - fail tick #define RAD_INTENSITY_STANDALONE_DEFIB_FAIL 150 +/// minimum intensity of a breached microfission cell +#define RAD_INTENSITY_CELL_MICROFISSION_LEAK_MINIMUM 75 +/// maximum intensity of a breached microfission cell +#define RAD_INTENSITY_CELL_MICROFISSION_LEAK_MAXIMUM 350 //? machines /// gravity generator grav per tick while charging/discharging diff --git a/code/datums/design/designs/devices/cells.dm b/code/datums/design/designs/devices/cells.dm new file mode 100644 index 000000000000..adfc6bc0e0d4 --- /dev/null +++ b/code/datums/design/designs/devices/cells.dm @@ -0,0 +1,29 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 silicons *// + +/datum/design/cell + abstract_type = /datum/design/cell + +/datum/design/cell/small + id = "cell-basic-small" + lathe_type = LATHE_TYPE_AUTOLATHE + design_unlock = DESIGN_UNLOCK_INTRINSIC + build_path = /obj/item/cell/basic/small + +/datum/design/cell/medium + id = "cell-basic-medium" + lathe_type = LATHE_TYPE_AUTOLATHE + design_unlock = DESIGN_UNLOCK_INTRINSIC + build_path = /obj/item/cell/basic/medium + +/datum/design/cell/large + id = "cell-basic-large" + lathe_type = LATHE_TYPE_AUTOLATHE + design_unlock = DESIGN_UNLOCK_INTRINSIC + build_path = /obj/item/cell/basic/large + +/datum/design/cell/weapon + id = "cell-basic-weapon" + lathe_type = LATHE_TYPE_AUTOLATHE + design_unlock = DESIGN_UNLOCK_INTRINSIC + build_path = /obj/item/cell/basic/weapon diff --git a/code/datums/outfits/outfit.dm b/code/datums/outfits/outfit.dm index 85823242f516..433239cec3fd 100644 --- a/code/datums/outfits/outfit.dm +++ b/code/datums/outfits/outfit.dm @@ -261,8 +261,8 @@ suit = /obj/item/clothing/suit/armor/combat/imperial back = /obj/item/storage/backpack/satchel belt = /obj/item/storage/belt/security/tactical/bandolier - l_pocket = /obj/item/cell/device/weapon - r_pocket = /obj/item/cell/device/weapon + l_pocket = /obj/item/cell/weapon/basic + r_pocket = /obj/item/cell/weapon/basic r_hand = /obj/item/melee/transforming/energy/sword/imperial l_hand = /obj/item/shield/transforming/energy/imperial suit_store = /obj/item/gun/energy/imperial @@ -277,8 +277,8 @@ mask = /obj/item/clothing/mask/gas/imperial suit = /obj/item/clothing/suit/armor/combat/imperial/centurion belt = /obj/item/storage/belt/security/tactical/bandolier - l_pocket = /obj/item/cell/device/weapon - r_pocket = /obj/item/cell/device/weapon + l_pocket = /obj/item/cell/weapon/basic + r_pocket = /obj/item/cell/weapon/basic r_hand = /obj/item/melee/transforming/energy/sword/imperial l_hand = /obj/item/shield/transforming/energy/imperial suit_store = /obj/item/gun/energy/imperial diff --git a/code/datums/recipe/crafting_recipes/recipes_misc.dm b/code/datums/recipe/crafting_recipes/recipes_misc.dm index 0c15003d63a3..c87792304f1a 100644 --- a/code/datums/recipe/crafting_recipes/recipes_misc.dm +++ b/code/datums/recipe/crafting_recipes/recipes_misc.dm @@ -225,7 +225,7 @@ /datum/crafting_recipe/goldenbox name = "Gold Plated Toolbox" result = /obj/item/storage/toolbox/gold_fake - tools = list(/obj/item/cell/high, + tools = list(/obj/item/cell/medium, /obj/item/reagent_containers/glass/beaker) reqs = list(/obj/item/stack/material/cardboard = 1, //so we dont null items in crafting /obj/item/stack/cable_coil = 10, @@ -276,7 +276,7 @@ /datum/crafting_recipe/brass_driver name = "Brass Screwdriver" - tools = list(/obj/item/cell/high, + tools = list(/obj/item/cell/medium, /obj/item/reagent_containers/glass/beaker) result = /obj/item/tool/screwdriver/brass reqs = list(/obj/item/tool/screwdriver = 1, @@ -291,7 +291,7 @@ /datum/crafting_recipe/brass_welder name = "Brass Welding Tool" - tools = list(/obj/item/cell/high, + tools = list(/obj/item/cell/medium, /obj/item/reagent_containers/glass/beaker) result = /obj/item/weldingtool/brass reqs = list(/obj/item/weldingtool = 1, @@ -306,7 +306,7 @@ /datum/crafting_recipe/clockwelder name = "Replica Clockwork Welding Tool" - tools = list(/obj/item/cell/high, + tools = list(/obj/item/cell/medium, /obj/item/reagent_containers/glass/beaker) result = /obj/item/weldingtool/experimental/brass reqs = list(/obj/item/weldingtool/experimental = 1, @@ -321,7 +321,7 @@ /datum/crafting_recipe/brass_wirecutters name = "Brass Wirecutters" - tools = list(/obj/item/cell/high, + tools = list(/obj/item/cell/medium, /obj/item/reagent_containers/glass/beaker) result = /obj/item/tool/wirecutters/brass reqs = list(/obj/item/tool/wirecutters = 1, @@ -336,7 +336,7 @@ /datum/crafting_recipe/brass_crowbar name = "Brass Crowbar" - tools = list(/obj/item/cell/high, + tools = list(/obj/item/cell/medium, /obj/item/reagent_containers/glass/beaker) result = /obj/item/tool/crowbar/brass reqs = list(/obj/item/tool/crowbar = 1, @@ -351,7 +351,7 @@ /datum/crafting_recipe/brass_wrench name = "Brass Wrench" - tools = list(/obj/item/cell/high, + tools = list(/obj/item/cell/medium, /obj/item/reagent_containers/glass/beaker) result = /obj/item/tool/wrench/brass reqs = list(/obj/item/tool/wrench = 1, diff --git a/code/datums/uplink/ammunition.dm b/code/datums/uplink/ammunition.dm index 407768b7ecf2..70295934235f 100644 --- a/code/datums/uplink/ammunition.dm +++ b/code/datums/uplink/ammunition.dm @@ -124,22 +124,18 @@ path = /obj/item/storage/box/flashshells item_cost = 10 // Discount due to it being LTL. -/datum/uplink_item/item/ammo/cell - name = "weapon cell" - path = /obj/item/cell/device/weapon - -/datum/uplink_item/item/ammo/highcell - name = "High capacity cell" - path = /obj/item/cell/high - item_cost = 15 - -/datum/uplink_item/item/ammo/supercell - name = "Super capacity cell" - path = /obj/item/cell/super - item_cost = 30 -/* Cell type not present on Cit -/datum/uplink_item/item/ammo/voidcell - name = "Void cell" - path = /obj/item/cell/device/recharge/alien/hybrid - item_cost = DEFAULT_TELECRYSTAL_AMOUNT * 1.5 -*/ +/datum/uplink_item/item/ammo/weapon_cell + name = "weapon power cell" + path = /obj/item/cell/weapon + +/datum/uplink_item/item/ammo/small + name = "small power cell" + path = /obj/item/cell/small + +/datum/uplink_item/item/ammo/medium_cell + name = "medium power cell" + path = /obj/item/cell/medium + +/datum/uplink_item/item/ammo/large_cell + name = "large power cell" + path = /obj/item/cell/large diff --git a/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/engineering.dm b/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/engineering.dm index 1a47403cce6d..2515c04584b3 100644 --- a/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/engineering.dm +++ b/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/engineering.dm @@ -20,8 +20,9 @@ contains = list( /obj/item/storage/toolbox/electrical = 2, /obj/item/clothing/gloves/yellow = 2, - /obj/item/cell = 2, - /obj/item/cell/high = 2, + /obj/item/cell/small = 2, + /obj/item/cell/medium = 2, + /obj/item/cell/large = 2, ) worth = 300 container_type = /obj/structure/closet/crate/engineering/electrical diff --git a/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/miscellaneous.dm b/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/miscellaneous.dm index 6d124e01c2bc..86042c5a4338 100644 --- a/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/miscellaneous.dm +++ b/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/miscellaneous.dm @@ -172,7 +172,7 @@ name = "Belt-miner gear crate" contains = list( /obj/item/gun/energy/particle = 2, - /obj/item/cell/device/weapon = 2, + /obj/item/cell/weapon = 2, /obj/item/storage/firstaid/regular = 1, /obj/item/gps = 2, /obj/item/storage/box/traumainjectors = 1, diff --git a/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/munitions.dm b/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/munitions.dm index 23757c6fe2cf..424d36b6ecec 100644 --- a/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/munitions.dm +++ b/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/munitions.dm @@ -182,7 +182,7 @@ /datum/supply_pack/nanotrasen/munitions/pcellammo name = "Ammunition - Power cell" contains = list( - /obj/item/cell/device/weapon = 3, + /obj/item/cell/weapon = 3, ) container_access = list() diff --git a/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/robotics.dm b/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/robotics.dm index 87a54ae77089..00451d3eaff6 100644 --- a/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/robotics.dm +++ b/code/game/content/factions/corporations/nanotrasen/nanotrasen-supply/robotics.dm @@ -15,7 +15,8 @@ /obj/item/assembly/prox_sensor = 3, /obj/item/storage/toolbox/electrical, /obj/item/flash = 4, - /obj/item/cell/high = 2, + /obj/item/cell/medium = 2, + /obj/item/cell/large = 2, ) worth = 250 // literally only because of the flashes; nerf flashes when? diff --git a/code/game/gamemodes/changeling/powers/bioelectrogenesis.dm b/code/game/gamemodes/changeling/powers/bioelectrogenesis.dm index 7d5547a962ca..7caa62605c87 100644 --- a/code/game/gamemodes/changeling/powers/bioelectrogenesis.dm +++ b/code/game/gamemodes/changeling/powers/bioelectrogenesis.dm @@ -81,8 +81,8 @@ if(siemens) while(i) cell.charge += 100 * siemens //This should be a nice compromise between recharging guns and other batteries. - if(cell.charge > cell.maxcharge) - cell.charge = cell.maxcharge + if(cell.charge > cell.max_charge) + cell.charge = cell.max_charge break if(siemens) var/T = get_turf(src) @@ -191,8 +191,8 @@ if(siemens) while(i) cell.charge += 100 * siemens //This should be a nice compromise between recharging guns and other batteries. - if(cell.charge > cell.maxcharge) - cell.charge = cell.maxcharge + if(cell.charge > cell.max_charge) + cell.charge = cell.max_charge break //No point making sparks if the cell's full. // if(!Adjacent(T)) // break diff --git a/code/game/gamemodes/events/power_failure.dm b/code/game/gamemodes/events/power_failure.dm index 4712718eef10..40e5085bba08 100644 --- a/code/game/gamemodes/events/power_failure.dm +++ b/code/game/gamemodes/events/power_failure.dm @@ -31,7 +31,7 @@ command_announcement.Announce("Power has been restored to [station_name()]. We apologize for the inconvenience.", "Power Systems Nominal", new_sound = 'sound/AI/poweron.ogg') for(var/obj/machinery/power/apc/C in GLOB.apcs) if(C.cell && (C.z in (LEGACY_MAP_DATUM).station_levels)) - C.cell.charge = C.cell.maxcharge + C.cell.charge = C.cell.max_charge for(var/obj/machinery/power/smes/S in GLOB.machines) var/area/current_area = get_area(S) if((current_area.type in skipped_areas) || isNotStationLevel(S.z)) diff --git a/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_manipulation.dm b/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_manipulation.dm index 66288431999a..bf5b155350af 100644 --- a/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_manipulation.dm +++ b/code/game/gamemodes/malfunction/newmalf_ability_trees/tree_manipulation.dm @@ -190,8 +190,8 @@ if(temp_apc) temp_apc.emp_act(3) // Such power surges are not good for APC electronics if(temp_apc.cell) - temp_apc.cell.maxcharge -= between(0, (temp_apc.cell.maxcharge/2) + 500, temp_apc.cell.maxcharge) - if(temp_apc.cell.maxcharge < 100) // That's it, you busted the APC cell completely. Break the APC and completely destroy the cell. + temp_apc.cell.max_charge -= between(0, (temp_apc.cell.max_charge/2) + 500, temp_apc.cell.max_charge) + if(temp_apc.cell.max_charge < 100) // That's it, you busted the APC cell completely. Break the APC and completely destroy the cell. qdel(temp_apc.cell) temp_apc.set_broken() diff --git a/code/game/gamemodes/newobjective.dm b/code/game/gamemodes/newobjective.dm deleted file mode 100644 index 99b4b1e6e3f5..000000000000 --- a/code/game/gamemodes/newobjective.dm +++ /dev/null @@ -1,1493 +0,0 @@ -#define FRAME_PROBABILITY 3 -#define THEFT_PROBABILITY 55 -#define KILL_PROBABILITY 37 -#define PROTECT_PROBABILITY 5 - -#define LENIENT 0 -#define NORMAL 1 -#define HARD 2 -#define IMPOSSIBLE 3 - - -/proc/GenerateTheft(var/job,var/datum/mind/traitor) - var/list/datum/objective/objectives = list() - - for(var/o in typesof(/datum/objective/steal)) - if(o != /datum/objective/steal) //Make sure not to get a blank steal objective. - var/datum/objective/target = new o(null,job) - objectives += target - objectives[target] = target.weight - return objectives - -/proc/GenerateAssassinate(var/job,var/datum/mind/traitor) - var/list/datum/objective/assassinate/missions = list() - - for(var/datum/mind/target in SSticker.minds) - if((target != traitor) && istype(target.current, /mob/living/carbon/human)) - if(target && target.current) - var/datum/objective/target_obj = new /datum/objective/assassinate(null,job,target) - missions += target_obj - missions[target_obj] = target_obj.weight - return missions - -/proc/GenerateFrame(var/job,var/datum/mind/traitor) - var/list/datum/objective/frame/missions = list() - - for(var/datum/mind/target in SSticker.minds) - if((target != traitor) && istype(target.current, /mob/living/carbon/human)) - if(target && target.current) - var/datum/objective/target_obj = new /datum/objective/frame(null,job,target) - missions += target_obj - missions[target_obj] = target_obj.weight - return missions - -/proc/GenerateProtection(var/job,var/datum/mind/traitor) - var/list/datum/objective/frame/missions = list() - - for(var/datum/mind/target in SSticker.minds) - if((target != traitor) && istype(target.current, /mob/living/carbon/human)) - if(target && target.current) - var/datum/objective/target_obj = new /datum/objective/protection(null,job,target) - missions += target_obj - missions[target_obj] = target_obj.weight - return missions - - -/proc/SelectObjectives(var/job,var/datum/mind/traitor,var/hijack = 0) - var/list/chosenobjectives = list() - var/list/theftobjectives = GenerateTheft(job,traitor) //Separated all the objective types so they can be picked independantly of each other. - var/list/killobjectives = GenerateAssassinate(job,traitor) - var/list/frameobjectives = GenerateFrame(job,traitor) - var/list/protectobjectives = GenerateProtection(job,traitor) - var/total_weight - var/conflict - - var/steal_weight = THEFT_PROBABILITY - var/frame_weight = FRAME_PROBABILITY - var/kill_weight = KILL_PROBABILITY - var/protect_weight = PROTECT_PROBABILITY - var/target_weight = 50 - -///////////////////////////////////////////////////////////// -//HANDLE ASSIGNING OBJECTIVES BASED OFF OF PREVIOUS SUCCESS// -///////////////////////////////////////////////////////////// - - var/savefile/info = new("data/player_saves/[copytext(traitor.key, 1, 2)]/[traitor.key]/traitor.sav") - var/list/infos - info >> infos - if(istype(infos)) - var/total_attempts = infos["Total"] - var/total_overall_success = infos["Success"] - var/success_ratio = total_overall_success/total_attempts - var/steal_success = infos["Steal"] - var/kill_success = infos["Kill"] - var/frame_success = infos["Frame"] - var/protect_success = infos["Protect"] - - var/list/ordered_success = list(steal_success, kill_success, frame_success, protect_success) - - var/difficulty = pick(LENIENT, LENIENT, NORMAL, NORMAL, NORMAL, HARD, HARD, IMPOSSIBLE) - //Highest to lowest in terms of success rate, and resulting weight for later computation - var/success_weights = list(1, 1, 1, 1) - switch(difficulty) - if(LENIENT) - success_weights = list(1.5, 1, 0.75, 0.5) - target_weight = success_ratio*100 - if(NORMAL) - target_weight = success_ratio*150 - if(HARD) - success_weights = list(0.66, 0.8, 1, 1.25) - target_weight = success_ratio*200 - if(IMPOSSIBLE) //YOU SHALL NOT PASS - success_weights = list(0.5, 0.75, 1.2, 2) - target_weight = success_ratio*300 - - for(var/i = 1, i <= 4, i++) - //Iterate through the success rates, and determine the weights to chose based on the highest to - // the lowest to multiply it by the proper success ratio. - var/weight = max(ordered_success) - ordered_success -= weight - if(weight == steal_success) - steal_weight *= steal_success*success_weights[i] - else if(weight == frame_success) - frame_weight *= frame_success*success_weights[i] - else if(weight == protect_success) - protect_weight *= protect_success*success_weights[i] - else if(weight == kill_success) - kill_weight *= kill_success*success_weights[i] - - var/total_weights = kill_weight + protect_weight + frame_weight + steal_weight - frame_weight = round(frame_weight/total_weights) - kill_weight = round(kill_weight/total_weights) - steal_weight = round(steal_weight/total_weights) - //Protect is whatever is left over. - - var/steal_range = steal_weight - var/frame_range = frame_weight + steal_range - var/kill_range = kill_weight + frame_range - //Protect is whatever is left over. - - while(total_weight < target_weight) - var/selectobj = rand(1,100) //Randomly determine the type of objective to be given. - if(!length(killobjectives) || !length(protectobjectives)|| !length(frameobjectives)) //If any of these lists are empty, just give them theft objectives. - var/datum/objective/objective = pickweight(theftobjectives) - chosenobjectives += objective - total_weight += objective.points - theftobjectives -= objective - else switch(selectobj) - if(1 to steal_range) - if(!theftobjectives.len) - continue - var/datum/objective/objective = pickweight(theftobjectives) - for(1 to 10) - if(objective.points + total_weight <= 100 || !theftobjectives.len) - break - theftobjectives -= objective - objective = pickweight(theftobjectives) - if(!objective && !theftobjectives.len) - continue - chosenobjectives += objective - total_weight += objective.points - theftobjectives -= objective - if(steal_range + 1 to frame_range) //Framing Objectives (3% chance) - if(!frameobjectives.len) - continue - var/datum/objective/objective = pickweight(frameobjectives) - for(1 to 10) - if(objective.points + total_weight <= 100 || !frameobjectives.len) - break - frameobjectives -= objective - objective = pickweight(frameobjectives) - if(!objective && !frameobjectives.len) - continue - for(var/datum/objective/protection/conflicttest in chosenobjectives) //Check to make sure we aren't telling them to Assassinate somebody they need to Protect. - if(conflicttest.target == objective.target) - conflict = 1 - break - for(var/datum/objective/assassinate/conflicttest in chosenobjectives) //Check to make sure we aren't telling them to Protect somebody they need to Assassinate. - if(conflicttest.target == objective.target) - conflict = 1 - break - if(!conflict) - chosenobjectives += objective - total_weight += objective.points - frameobjectives -= objective - conflict = 0 - if(frame_range + 1 to kill_range) - if(!killobjectives.len) - continue - var/datum/objective/assassinate/objective = pickweight(killobjectives) - to_chat(world, objective) - for(1 to 10) - if(objective.points + total_weight <= 100 || !killobjectives.len) - break - killobjectives -= objective - objective = pickweight(killobjectives) - if(!objective && !killobjectives.len) - continue - for(var/datum/objective/protection/conflicttest in chosenobjectives) //Check to make sure we aren't telling them to Assassinate somebody they need to Protect. - if(conflicttest.target == objective.target) - conflict = 1 - break - for(var/datum/objective/frame/conflicttest in chosenobjectives) //Check to make sure we aren't telling them to Protect somebody they need to Assassinate. - if(conflicttest.target == objective.target) - conflict = 1 - break - if(!conflict) - chosenobjectives += objective - total_weight += objective.points - killobjectives -= objective - conflict = 0 - if(kill_range + 1 to 100) //Protection Objectives (5% chance) - if(!protectobjectives.len) - continue - var/datum/objective/protection/objective = pickweight(protectobjectives) - for(1 to 10) - if(objective.points + total_weight <= 100 || !protectobjectives.len) - break - protectobjectives -= objective - objective = pickweight(protectobjectives) - if(!objective || !protectobjectives.len) - continue - for(var/datum/objective/assassinate/conflicttest in chosenobjectives) //Check to make sure we aren't telling them to Protect somebody they need to Assassinate. - if(conflicttest.target == objective.target) - conflict = 1 - break - for(var/datum/objective/frame/conflicttest in chosenobjectives) //Check to make sure we aren't telling them to Protect somebody they need to Assassinate. - if(conflicttest.target == objective.target) - conflict = 1 - break - if(!conflict) - chosenobjectives += objective - total_weight += objective.points - protectobjectives -= objective - conflict = 0 - - if(!locate(/datum/objective/hijack) in chosenobjectives && !locate(/datum/objective/escape) in chosenobjectives) - if(hijack) - chosenobjectives += new /datum/objective/hijack(null,job) - else - chosenobjectives += new /datum/objective/escape(null,job) - return chosenobjectives - -datum - objective - var/datum/mind/owner - var/datum/mind/target - var/explanation_text = "text not set" - var/job - var/points = INFINITY //If this isn't set to something else, the objective is bugged and should be ignored - var/weight = INFINITY - - New(var/text,var/joba) - if(text) - src.explanation_text = text - job=joba - weight = get_weight(job) - points = get_points(job) - - proc/check_completion() - return 1 - proc/get_points(var/job) - return INFINITY - proc/get_weight(var/job) - return INFINITY - proc/find_target_by_role(role, role_type=0)//Option sets either to check assigned role or special role. Default to assigned. - for(var/datum/mind/possible_target in SSticker.minds) - if((possible_target != owner) && ishuman(possible_target.current) && ((role_type ? possible_target.special_role : possible_target.assigned_role) == role) ) - target = possible_target - break - - - frame - New(var/text,var/joba,var/datum/mind/targeta) - target = targeta - job = joba - weight = get_points(job) - explanation_text = "Frame [target.current.real_name], the [target.assigned_role] for a crime and make sure they are arrested and brought back to the CentCom station alive. We'll handle the rest from there." - - check_completion() - if(!SSemergencyshuttle.returned()) - return 0 - if(target.current.stat == 2) - return 0 - var/turf/location = get_turf(target.current.loc) - if(!location) - return 0 - if(!target.current:handcuffed && !istype(location, /turf/simulated/shuttle/floor4)) - return 0 - - if(location in locate(/area/shuttle/escape/centcom)) - return 1 - - return 0 - - get_points() - if(target) - var/difficulty = GetRank(target.assigned_role) + 1 - switch(GetRank(job)) - if(4) - return 20*difficulty - if(3) - return 30*difficulty - if(2) - return 40*difficulty - if(1) - return 55*difficulty - if(0) - return 60*difficulty - else - return INFINITY - - get_weight() - if(target) - return 1 - return 0 - - - protection - New(var/text,var/joba,var/datum/mind/targeta) - target = targeta - job = joba - weight = get_points(job) - explanation_text = "[target.current.real_name], the [target.assigned_role] is a [pick("relative of a","friend of a","") + pick("high ranking","important","well-liked")] mercenary [pick("Leader","Officer","Agent","sympathiser")]. Make sure they get off the station safely, while minimizing intervention." - - check_completion() - if(!SSemergencyshuttle.returned()) - return 0 - - if(target.current.stat == 2) - return 0 - - var/turf/location = get_turf(target.current.loc) - if(!location) - return 0 - - if(location in locate(/area/shuttle/escape/centcom)) - return 1 - - return 0 - - get_points() - if(target) - return 30 - else - return INFINITY - - get_weight() - if(target) - return 1 - return 0 - - find_target_by_role(role, role_type=0) - ..(role, role_type) - if(target && target.current) - explanation_text = "Protect [target.current.real_name], the [target.role_alt_title ? target.role_alt_title : (!role_type ? target.assigned_role : target.special_role)]." - else - explanation_text = "Free Objective" - return target - - - assassinate - - New(var/text,var/joba,var/datum/mind/targeta) - target = targeta - job = joba - weight = get_points(job) - explanation_text = "Assassinate [target.current.real_name], the [target.role_alt_title ? target.role_alt_title : target.assigned_role]." - - check_completion() - if(target && target.current) - if(target.current.stat == 2 || istype(get_area(target.current), /area/tdome) || issilicon(target.current) || isbrain(target.current)) - return 1 - else - return 0 - else - return 1 - get_points() - if(target) - var/difficulty = GetRank(target.assigned_role) + 1 - switch(GetRank(job)) - if(4) - return 20*difficulty - if(3) - return 30*difficulty - if(2) - return 40*difficulty - if(1) - return 55*difficulty - if(0) - return 60*difficulty - else - return 0 - - get_weight() - if(target) - return 1 - return 0 - - find_target_by_role(var/role) - for(var/datum/mind/possible_target in SSticker.minds) - if((possible_target != owner) && istype(possible_target.current, /mob/living/carbon/human) && (possible_target.assigned_role == role)) - target = possible_target - break - - if(target && target.current) - explanation_text = "Assassinate [target.current.real_name], the [target.role_alt_title ? target.role_alt_title : target.assigned_role]." - else - explanation_text = "Free Objective" - - return target - - - proc/find_target() - var/list/possible_targets = list() - - for(var/datum/mind/possible_target in SSticker.minds) - if((possible_target != owner) && istype(possible_target.current, /mob/living/carbon/human)) - possible_targets += possible_target - - if(possible_targets.len > 0) - target = pick(possible_targets) - - if(target && target.current) - explanation_text = "Assassinate [target.current.real_name], the [target.role_alt_title ? target.role_alt_title : target.assigned_role]." - else - explanation_text = "Free Objective" - - return target - - - capture - var/separation_time = 0 - var/almost_complete = 0 - - New(var/text,var/joba,var/datum/mind/targeta) - target = targeta - job = joba - explanation_text = "Capture [target.current.real_name], the [target.assigned_role]." - - check_completion() - if(target && target.current) - if(target.current.stat == 2) - if(config_legacy.require_heads_alive) return 0 - else - if(!target.current.handcuffed) - return 0 - else if(config_legacy.require_heads_alive) return 0 - return 1 - - find_target_by_role(var/role) - for(var/datum/mind/possible_target in SSticker.minds) - if((possible_target != owner) && istype(possible_target.current, /mob/living/carbon/human) && (possible_target.assigned_role == role)) - target = possible_target - break - - if(target && target.current) - explanation_text = "Capture [target.current.real_name], the [target.assigned_role]." - else - explanation_text = "Free Objective" - - return target - - get_points() - if(target) - var/difficulty = GetRank(target.assigned_role) + 1 - switch(GetRank(job)) - if(4) - return 20*difficulty - if(3) - return 30*difficulty - if(2) - return 40*difficulty - if(1) - return 55*difficulty - if(0) - return 60*difficulty - else - return INFINITY - - get_weight() - if(target) - return 1 - return 0 - - - hijack - explanation_text = "Hijack the emergency shuttle by escaping alone." - - check_completion() - if(!SSemergencyshuttle.returned()) - return 0 - - if(!owner.current || owner.current.stat == 2) - return 0 - var/turf/location = get_turf(owner.current.loc) - - if(location in locate(/area/shuttle/escape/centcom)) - for(var/mob/living/player in locate(/area/shuttle/escape/centcom)) - if (player.mind && (player.mind != owner)) - if (player.stat != 2) //they're not dead - return 0 - return 1 - - return 0 - get_points(var/job) - switch(GetRank(job)) - if(0) - return 75 - if(1) - return 65 - if(2) - return 65 - if(3) - return 50 - if(4) - return 35 - - get_weight(var/job) - return 1 - - escape - explanation_text = "Escape on the shuttle alive, without being arrested." - - check_completion() - if(!SSemergencyshuttle.returned()) - return 0 - - if(!owner.current || owner.current.stat ==2) - return 0 - - var/turf/location = get_turf(owner.current.loc) - if(!location) - return 0 - - if(owner.current:handcuffed || istype(location, /turf/simulated/shuttle/floor4)) - return 0 - - if(location in locate(/area/shuttle/escape/centcom)) - return 1 - - return 0 - get_points() - return INFINITY - - get_weight(var/job) - return 1 - - - survive - explanation_text = "Stay alive." - - check_completion() - if(!owner.current || owner.current.stat == 2) - return 0 - - return 1 - get_points() - return INFINITY - - get_weight(var/job) - return 1 - - - steal - var/obj/item/steal_target - - check_completion() - if(steal_target) - if(owner.current.check_contents_for(steal_target)) - return 1 - else - return 0 - - - captainslaser - steal_target = /obj/item/gun/energy/captain - explanation_text = "Steal the Facility Director's antique laser gun." - weight = 20 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 60 - if(1) - return 50 - if(2) - return 40 - if(3) - return 30 - if(4) - return 20 - - get_weight(var/job) - if(GetRank(job) == 4) - return 10 - else - return 20 - - - plasmatank - steal_target = /obj/item/tank/plasma - explanation_text = "Steal a small plasma tank." - weight = 20 - - get_points(var/job) - if((job in science_positions) || (job in command_positions)) - return 20 - return 40 - - get_weight(var/job) - return 20 - - check_completion() - var/list/all_items = owner.current.get_contents() - for(var/obj/item/I in all_items) - if(!istype(I, steal_target)) continue//If it's not actually that item. - if(I:air_contents:phoron) return 1 //If they got one with plasma - return 0 - - - /*Removing this as an objective. Not necessary to have two theft objectives in the same room. - steal/captainssuit - steal_target = /obj/item/clothing/under/rank/captain - explanation_text = "Steal a captain's rank jumpsuit" - weight = 50 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 75 - if(1) - return 60 - if(2) - return 50 - if(3) - return 30 - if(4) - return INFINITY - */ - - - handtele - steal_target = /obj/item/hand_tele - explanation_text = "Steal a hand teleporter." - weight = 20 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 75 - if(1) - return 60 - if(2) - return 50 - if(3) - return 30 - if(4) - return 20 - - get_weight(var/job) - if(GetRank(job) == 4) - return 10 - else - return 20 - - - RCD - steal_target = /obj/item/rcd - explanation_text = "Steal a rapid construction device." - weight = 20 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 75 - if(1) - return 60 - if(2) - return 50 - if(3) - return 30 - if(4) - return 20 - - get_weight(var/job) - if(GetRank(job) == 4) - return 10 - else - return 20 - - - /*burger - steal_target = /obj/item/reagent_containers/food/snacks/human/burger - explanation_text = "Steal a burger made out of human organs, this will be presented as proof of Nanotrasen's chronic lack of standards." - weight = 60 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 80 - if(1) - return 65 - if(2) - return 55 - if(3) - return 40 - if(4) - return 25*/ - - - jetpack - steal_target = /obj/item/tank/jetpack/oxygen - explanation_text = "Steal a blue oxygen jetpack." - weight = 20 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 75 - if(1) - return 60 - if(2) - return 50 - if(3) - return 30 - if(4) - return 20 - - get_weight(var/job) - if(GetRank(job) == 4) - return 10 - else - return 20 - - - /*magboots - steal_target = /obj/item/clothing/shoes/magboots - explanation_text = "Steal a pair of \"Nanotrasen\" brand magboots." - weight = 20 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 75 - if(1) - return 60 - if(2) - return 50 - if(3) - return 30 - if(4) - return 20 - - get_weight(var/job) - if(GetRank(job) == 4) - return 10 - else - return 20*/ - - - blueprints - steal_target = /obj/item/blueprints - explanation_text = "Steal the station's blueprints." - weight = 20 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 75 - if(1) - return 60 - if(2) - return 50 - if(3) - return 30 - if(4) - return 20 - - get_weight(var/job) - if(GetRank(job) == 4) - return 10 - else - return 20 - - - voidsuit - steal_target = /obj/item/clothing/suit/space/nasavoid - explanation_text = "Steal a voidsuit." - weight = 20 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 75 - if(1) - return 60 - if(2) - return 50 - if(3) - return 30 - if(4) - return 20 - - get_weight(var/job) - return 20 - - - nuke_disk - steal_target = /obj/item/disk/nuclear - explanation_text = "Steal the station's nuclear authentication disk." - weight = 20 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 90 - if(1) - return 80 - if(2) - return 70 - if(3) - return 40 - if(4) - return 25 - - get_weight(var/job) - if(GetRank(job) == 4) - return 10 - else - return 20 - - nuke_gun - steal_target = /obj/item/gun/energy/gun/nuclear - explanation_text = "Steal a nuclear powered gun." - weight = 20 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 90 - if(1) - return 85 - if(2) - return 80 - if(3) - return 75 - if(4) - return 75 - - get_weight(var/job) - return 2 - - diamond_drill - steal_target = /obj/item/pickaxe/diamonddrill - explanation_text = "Steal a diamond drill." - weight = 20 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 90 - if(1) - return 85 - if(2) - return 70 - if(3) - return 75 - if(4) - return 75 - - get_weight(var/job) - return 2 - - boh - steal_target = /obj/item/storage/backpack/holding - explanation_text = "Steal a \"bag of holding.\"" - weight = 20 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 90 - if(1) - return 85 - if(2) - return 80 - if(3) - return 75 - if(4) - return 75 - - get_weight(var/job) - return 2 - - hyper_cell - steal_target = /obj/item/cell/hyper - explanation_text = "Steal a hyper capacity power cell." - weight = 20 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 90 - if(1) - return 85 - if(2) - return 80 - if(3) - return 75 - if(4) - return 75 - - get_weight(var/job) - return 2 - - lucy - steal_target = /obj/item/stack/sheet/diamond - explanation_text = "Steal 10 diamonds." - weight = 20 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 90 - if(1) - return 85 - if(2) - return 80 - if(3) - return 75 - if(4) - return 75 - - get_weight(var/job) - return 2 - - check_completion() - var/target_amount = 10 - var/found_amount = 0.0//Always starts as zero. - for(var/obj/item/I in owner.current.get_contents()) - if(!istype(I, steal_target)) - continue//If it's not actually that item. - var/obj/item/stack/sheet/diamond/D = I - found_amount += D.get_amount() - return found_amount>=target_amount - - gold - steal_target = /obj/item/stack/sheet/gold - explanation_text = "Steal 50 gold bars." - weight = 20 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 90 - if(1) - return 85 - if(2) - return 80 - if(3) - return 75 - if(4) - return 70 - - get_weight(var/job) - return 2 - - check_completion() - var/target_amount = 50 - var/found_amount = 0.0//Always starts as zero. - for(var/obj/item/I in owner.current.get_contents()) - if(!istype(I, steal_target)) - continue//If it's not actually that item. - var/obj/item/stack/sheet/gold/G = I - found_amount += G.get_amount() - return found_amount>=target_amount - - uranium - steal_target = /obj/item/stack/sheet/uranium - explanation_text = "Steal 25 uranium bars." - weight = 20 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 90 - if(1) - return 85 - if(2) - return 80 - if(3) - return 75 - if(4) - return 70 - - get_weight(var/job) - return 2 - - check_completion() - var/target_amount = 25 - var/found_amount = 0.0//Always starts as zero. - for(var/obj/item/I in owner.current.get_contents()) - if(!istype(I, steal_target)) - continue//If it's not actually that item. - var/obj/item/stack/sheet/uranium/U = I - found_amount += U.get_amount() - return found_amount>=target_amount - - - /*Needs some work before it can be put in the game to differentiate ship implanters from syndicate implanters. - steal/implanter - steal_target = /obj/item/implanter - explanation_text = "Steal an implanter" - weight = 50 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 75 - if(1) - return 60 - if(2) - return 50 - if(3) - return 30 - if(4) - return INFINITY - */ - cyborg - steal_target = /obj/item/robot_parts/robot_suit - explanation_text = "Steal a completed robot shell (no brain)" - weight = 30 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 75 - if(1) - return 60 - if(2) - return 50 - if(3) - return 30 - if(4) - return 20 - - check_completion() - if(steal_target) - for(var/obj/item/robot_parts/robot_suit/objective in owner.current.get_contents()) - if(istype(objective,/obj/item/robot_parts/robot_suit) && objective.check_completion()) - return 1 - return 0 - - get_weight(var/job) - return 20 - AI - steal_target = /obj/structure/AIcore - explanation_text = "Steal a finished AI, either by intelliCore or stealing the whole construct." - weight = 50 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 75 - if(1) - return 60 - if(2) - return 50 - if(3) - return 30 - if(4) - return 20 - - get_weight(var/job) - return 15 - - check_completion() - if(steal_target) - for(var/obj/item/aicard/C in owner.current.get_contents()) - for(var/mob/living/silicon/ai/M in C) - if(istype(M, /mob/living/silicon/ai) && M.stat != 2) - return 1 - for(var/mob/living/silicon/ai/M in world) - if(istype(M.loc, /turf)) - if(istype(get_area(M), /area/shuttle/escape)) - return 1 - for(var/obj/structure/AIcore/M in world) - if(istype(M.loc, /turf) && M.state == 4) - if(istype(get_area(M), /area/shuttle/escape)) - return 1 - return 0 - - drugs - steal_target = /datum/reagent/space_drugs - explanation_text = "Steal some space drugs." - weight = 40 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 75 - if(1) - return 60 - if(2) - return 50 - if(3) - return 30 - if(4) - return 20 - - check_completion() - if(steal_target) - if(owner.current.check_contents_for_reagent(steal_target)) - return 1 - else - return 0 - - get_weight(var/job) - return 20 - - - pacid - steal_target = /datum/reagent/pacid - explanation_text = "Steal some polytrinic acid." - weight = 40 - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 75 - if(1) - return 60 - if(2) - return 50 - if(3) - return 30 - if(4) - return 20 - - check_completion() - if(steal_target) - if(owner.current.check_contents_for_reagent(steal_target)) - return 1 - else - return 0 - - get_weight(var/job) - return 20 - - - reagent - weight = 20 - var/target_name - New(var/text,var/joba) - ..() - var/list/items = list("Sulphuric acid", "Polytrinic acid", "Space Lube", "Unstable mutagen",\ - "Leporazine", "Cryptobiolin", "Lexorin ",\ - "Kelotane", "Dexalin", "Tricordrazine") - target_name = pick(items) - switch(target_name) - if("Sulphuric acid") - steal_target = /datum/reagent/acid - if("Polytrinic acid") - steal_target = /datum/reagent/pacid - if("Space Lube") - steal_target = /datum/reagent/lube - if("Unstable mutagen") - steal_target = /datum/reagent/mutagen - if("Leporazine") - steal_target = /datum/reagent/leporazine - if("Cryptobiolin") - steal_target =/datum/reagent/cryptobiolin - if("Lexorin") - steal_target = /datum/reagent/lexorin - if("Kelotane") - steal_target = /datum/reagent/kelotane - if("Dexalin") - steal_target = /datum/reagent/dexalin - if("Tricordrazine") - steal_target = /datum/reagent/tricordrazine - - explanation_text = "Steal a container filled with [target_name]." - - get_points(var/job) - switch(GetRank(job)) - if(0) - return 75 - if(1) - return 60 - if(2) - return 50 - if(3) - return 30 - if(4) - return 20 - - check_completion() - if(steal_target) - if(owner.current.check_contents_for_reagent(steal_target)) - return 1 - else - return 0 - - get_weight(var/job) - return 20 - - cash //must be in credits - atm and coins don't count - var/steal_amount = 2000 - explanation_text = "Beg, borrow or steal 2000 credits." - weight = 20 - - New(var/text,var/joba) - ..(text,joba) - steal_amount = 1250 + rand(0,3750) - explanation_text = "Beg, borrow or steal [steal_amount] credits." - - get_points(var/job) - return 10 + 25 * round(steal_amount / 5000) - - check_completion() - var/held_credits = 0 - for(var/obj/item/spacecash/M in owner.current.get_contents()) - held_credits += M.worth - if(held_credits >= steal_amount) - return 1 - return 0 - - get_weight(var/job) - return 20 - - - nuclear - explanation_text = "Destroy the station with a nuclear device." - - - block - explanation_text = "Do not allow any humans to escape on the shuttle alive." - - - check_completion() - if(!istype(owner.current, /mob/living/silicon)) - return 0 - if(!SSemergencyshuttle.returned()) - return 0 - if(!owner.current) - return 0 - var/area/shuttle = locate(/area/shuttle/escape/centcom) - var/protected_mobs[] = list(/mob/living/silicon/ai, /mob/living/silicon/pai, /mob/living/silicon/robot) - for(var/mob/living/player in world) - if(player.type in protected_mobs) continue - if (player.mind) - if (player.stat != 2) - if (get_turf(player) in shuttle) - return 0 - return 1 - - decapitate - New(var/text,var/joba,var/datum/mind/targeta) - target = targeta - job = joba - explanation_text = "Remove and recover the head of [target.current.real_name], the [target.assigned_role]." - proc/find_target() - ..() - if(target && target.current) - var/datum/gender/T = GLOB.gender_datums[target.current.get_visible_gender()] - explanation_text = "[target.current.real_name], the [target.role_alt_title ? target.role_alt_title : target.assigned_role], has defied us for the last time. Make an example of [T.him], and bring us [T.his] severed head." - else - explanation_text = "Free Objective" - return target - - - find_target_by_role(role, role_type=0) - ..(role, role_type) - if(target && target.current) - var/datum/gender/T = GLOB.gender_datums[target.current.get_visible_gender()] - explanation_text = "[target.current.real_name], the [target.role_alt_title ? target.role_alt_title : (!role_type ? target.assigned_role : target.special_role)], has defied us for the last time. Make an example of [T.him], and bring us [T.his] severed head." - else - explanation_text = "Free Objective" - return target - - - check_completion() - if(target && target.current) - if(!owner.current||owner.current.stat==2)//If you're otherwise dead. - return 0 - var/list/all_items = owner.current.get_contents() - for(var/obj/item/organ/head/mmi in all_items) - if(mmi.brainmob&&mmi.brainmob.mind==target) - return 1 - return 0 - else - return 1 - - absorb - var/target_amount - proc/gen_amount_goal(var/lowbound = 4, var/highbound = 6) - target_amount = rand (lowbound,highbound) - if (SSticker) - var/n_p = 1 //autowin - if (SSticker.current_state == GAME_STATE_SETTING_UP) - for(var/mob/new_player/P in world) - if(P.client && P.ready && P.mind!=owner) - n_p ++ - else if (SSticker.current_state == GAME_STATE_PLAYING) - for(var/mob/living/carbon/human/P in world) - if(P.client && !(P.mind in SSticker.mode.changelings) && P.mind!=owner) - n_p ++ - target_amount = min(target_amount, n_p) - - explanation_text = "Absorb [target_amount] compatible genomes." - return target_amount - - check_completion() - if(owner && owner.current && owner.current.changeling && owner.current.changeling.absorbed_dna && ((owner.current.changeling.absorbed_dna.len - 1) >= target_amount)) - return 1 - else - return 0 - - meme_attune - var/target_amount - proc/gen_amount_goal(var/lowbound = 4, var/highbound = 6) - target_amount = rand (lowbound,highbound) - - explanation_text = "Attune [target_amount] humanoid brains." - return target_amount - - check_completion() - if(owner && owner.current && istype(owner.current,/mob/living/parasite/meme) && (owner.current:indoctrinated.len >= target_amount)) - return 1 - else - return 0 - - download - var/target_amount - proc/gen_amount_goal() - target_amount = rand(10,20) - explanation_text = "Download [target_amount] research levels." - return target_amount - - - check_completion() - if(!ishuman(owner.current)) - return 0 - if(!owner.current || owner.current.stat == 2) - return 0 - - var/current_amount - var/obj/item/hardsuit/S - if(istype(owner.current,/mob/living/carbon/human)) - var/mob/living/carbon/human/H = owner.current - S = H.back - if(!S || !istype(S) || !S.stored_research.len) - return 0 - else - for(var/datum/tech/current_data in S.stored_research) - if(current_data.level>1) current_amount+=(current_data.level-1) - if(current_amount" if(charging) var/obj/item/cell/C = charging.get_cell() - . += "Current charge: [C.charge] / [C.maxcharge]" + . += "Current charge: [C.charge] / [C.max_charge]" /obj/machinery/recharger/attackby(obj/item/G, mob/user) var/allowed = FALSE @@ -230,7 +230,17 @@ plane = TURF_PLANE layer = ABOVE_TURF_LAYER base_power_draw = 30000 - allowed_devices = list(/obj/item/gun/energy, /obj/item/gun/magnetic, /obj/item/melee/baton, /obj/item/flashlight, /obj/item/cell/device, /obj/item/ammo_casing/microbattery, /obj/item/ammo_magazine/microbattery, /obj/item/gun/ballistic/microbattery) + allowed_devices = list( + /obj/item/gun/energy, + /obj/item/gun/magnetic, + /obj/item/melee/baton, + /obj/item/flashlight, + /obj/item/cell/small, + /obj/item/cell/weapon, + /obj/item/ammo_casing/microbattery, + /obj/item/ammo_magazine/microbattery, + /obj/item/gun/ballistic/microbattery, + ) icon_state_charged = "wrecharger2" icon_state_charging = "wrecharger1" icon_state_idle = "wrecharger0" diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index e7a0d712e6f1..27cfa749ce5b 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -80,7 +80,7 @@ if(R.module) R.module.respawn_consumable(R, DYNAMIC_W_TO_CELL_UNITS(charging_power, 1) / 250) //consumables are magical, apparently if(R.cell && !R.cell.fully_charged()) - var/diff = min(R.cell.maxcharge - R.cell.charge, DYNAMIC_W_TO_CELL_UNITS(charging_power, 1)) // Capped by charging_power / tick + var/diff = min(R.cell.max_charge - R.cell.charge, DYNAMIC_W_TO_CELL_UNITS(charging_power, 1)) // Capped by charging_power / tick var/charge_used = cell.use(diff) R.cell.give(charge_used) @@ -127,7 +127,7 @@ storedmod.damage = 0 var/obj/item/cell/rigcell = wornrig.get_cell() if(rigcell) - var/diff = min(rigcell.maxcharge - rigcell.charge, DYNAMIC_W_TO_CELL_UNITS(charging_power, 1)) // Capped by charging_power / tick + var/diff = min(rigcell.max_charge - rigcell.charge, DYNAMIC_W_TO_CELL_UNITS(charging_power, 1)) // Capped by charging_power / tick var/charge_used = cell.use(diff) rigcell.give(charge_used) diff --git a/code/game/machinery/vending/engineering.dm b/code/game/machinery/vending/engineering.dm index 6d99a69ca9b9..bfb90cf05c4f 100644 --- a/code/game/machinery/vending/engineering.dm +++ b/code/game/machinery/vending/engineering.dm @@ -40,7 +40,9 @@ /obj/item/geiger_counter = 4, /obj/item/clothing/glasses/meson = 2, /obj/item/multitool = 4, - /obj/item/cell/high = 10, + /obj/item/cell/small = 10, + /obj/item/cell/medium = 10, + /obj/item/cell/large = 10, /obj/item/airlock_electronics = 10, /obj/item/module/power_control = 10, /obj/item/circuitboard/airalarm = 10, diff --git a/code/game/machinery/vending/research.dm b/code/game/machinery/vending/research.dm index 62f3b995785a..86ffe63f950b 100644 --- a/code/game/machinery/vending/research.dm +++ b/code/game/machinery/vending/research.dm @@ -26,7 +26,9 @@ /obj/item/clothing/under/rank/roboticist = 4, /obj/item/stack/cable_coil = 4, /obj/item/flash = 4, - /obj/item/cell/high = 12, + /obj/item/cell/small = 12, + /obj/item/cell/medium = 12, + /obj/item/cell/large = 12, /obj/item/assembly/prox_sensor = 3, /obj/item/assembly/signaler = 3, /obj/item/healthanalyzer = 3, diff --git a/code/game/machinery/vitals_monitor.dm b/code/game/machinery/vitals_monitor.dm index e5f0c1197e9d..8d3c066819b1 100644 --- a/code/game/machinery/vitals_monitor.dm +++ b/code/game/machinery/vitals_monitor.dm @@ -5,7 +5,6 @@ origin_tech = list(TECH_DATA = 3, TECH_BIO = 4, TECH_ENGINEERING = 2) req_components = list( /obj/item/stock_parts/console_screen = 1, - /obj/item/cell/high = 1 ) /obj/machinery/vitals_monitor diff --git a/code/game/objects/items/circuitboards/machinery/recharge_station.dm b/code/game/objects/items/circuitboards/machinery/recharge_station.dm index 28b7a0c2834b..a61172c6e93a 100644 --- a/code/game/objects/items/circuitboards/machinery/recharge_station.dm +++ b/code/game/objects/items/circuitboards/machinery/recharge_station.dm @@ -14,5 +14,5 @@ /obj/item/stock_parts/manipulator = 2, ) def_components = list( - /obj/item/cell = /obj/item/cell/super + /obj/item/cell/large = /obj/item/cell/large, ) diff --git a/code/game/objects/items/devices/defib.dm b/code/game/objects/items/devices/defib.dm index 4e05b9fb44b1..8644c9bfe207 100644 --- a/code/game/objects/items/devices/defib.dm +++ b/code/game/objects/items/devices/defib.dm @@ -40,7 +40,6 @@ /obj/item/defib_kit/loaded //starts with a cell bcell = /obj/item/cell/apc - /obj/item/defib_kit/update_icon() cut_overlays() diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index 5ab5145b43cd..f88c8001140e 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -105,13 +105,13 @@ . += "\The [src] is set to [brightness_level]. " if(cell) . += "\The [src] has a \the [cell] attached. " - if(cell.charge <= cell.maxcharge*0.25) + if(cell.charge <= cell.max_charge*0.25) . += "It appears to have a low amount of power remaining." - else if(cell.charge > cell.maxcharge*0.25 && cell.charge <= cell.maxcharge*0.5) + else if(cell.charge > cell.max_charge*0.25 && cell.charge <= cell.max_charge*0.5) . += "It appears to have an average amount of power remaining." - else if(cell.charge > cell.maxcharge*0.5 && cell.charge <= cell.maxcharge*0.75) + else if(cell.charge > cell.max_charge*0.5 && cell.charge <= cell.max_charge*0.75) . += "It appears to have an above average amount of power remaining." - else if(cell.charge > cell.maxcharge*0.75 && cell.charge <= cell.maxcharge) + else if(cell.charge > cell.max_charge*0.75 && cell.charge <= cell.max_charge) . += "It appears to have a high amount of power remaining." /obj/item/flashlight/AltClick(mob/user) diff --git a/code/game/objects/items/inducer.dm b/code/game/objects/items/inducer.dm index 2b665ca5bc40..c4b10af457a2 100644 --- a/code/game/objects/items/inducer.dm +++ b/code/game/objects/items/inducer.dm @@ -33,7 +33,7 @@ /obj/item/inducer/Initialize(mapload) . = ..() - var/datum/object_system/cell_slot/cell_slot = init_cell_slot(cell_type) + var/datum/object_system/cell_slot/cell_slot = init_cell_slot(cell_type, CELL_TYPE_MEDIUM) cell_slot.receive_emp = TRUE cell_slot.receive_inducer = TRUE cell_slot.remove_yank_offhand = TRUE @@ -44,7 +44,7 @@ /obj/item/inducer/examine(mob/user, dist) . = ..() if(!isnull(obj_cell_slot.cell)) - . += "
Its display shows: [round(obj_cell_slot.cell.charge)] / [obj_cell_slot.cell.maxcharge]." + . += "
Its display shows: [round(obj_cell_slot.cell.charge)] / [obj_cell_slot.cell.max_charge]." else . += "
Its display is dark." if(opened) @@ -217,7 +217,7 @@ var/obj/item/cell/C = get_cell(TRUE) if(C) things_to_induce += C - if(C.charge >= C.maxcharge) + if(C.charge >= C.max_charge) return INDUCER_SCAN_FULL /** @@ -234,7 +234,7 @@ . = ..() var/obj/item/cell/C = get_cell() if(C) - var/use = clamp(C.maxcharge - C.charge, 0, amount) + var/use = clamp(C.max_charge - C.charge, 0, amount) C.give(use) return use else diff --git a/code/game/objects/items/storage/belt.dm b/code/game/objects/items/storage/belt.dm index bbfa11ec62d2..b8bcc7650515 100644 --- a/code/game/objects/items/storage/belt.dm +++ b/code/game/objects/items/storage/belt.dm @@ -59,7 +59,8 @@ /obj/item/tool/wrench, /obj/item/multitool, /obj/item/flashlight, - /obj/item/cell/device, + /obj/item/cell/small, + /obj/item/cell/weapon, /obj/item/stack/cable_coil, /obj/item/t_scanner, /obj/item/atmos_analyzer, @@ -146,7 +147,8 @@ /obj/item/clothing/glasses, /obj/item/tool/crowbar, /obj/item/flashlight, - /obj/item/cell/device, + /obj/item/cell/small, + /obj/item/cell/weapon, /obj/item/extinguisher/mini, /obj/item/switchtool/surgery, /obj/item/storage/quickdraw/syringe_case @@ -171,7 +173,8 @@ /obj/item/ammo_casing/a10g, /obj/item/ammo_casing/a12g, /obj/item/ammo_magazine, - /obj/item/cell/device, + /obj/item/cell/small, + /obj/item/cell/weapon, /obj/item/reagent_containers/food/snacks/donut/, /obj/item/melee/baton, /obj/item/gun/energy/taser, @@ -206,7 +209,8 @@ /obj/item/barrier_tape_roll, /obj/item/clothing/glasses, /obj/item/flashlight, - /obj/item/cell/device, + /obj/item/cell/small, + /obj/item/cell/weapon, /obj/item/reagent_containers/spray/luminol, /obj/item/sample, /obj/item/forensics/sample_kit/powder, @@ -258,8 +262,8 @@ /obj/item/t_scanner, /obj/item/atmos_analyzer, /obj/item/flashlight, - /obj/item/cell/device, - /obj/item/cell/device/weapon, + /obj/item/cell/small, + /obj/item/cell/weapon, /obj/item/material/butterfly, /obj/item/material/knife, /obj/item/melee/transforming/energy/sword, @@ -355,7 +359,8 @@ /obj/item/clothing/glasses, /obj/item/tool/crowbar, /obj/item/flashlight, - /obj/item/cell/device, + /obj/item/cell/small, + /obj/item/cell/weapon, /obj/item/extinguisher/mini, /obj/item/surgical ) @@ -414,7 +419,8 @@ insertion_whitelist = list( /obj/item/clothing/glasses, /obj/item/flashlight, - /obj/item/cell/device, + /obj/item/cell/small, + /obj/item/cell/weapon, /obj/item/grenade, /obj/item/pda, /obj/item/radio/headset, @@ -443,7 +449,8 @@ /obj/item/gps, /obj/item/measuring_tape, /obj/item/flashlight, - /obj/item/cell/device, + /obj/item/cell/small, + /obj/item/cell/weapon, /obj/item/pickaxe, /obj/item/depth_scanner, /obj/item/camera, diff --git a/code/game/objects/items/tools/weldingtool.dm b/code/game/objects/items/tools/weldingtool.dm index d283f298acb8..f4fe1a329751 100644 --- a/code/game/objects/items/tools/weldingtool.dm +++ b/code/game/objects/items/tools/weldingtool.dm @@ -627,9 +627,9 @@ if(use_external_power) var/obj/item/cell/external = get_external_power_supply() if(external) - return external.maxcharge + return external.max_charge else if(power_supply) - return power_supply.maxcharge + return power_supply.max_charge return 0 /obj/item/weldingtool/electric/remove_fuel(var/amount = 1, var/mob/M = null) diff --git a/code/game/objects/items/uav.dm b/code/game/objects/items/uav.dm index 27ef0ae3ee6f..8228ddabc056 100644 --- a/code/game/objects/items/uav.dm +++ b/code/game/objects/items/uav.dm @@ -262,7 +262,7 @@ return FALSE /obj/item/uav/proc/get_status_string() - return "[nickname] - [get_x(src)],[get_y(src)],[get_z(src)] - I:[health]/[initial(health)] - C:[cell ? "[cell.charge]/[cell.maxcharge]" : "Not Installed"]" + return "[nickname] - [get_x(src)],[get_y(src)],[get_z(src)] - I:[health]/[initial(health)] - C:[cell ? "[cell.charge]/[cell.max_charge]" : "Not Installed"]" /obj/item/uav/proc/add_master(var/mob/living/M) LAZYDISTINCTADD(masters, WEAKREF(M)) diff --git a/code/game/objects/random/mapping.dm b/code/game/objects/random/mapping.dm index dfda3c019e94..744cea804a8a 100644 --- a/code/game/objects/random/mapping.dm +++ b/code/game/objects/random/mapping.dm @@ -236,8 +236,8 @@ prob(2);list( /obj/item/melee/baton/cattleprod, /obj/item/melee/baton/cattleprod, - /obj/item/cell/high, - /obj/item/cell/high, + /obj/item/cell/weapon, + /obj/item/cell/weapon, /obj/structure/closet/crate ), prob(2);list( @@ -808,16 +808,16 @@ prob(2);list( /obj/random/energy, /obj/random/energy, - /obj/item/cell/device/weapon, - /obj/item/cell/device/weapon, - /obj/item/cell/device/weapon, - /obj/item/cell/device/weapon, + /obj/item/cell/weapon, + /obj/item/cell/weapon, + /obj/item/cell/weapon, + /obj/item/cell/weapon, /obj/random/energy, /obj/random/energy, - /obj/item/cell/device/weapon, - /obj/item/cell/device/weapon, - /obj/item/cell/device/weapon, - /obj/item/cell/device/weapon, + /obj/item/cell/weapon, + /obj/item/cell/weapon, + /obj/item/cell/weapon, + /obj/item/cell/weapon, /obj/structure/closet/crate/large/secure/corporate/heph //HEPH ENERGY ), prob(2);list( diff --git a/code/game/objects/structures/crates_lockers/closets/secure/explorer.dm b/code/game/objects/structures/crates_lockers/closets/secure/explorer.dm index f4147a83b674..7fdaa7e83aa2 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/explorer.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/explorer.dm @@ -17,7 +17,8 @@ /obj/item/gps/explorer, /obj/item/storage/box/flare, /obj/item/geiger_counter, - /obj/item/cell/device, + /obj/item/cell/small, + /obj/item/cell/weapon, /obj/item/radio, /obj/item/stack/marker_beacon/thirty, /obj/item/storage/box/survival_knife, @@ -104,7 +105,8 @@ /obj/item/storage/box/flare, /obj/item/gun/ballistic/shotgun/flare/explo, /obj/item/storage/box/flashshells, - /obj/item/cell/device, + /obj/item/cell/small, + /obj/item/cell/weapon, /obj/item/radio, /obj/item/gps/explorer, /obj/item/cataloguer/compact, @@ -139,7 +141,8 @@ /obj/item/storage/box/flare, /obj/item/storage/box/explorerkeys, /obj/item/geiger_counter, - /obj/item/cell/device, + /obj/item/cell/small, + /obj/item/cell/weapon, /obj/item/radio, /obj/item/stack/marker_beacon/thirty, /obj/item/storage/box/survival_knife, diff --git a/code/game/objects/structures/crates_lockers/closets/secure/security.dm b/code/game/objects/structures/crates_lockers/closets/secure/security.dm index 1b53f9f27386..3745bfde6463 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/security.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/security.dm @@ -108,7 +108,7 @@ /obj/item/flash, /obj/item/melee/baton/loaded, /obj/item/gun/magnetic/railgun/heater/pistol/hos, - /obj/item/cell/device/weapon, + /obj/item/cell/weapon, /obj/item/clothing/accessory/holster/waist, /obj/item/melee/telebaton, /obj/item/clothing/head/beret/sec/corporate/hos, @@ -262,7 +262,7 @@ /obj/item/reagent_containers/spray/pepper, /obj/item/melee/baton/loaded, /obj/item/gun/energy/gun, - /obj/item/cell/device/weapon, + /obj/item/cell/weapon, /obj/item/storage/box/holobadge, /obj/item/clothing/head/beret/sec/corporate/warden, /obj/item/clothing/suit/storage/hooded/wintercoat/security, @@ -310,7 +310,7 @@ /obj/item/clothing/head/soft/sec/corp, /obj/item/clothing/under/rank/security/corp, /obj/item/gun/energy/secutor, - /obj/item/cell/device/weapon, + /obj/item/cell/weapon, /obj/item/gps/security, /obj/item/holowarrant, /obj/item/clothing/under/bodysuit/bodysuitsec, @@ -460,7 +460,7 @@ GLOBAL_LIST_BOILERPLATE(all_brig_closets, /obj/structure/closet/secure_closet/br /obj/item/flashlight/flare, /obj/item/clothing/accessory/storage/black_vest, /obj/item/gun/energy/secutor, - /obj/item/cell/device/weapon, + /obj/item/cell/weapon, /obj/item/flashlight/maglight, /obj/item/clothing/head/soft/nanotrasen, /obj/item/clothing/head/beret/nanotrasen, @@ -510,7 +510,7 @@ GLOBAL_LIST_BOILERPLATE(all_brig_closets, /obj/structure/closet/secure_closet/br /obj/item/flash, /obj/item/melee/baton/loaded, /obj/item/gun/energy/gun, - /obj/item/cell/device/weapon, + /obj/item/cell/weapon, /obj/item/clothing/accessory/holster/waist, /obj/item/melee/telebaton, /obj/item/clothing/head/beret/sec/corporate/hos, @@ -554,7 +554,7 @@ GLOBAL_LIST_BOILERPLATE(all_brig_closets, /obj/structure/closet/secure_closet/br /obj/item/reagent_containers/spray/pepper, /obj/item/melee/baton/loaded, /obj/item/gun/energy/gun, - /obj/item/cell/device/weapon, + /obj/item/cell/weapon, /obj/item/storage/box/holobadge, /obj/item/clothing/head/beret/sec/corporate/warden, /obj/item/flashlight/maglight, diff --git a/code/game/objects/systems/cell_slot.dm b/code/game/objects/systems/cell_slot.dm index e298cb519a2b..ce9b40ccfe56 100644 --- a/code/game/objects/systems/cell_slot.dm +++ b/code/game/objects/systems/cell_slot.dm @@ -5,19 +5,11 @@ * cell slot */ /datum/object_system/cell_slot + //* State *// /// held cell var/obj/item/cell/cell - /// reserved - cell type accepted enum, for when we do large/medium/small/etc cells later. - var/cell_type - /// considered primary? if so, we get returned on get_cell() - var/primary = TRUE - /// allow inducer? - var/receive_inducer = FALSE - /// allow EMPs to hit? - var/receive_emp = FALSE - /// allow explosions to hit cell? - // todo: currently unused - var/recieve_explosion = FALSE + + //* Config - Interaction *// /// allow quick removal by clicking with hand? var/remove_yank_offhand = FALSE /// allow context menu removal? @@ -32,7 +24,25 @@ var/remove_tool_time = 0 /// removal / insertion is discrete or loud var/remove_is_discrete = TRUE - /// legacy + + //* Config - Defense *// + /// allow EMPs to hit? + var/receive_emp = FALSE + /// allow explosions to hit cell? + // todo: currently unused + var/recieve_explosion = FALSE + + //* Config - Integration *// + /// allow inducer? + var/receive_inducer = FALSE + /// considered primary? if so, we get returned on get_cell() + var/primary = TRUE + + //* Config - Cell Accept *// + /// cell types accepted + var/cell_type = NONE + + //! Legacy !// // todo: kill this var/legacy_use_device_cells = FALSE @@ -40,6 +50,7 @@ * returns TRUE if slot accepts this type of cell */ /datum/object_system/cell_slot/proc/accepts_cell(obj/item/cell/cell) + #warn this return legacy_use_device_cells? istype(cell, /obj/item/cell/device) : TRUE /** @@ -112,17 +123,35 @@ //? Lazy wrappers for init -/obj/proc/init_cell_slot(initial_cell_path) +/** + * Creates a cell slot + * + * * This proc will error if it cannot detect a cell type, nor a preload to detect it from. + * + * @params + * * preload_path - (optional) cell typepath to start with + * * cell_type - (optional) CELL_TYPE_* bitfield, of cell types to accept; defaults to preload_path's type if it exists and this isn't provided. + */ +/obj/proc/init_cell_slot(preload_path, cell_type) RETURN_TYPE(/datum/object_system/cell_slot) ASSERT(isnull(obj_cell_slot)) obj_cell_slot = new(src) - if(initial_cell_path) - obj_cell_slot.cell = new initial_cell_path + if(preload_path) + obj_cell_slot.cell = new preload_path + if(isnull(cell_type)) + cell_type = obj_cell_slot.cell_type + else + cell_type = CELL_TYPE_MEDIUM + stack_trace("failed to provide a cell type accept bitfield, and didn't provide a preload path to autodetect from") + obj_cell_slot.cell_type = cell_type return obj_cell_slot -/obj/proc/init_cell_slot_easy_tool(initial_cell_path, offhand_removal = TRUE, inhand_removal = FALSE) +/** + * Wrapper for lazily initializing a cell slot that uses small cells. + */ +/obj/proc/init_cell_slot_easy_tool(preload_path, offhand_removal = TRUE, inhand_removal = FALSE) RETURN_TYPE(/datum/object_system/cell_slot) - if(isnull(init_cell_slot(initial_cell_path))) + if(isnull(init_cell_slot(preload_path))) return if(offhand_removal) obj_cell_slot.remove_yank_offhand = TRUE @@ -131,6 +160,7 @@ obj_cell_slot.remove_yank_context = TRUE obj_cell_slot.remove_yank_time = 0 obj_cell_slot.legacy_use_device_cells = TRUE + obj_cell_slot.cell_type = CELL_TYPE_SMALL return obj_cell_slot //? Wrappers for cell.dm functions @@ -202,18 +232,6 @@ /datum/object_system/cell_slot/proc/checked_use(var/amount) return cell?.checked_use(amount) ? TRUE : FALSE -/** - * cell function wrapper - use x cell units, affected by GLOB.cellefficiency, returns the amount actually used or 0 if null - */ -/datum/object_system/cell_slot/proc/use_scaled(var/amount) - return cell?.use_scaled(amount) || 0 - -/** - * cell function wrapper - checked_use() but scaled by GLOB.cellefficiency - */ -/datum/object_system/cell_slot/proc/checked_use_scaled(var/amount) - return cell?.checked_use_scaled(amount) ? TRUE : FALSE - /** * cell function wrapper - recharge the cell by x amount returns the amount consumed or 0 if cell is null */ diff --git a/code/game/rendering/legacy/rigmech.dm b/code/game/rendering/legacy/rigmech.dm index eb2de1ea2cac..84200f65d31b 100644 --- a/code/game/rendering/legacy/rigmech.dm +++ b/code/game/rendering/legacy/rigmech.dm @@ -77,7 +77,7 @@ var/obj/item/cell/rigcell = owner_rig.cell var/obj/item/tank/rigtank = owner_rig.air_supply - var/charge_percentage = rigcell ? rigcell.charge / rigcell.maxcharge : 0 + var/charge_percentage = rigcell ? rigcell.charge / rigcell.max_charge : 0 var/air_percentage = rigtank ? clamp(rigtank.air_contents.total_moles / 17.4693, 0, 1) : 0 var/air_on = owner_rig.wearer?.internal ? 1 : 0 @@ -127,7 +127,7 @@ var/obj/item/cell/mechcell = owner_mech.cell var/obj/machinery/portable_atmospherics/canister/mechtank = owner_mech.internal_tank - var/charge_percentage = mechcell ? mechcell.charge / mechcell.maxcharge : 0 + var/charge_percentage = mechcell ? mechcell.charge / mechcell.max_charge : 0 var/air_percentage = mechtank ? clamp(mechtank.air_contents.total_moles / 1863.47, 0, 1) : 0 var/health_percentage = owner_mech.percent_integrity() var/air_on = owner_mech.use_internal_tank diff --git a/code/modules/atmospherics/machinery/portable/powered.dm b/code/modules/atmospherics/machinery/portable/powered.dm index f84ae88b01dd..d9904c387a6e 100644 --- a/code/modules/atmospherics/machinery/portable/powered.dm +++ b/code/modules/atmospherics/machinery/portable/powered.dm @@ -33,7 +33,7 @@ /obj/machinery/portable_atmospherics/powered/ui_static_data(mob/user, datum/tgui/ui) . = ..() .["useCharge"] = TRUE - .["maxCharge"] = isnull(cell)? 0 : cell.maxcharge + .["maxCharge"] = isnull(cell)? 0 : cell.max_charge .["powerRating"] = power_maximum .["useCell"] = use_cell diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm index 1e314a16cb8f..d1767cd59b0d 100644 --- a/code/modules/atmospherics/machinery/portable/pump.dm +++ b/code/modules/atmospherics/machinery/portable/pump.dm @@ -84,7 +84,7 @@ last_flow_rate_legacy = 0 last_power_draw_legacy = 0 else - cell.use_scaled(DYNAMIC_W_TO_CELL_UNITS(power_draw, 1)) + cell.use(DYNAMIC_W_TO_CELL_UNITS(power_draw, 1)) last_power_draw_legacy = power_draw update_connected_network() @@ -133,7 +133,7 @@ data["powerDraw"] = round(last_power_draw_legacy) data["cellCharge"] = cell ? cell.charge : 0 - data["cellMaxCharge"] = cell ? cell.maxcharge : 1 + data["cellMaxCharge"] = cell ? cell.max_charge : 1 if(holding) data["holding"] = list() diff --git a/code/modules/hardsuits/_rig.dm b/code/modules/hardsuits/_rig.dm index a0283f4234a3..92f95c13861d 100644 --- a/code/modules/hardsuits/_rig.dm +++ b/code/modules/hardsuits/_rig.dm @@ -733,8 +733,8 @@ data["chest"] = (chest ? "[chest.name]" : "None.") data["charge"] = cell ? round(cell.charge,1) : 0 - data["maxcharge"] = cell ? cell.maxcharge : 0 - data["chargestatus"] = cell ? FLOOR((cell.charge/cell.maxcharge)*50, 1) : 0 + data["max_charge"] = cell ? cell.max_charge : 0 + data["chargestatus"] = cell ? FLOOR((cell.charge/cell.max_charge)*50, 1) : 0 data["emagged"] = subverted data["coverlock"] = locked diff --git a/code/modules/hardsuits/modules/computer.dm b/code/modules/hardsuits/modules/computer.dm index b16008bc9723..b681f7c5c5fa 100644 --- a/code/modules/hardsuits/modules/computer.dm +++ b/code/modules/hardsuits/modules/computer.dm @@ -450,7 +450,7 @@ // Attempts to drain up to 12.5*cell-capacity kW, determines this value from remaining cell capacity to ensure we don't drain too much. // 1Ws/(12.5*CELLRATE) = 40s to charge - var/to_drain = min(12.5 * holder.cell.maxcharge, holder.cell.maxcharge - holder.cell.charge) + var/to_drain = min(12.5 * holder.cell.max_charge, holder.cell.max_charge - holder.cell.charge) var/target_drained = interfaced_with.drain_energy(src, DYNAMIC_CELL_UNITS_TO_KJ(to_drain)) if(target_drained <= 0) to_chat(H, "Your power sink flashes a red light; there is no power left in [interfaced_with].") diff --git a/code/modules/hardsuits/modules/modules.dm b/code/modules/hardsuits/modules/modules.dm index cb944557a5ef..017bc93f68b9 100644 --- a/code/modules/hardsuits/modules/modules.dm +++ b/code/modules/hardsuits/modules/modules.dm @@ -247,7 +247,7 @@ . = list() if(!C.statpanel_tab("Hardsuit Modules", needed)) return - var/cell_status = R.cell ? "[R.cell.charge]/[R.cell.maxcharge]" : "ERROR" + var/cell_status = R.cell ? "[R.cell.charge]/[R.cell.max_charge]" : "ERROR" STATPANEL_DATA_ENTRY("Suit charge", cell_status) for(var/obj/item/hardsuit_module/module in R.installed_modules) for(var/stat_hardsuit_module/SRM in module.stat_modules) diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index 48206ed05c1e..2f14990ae64d 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -180,8 +180,8 @@ var/obj/item/cell/potato/pocell = new /obj/item/cell/potato(get_turf(user)) if(src.loc == user && istype(user,/mob/living/carbon/human)) user.put_in_hands(pocell) - pocell.maxcharge = src.potency * 200 //fellas, have you ever actually tried to reach 200 potency? Let them have this if they can manage it. - pocell.charge = pocell.maxcharge + pocell.max_charge = src.potency * 200 //fellas, have you ever actually tried to reach 200 potency? Let them have this if they can manage it. + pocell.charge = pocell.max_charge qdel(src) return else if(W.is_sharp()) diff --git a/code/modules/integrated_electronics/core/assemblies.dm b/code/modules/integrated_electronics/core/assemblies.dm index 0567fd44570a..464731dbac65 100644 --- a/code/modules/integrated_electronics/core/assemblies.dm +++ b/code/modules/integrated_electronics/core/assemblies.dm @@ -175,7 +175,7 @@ data["max_complexity"] = max_complexity data["battery_charge"] = round(battery?.charge, 0.1) - data["battery_max"] = round(battery?.maxcharge, 0.1) + data["battery_max"] = round(battery?.max_charge, 0.1) data["net_power"] = DYNAMIC_CELL_UNITS_TO_W(net_power, 1) data["circuit_props"] = ui_circuit_props // This works because lists are always passed by reference in BYOND, so modifying unremovable_circuits diff --git a/code/modules/integrated_electronics/passive/power.dm b/code/modules/integrated_electronics/passive/power.dm index a862baf5599f..c69eea52ad66 100644 --- a/code/modules/integrated_electronics/passive/power.dm +++ b/code/modules/integrated_electronics/passive/power.dm @@ -141,7 +141,7 @@ /obj/item/integrated_circuit/passive/power/chemical_cell/make_energy() if(assembly) for(var/I in fuel) - if(DYNAMIC_CELL_UNITS_TO_W(assembly.battery.maxcharge - assembly.battery.charge, 1) > fuel[I]) + if(DYNAMIC_CELL_UNITS_TO_W(assembly.battery.max_charge - assembly.battery.charge, 1) > fuel[I]) var/power = 1 if(I == "blood") var/list/data = reagents.get_data(I) diff --git a/code/modules/integrated_electronics/subtypes/input.dm b/code/modules/integrated_electronics/subtypes/input.dm index f13a6185a325..2fc86d4014cd 100644 --- a/code/modules/integrated_electronics/subtypes/input.dm +++ b/code/modules/integrated_electronics/subtypes/input.dm @@ -1221,8 +1221,8 @@ GLOBAL_DATUM_INIT(circuit_translation_context, /datum/translation_context/simple set_pin_data(IC_OUTPUT, 4, WEAKREF(assembly)) if(assembly.battery) set_pin_data(IC_OUTPUT, 1, assembly.battery.charge) - set_pin_data(IC_OUTPUT, 2, assembly.battery.maxcharge) - set_pin_data(IC_OUTPUT, 3, 100*assembly.battery.charge/assembly.battery.maxcharge) + set_pin_data(IC_OUTPUT, 2, assembly.battery.max_charge) + set_pin_data(IC_OUTPUT, 3, 100*assembly.battery.charge/assembly.battery.max_charge) set_pin_data(IC_OUTPUT, 5, WEAKREF(assembly.battery)) push_data() activate_pin(2) @@ -1270,7 +1270,7 @@ GLOBAL_DATUM_INIT(circuit_translation_context, /datum/translation_context/simple if(A.Adjacent(B) || (AM in view(A))) push_data() set_pin_data(IC_OUTPUT, 1, cell.charge) - set_pin_data(IC_OUTPUT, 2, cell.maxcharge) + set_pin_data(IC_OUTPUT, 2, cell.max_charge) set_pin_data(IC_OUTPUT, 3, cell.percent()) push_data() activate_pin(2) diff --git a/code/modules/integrated_electronics/subtypes/power.dm b/code/modules/integrated_electronics/subtypes/power.dm index 603d75b76f5f..14d841003a9c 100644 --- a/code/modules/integrated_electronics/subtypes/power.dm +++ b/code/modules/integrated_electronics/subtypes/power.dm @@ -71,7 +71,7 @@ AM.update_icon() set_pin_data(IC_OUTPUT, 1, cell.charge) - set_pin_data(IC_OUTPUT, 2, cell.maxcharge) + set_pin_data(IC_OUTPUT, 2, cell.max_charge) set_pin_data(IC_OUTPUT, 3, cell.percent()) activate_pin(2) push_data() diff --git a/code/modules/mining/tools/kinetic_accelerator.dm b/code/modules/mining/tools/kinetic_accelerator.dm index cfcb7ae64758..76c78c386b6e 100644 --- a/code/modules/mining/tools/kinetic_accelerator.dm +++ b/code/modules/mining/tools/kinetic_accelerator.dm @@ -178,7 +178,7 @@ return /obj/item/gun/energy/kinetic_accelerator/proc/reload() - power_supply.give(power_supply.maxcharge) + power_supply.give(power_supply.max_charge) // process_chamber() // if(!suppressed) playsound(src, 'sound/weapons/kenetic_reload.ogg', 60, 1) diff --git a/code/modules/mining/tools/vertibore.dm b/code/modules/mining/tools/vertibore.dm index 180c3ffd05fc..f82494fb5460 100644 --- a/code/modules/mining/tools/vertibore.dm +++ b/code/modules/mining/tools/vertibore.dm @@ -22,7 +22,7 @@ . = ..() . += "The shaft excavator has [mat_storage]cm^3 of phoron inside, and can hold a maximum of [max_mat_storage]." if(cell) - . += "The installed [cell.name] has a charge level of [round((cell.charge/cell.maxcharge)*100)]%." + . += "The installed [cell.name] has a charge level of [round((cell.charge/cell.max_charge)*100)]%." /obj/item/vertibore/attackby(var/obj/item/thing, var/mob/user) if(istype(thing, /obj/item/cell)) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index f64d28e2f48d..0e77004856e0 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -95,7 +95,7 @@ var/obj/item/hardsuit/suit = back var/cell_status = "ERROR" if(suit.cell) - cell_status = "[suit.cell.charge]/[suit.cell.maxcharge]" + cell_status = "[suit.cell.charge]/[suit.cell.max_charge]" STATPANEL_DATA_ENTRY("Suit charge", "[cell_status]") if(mind) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 4339cc4497ac..d46d8aeb7653 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -268,7 +268,7 @@ var/list/ai_verbs_default = list( else if(!R.cell || R.cell.charge <= 0) robot_status = "DEPOWERED" //Name, Health, Battery, Module, Area, and Status! Everything an AI wants to know about its borgies! - STATPANEL_DATA_LINE("[R.name] | S.Integrity: [R.health]% | Cell: [R.cell ? "[R.cell.charge]/[R.cell.maxcharge]" : "Empty"] | \ + STATPANEL_DATA_LINE("[R.name] | S.Integrity: [R.health]% | Cell: [R.cell ? "[R.cell.charge]/[R.cell.max_charge]" : "Empty"] | \ Module: [R.modtype] | Loc: [get_area_name(R, TRUE)] | Status: [robot_status]") STATPANEL_DATA_LINE("AI shell beacons detected: [LAZYLEN(GLOB.available_ai_shells)]") //Count of total AI shells else diff --git a/code/modules/mob/living/silicon/robot/dogborg/dog_modules_vr.dm b/code/modules/mob/living/silicon/robot/dogborg/dog_modules_vr.dm index f0686a2f5e5c..1320d5ca94d0 100644 --- a/code/modules/mob/living/silicon/robot/dogborg/dog_modules_vr.dm +++ b/code/modules/mob/living/silicon/robot/dogborg/dog_modules_vr.dm @@ -252,7 +252,7 @@ to_chat(user, "You finish off [target], and gain some charge!") var/mob/living/silicon/robot/R = user var/obj/item/cell/C = target - R.cell.charge += C.maxcharge / 3 + R.cell.charge += C.max_charge / 3 water.use_charge(5) qdel(target) return diff --git a/code/modules/mob/living/silicon/robot/drone/drone.dm b/code/modules/mob/living/silicon/robot/drone/drone.dm index 3b6e151c0afa..570a7bcd7373 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone.dm @@ -99,7 +99,7 @@ serial_number = rand(0,999) //They are unable to be upgraded, so let's give them a bit of a better battery. - cell.maxcharge = 10000 + cell.max_charge = 10000 cell.charge = 10000 // NO BRAIN. diff --git a/code/modules/mob/living/silicon/robot/drone/drone_console.dm b/code/modules/mob/living/silicon/robot/drone/drone_console.dm index 5687625be2ef..a77744fa4819 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_console.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_console.dm @@ -45,7 +45,7 @@ "name" = D.real_name, "active" = D.stat != 2, "charge" = D.cell.charge, - "maxCharge" = D.cell.maxcharge, + "maxCharge" = D.cell.max_charge, "loc" = "[get_area(D)]", "ref" = "\ref[D]", ))) diff --git a/code/modules/mob/living/silicon/robot/drone/matrix_hive.dm b/code/modules/mob/living/silicon/robot/drone/matrix_hive.dm index 1a4831fef347..2e45d3fd8a52 100644 --- a/code/modules/mob/living/silicon/robot/drone/matrix_hive.dm +++ b/code/modules/mob/living/silicon/robot/drone/matrix_hive.dm @@ -78,7 +78,7 @@ var/global/list/drone_matrices = list() if(MTX_UPG_SPEED) D.speed = initial(D.speed) - 1 if(MTX_UPG_CELL) - D.cell.maxcharge = D.cell.maxcharge * 1.5 + D.cell.max_charge = D.cell.max_charge * 1.5 if(MTX_UPG_HEALTH) D.maxHealth += 15 if(MTX_UPG_MOP) diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 26d0982af592..c728866c4975 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -185,7 +185,7 @@ if (src.cells) if (src.cell) - var/cellcharge = src.cell.charge/src.cell.maxcharge + var/cellcharge = src.cell.charge/src.cell.max_charge switch(cellcharge) if(0.75 to INFINITY) src.cells.icon_state = "charge4" diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 3e70ef88d922..c691e8b4ce9a 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -173,6 +173,10 @@ var/sitting = FALSE var/bellyup = FALSE + //* Power *// + /// starting cell type + var/starting_cell_type = /obj/item/cell/large + /mob/living/silicon/robot/Initialize(mapload, unfinished = FALSE) spark_system = new /datum/effect_system/spark_spread() spark_system.set_up(5, 0, src) @@ -219,9 +223,7 @@ C.wrapped = new C.external_type if(!cell) - cell = new /obj/item/cell/high(src) - cell.maxcharge = 15000 - cell.charge = 15000 + cell = new starting_cell_type(src) . = ..() @@ -515,7 +517,7 @@ STATPANEL_DATA_LINE("") if(cell) STATPANEL_DATA_LINE("Charge Left: [round(cell.percent())]%") - STATPANEL_DATA_LINE("Cell Rating: [round(cell.maxcharge)]") // Round just in case we somehow get crazy values + STATPANEL_DATA_LINE("Cell Rating: [round(cell.max_charge)]") // Round just in case we somehow get crazy values STATPANEL_DATA_LINE("Power Cell Load: [round(used_power_this_tick)]W") else STATPANEL_DATA_LINE("No Cell Inserted!") diff --git a/code/modules/mob/living/silicon/robot/robot_modules/station/security.dm b/code/modules/mob/living/silicon/robot/robot_modules/station/security.dm index 275de5796971..16742589b357 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules/station/security.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules/station/security.dm @@ -58,7 +58,7 @@ else if(F.times_used) F.times_used-- var/obj/item/gun/energy/taser/mounted/cyborg/T = locate() in src.modules - if(T.power_supply.charge < T.power_supply.maxcharge) + if(T.power_supply.charge < T.power_supply.max_charge) T.power_supply.give(T.charge_cost * amount) T.update_icon() else @@ -137,7 +137,7 @@ else if(F.times_used) F.times_used-- var/obj/item/gun/energy/taser/mounted/cyborg/T = locate() in src.modules - if(T.power_supply.charge < T.power_supply.maxcharge) + if(T.power_supply.charge < T.power_supply.max_charge) T.power_supply.give(T.charge_cost * amount) T.update_icon() else diff --git a/code/modules/mob/living/silicon/robot/subtypes/gravekeeper.dm b/code/modules/mob/living/silicon/robot/subtypes/gravekeeper.dm index e10d1039fd50..49131ab4149f 100644 --- a/code/modules/mob/living/silicon/robot/subtypes/gravekeeper.dm +++ b/code/modules/mob/living/silicon/robot/subtypes/gravekeeper.dm @@ -28,9 +28,5 @@ updatename("Gravekeeper") - if(!cell) - cell = new /obj/item/cell/high(src) // 15k cell, as recharging stations are a lot more rare on the Surface. - - laws = new /datum/ai_laws/gravekeeper() playsound(loc, 'sound/mecha/nominalsyndi.ogg', 75, 0) diff --git a/code/modules/mob/living/silicon/robot/subtypes/lost_drone.dm b/code/modules/mob/living/silicon/robot/subtypes/lost_drone.dm index faa65999cd14..7ebfe3f244ed 100644 --- a/code/modules/mob/living/silicon/robot/subtypes/lost_drone.dm +++ b/code/modules/mob/living/silicon/robot/subtypes/lost_drone.dm @@ -27,10 +27,6 @@ init_id() updatename("Lost") - - if(!cell) - cell = new /obj/item/cell/high(src) // 15k cell, as recharging stations are a lot more rare on the Surface. - playsound(loc, 'sound/mecha/nominalsyndi.ogg', 75, 0) /mob/living/silicon/robot/lost/speech_bubble_appearance() diff --git a/code/modules/mob/living/silicon/robot/subtypes/lost_drone_vr.dm b/code/modules/mob/living/silicon/robot/subtypes/lost_drone_vr.dm index 7779786d55a2..220e81b68ef8 100644 --- a/code/modules/mob/living/silicon/robot/subtypes/lost_drone_vr.dm +++ b/code/modules/mob/living/silicon/robot/subtypes/lost_drone_vr.dm @@ -27,10 +27,6 @@ init_id() updatename("Stray") - - if(!cell) - cell = new /obj/item/cell/high(src) // 15k cell, as recharging stations are a lot more rare on the Surface. - playsound(loc, 'sound/mecha/nominalsyndi.ogg', 75, 0) /mob/living/silicon/robot/stray/speech_bubble_appearance() diff --git a/code/modules/mob/living/silicon/robot/subtypes/syndicate.dm b/code/modules/mob/living/silicon/robot/subtypes/syndicate.dm index f227ad97b0a1..f5f7f385fb8f 100644 --- a/code/modules/mob/living/silicon/robot/subtypes/syndicate.dm +++ b/code/modules/mob/living/silicon/robot/subtypes/syndicate.dm @@ -28,10 +28,6 @@ init_id() updatename("Syndicate") - - if(!cell) - cell = new /obj/item/cell/high(src) // 15k cell, because Antag. - laws = new /datum/ai_laws/syndicate_override() radio.keyslot = new /obj/item/encryptionkey/syndicate(radio) diff --git a/code/modules/mob/living/silicon/robot/syndicate.dm b/code/modules/mob/living/silicon/robot/syndicate.dm index 4c3a1dc1b56a..a2789fe5204b 100644 --- a/code/modules/mob/living/silicon/robot/syndicate.dm +++ b/code/modules/mob/living/silicon/robot/syndicate.dm @@ -6,13 +6,6 @@ lawchannel = "State" idcard_type = /obj/item/card/id/syndicate -/mob/living/silicon/robot/syndicate/Initialize(mapload) - if(!cell) - cell = new /obj/item/cell(src) - cell.maxcharge = 25000 - cell.charge = 25000 - . = ..() - /mob/living/silicon/robot/syndicate/init() aiCamera = new/obj/item/camera/siliconcam/robot_camera(src) diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 1eea2c19674b..934f9c6b686c 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -112,7 +112,7 @@ // cyborgs produced by Robotize get an automatic power cell O.cell = new(O) - O.cell.maxcharge = 15000 + O.cell.max_charge = 15000 O.cell.charge = 15000 diff --git a/code/modules/modular_computers/computers/modular_computer/power.dm b/code/modules/modular_computers/computers/modular_computer/power.dm index 1673e1293a0f..7f2a4eee671b 100644 --- a/code/modules/modular_computers/computers/modular_computer/power.dm +++ b/code/modules/modular_computers/computers/modular_computer/power.dm @@ -28,7 +28,7 @@ return FALSE // At this point, we know that APC can power us for this tick. Check if we also need to charge our battery, and then actually use the power. - if(battery_module && (battery_module.battery.charge < battery_module.battery.maxcharge) && (power_usage > 0)) + if(battery_module && (battery_module.battery.charge < battery_module.battery.max_charge) && (power_usage > 0)) power_usage += tesla_link.passive_charging_rate battery_module.battery.give(DYNAMIC_W_TO_CELL_UNITS(tesla_link.passive_charging_rate, 1)) diff --git a/code/modules/modular_computers/hardware/battery_module.dm b/code/modules/modular_computers/hardware/battery_module.dm index d5e053550366..45bcbdd9c465 100644 --- a/code/modules/modular_computers/hardware/battery_module.dm +++ b/code/modules/modular_computers/hardware/battery_module.dm @@ -59,13 +59,13 @@ /obj/item/computer_hardware/battery_module/diagnostics(var/mob/user) ..() - to_chat(user, "Internal battery charge: [battery.charge]/[battery.maxcharge] CU") + to_chat(user, "Internal battery charge: [battery.charge]/[battery.max_charge] CU") /obj/item/computer_hardware/battery_module/Initialize(mapload) if(ispath(battery)) battery = new battery if(battery) - battery.maxcharge = battery_rating + battery.max_charge = battery_rating battery.charge = 0 return ..() @@ -76,4 +76,4 @@ /obj/item/computer_hardware/battery_module/proc/charge_to_full() if(battery)//nolonger checks for a valid path, instead checks if battery is set. - battery.charge = battery.maxcharge + battery.charge = battery.max_charge diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index e42290cc3c60..d3ec562d732b 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -55,11 +55,13 @@ CREATE_WALL_MOUNTING_TYPES_SHIFTED(/obj/machinery/power/apc/critical, 22) /obj/machinery/power/apc/critical is_critical = 1 +#warn redo /// High capacity cell APCs CREATE_WALL_MOUNTING_TYPES_SHIFTED(/obj/machinery/power/apc/high, 22) /obj/machinery/power/apc/high cell_type = /obj/item/cell/high +#warn redo /// Super capacity cell APCS CREATE_WALL_MOUNTING_TYPES_SHIFTED(/obj/machinery/power/apc/super, 22) /obj/machinery/power/apc/super @@ -70,6 +72,7 @@ CREATE_WALL_MOUNTING_TYPES_SHIFTED(/obj/machinery/power/apc/super/critical, 22) /obj/machinery/power/apc/super/critical is_critical = 1 +#warn redo /// APCS with hyper cells. How lewd CREATE_WALL_MOUNTING_TYPES_SHIFTED(/obj/machinery/power/apc/hyper, 22) /obj/machinery/power/apc/hyper @@ -301,7 +304,7 @@ CREATE_WALL_MOUNTING_TYPES_SHIFTED(/obj/machinery/power/apc, 22) // is starting with a power cell installed, create it and set its charge level if(cell_type) src.cell = new cell_type(src) - cell.charge = start_charge * cell.maxcharge / 100.0 // (convert percentage to actual value) + cell.charge = start_charge * cell.max_charge / 100.0 // (convert percentage to actual value) var/area/A = src.loc.loc @@ -1160,7 +1163,7 @@ CREATE_WALL_MOUNTING_TYPES_SHIFTED(/obj/machinery/power/apc, 22) if(src.attempt_charging()) if(excess > 0) // check to make sure we have enough to charge // Max charge is capped to % per second constant - var/ch = min(DYNAMIC_KW_TO_CELL_UNITS(excess, 1), cell.maxcharge * chargelevel, cell.maxcharge - cell.charge) + var/ch = min(DYNAMIC_KW_TO_CELL_UNITS(excess, 1), cell.max_charge * chargelevel, cell.max_charge - cell.charge) var/charged = draw_power(DYNAMIC_CELL_UNITS_TO_KW(ch, 1)) // Removes the power we're taking from the grid cell.give(DYNAMIC_KW_TO_CELL_UNITS(charged, 1)) // actually recharge the cell lastused_charging = charged * 1000 @@ -1177,7 +1180,7 @@ CREATE_WALL_MOUNTING_TYPES_SHIFTED(/obj/machinery/power/apc, 22) if(chargemode) if(!charging) - var/charge_tick = cell.maxcharge * chargelevel + var/charge_tick = cell.max_charge * chargelevel charge_tick = DYNAMIC_CELL_UNITS_TO_KW(charge_tick, 1) if(excess > charge_tick) chargecount++ diff --git a/code/modules/power/batteryrack.dm b/code/modules/power/batteryrack.dm index 2b909bb14c10..0fc81ff11baf 100644 --- a/code/modules/power/batteryrack.dm +++ b/code/modules/power/batteryrack.dm @@ -32,7 +32,7 @@ var/C = 0 for(var/obj/item/cell/PC in component_parts) - C += PC.maxcharge + C += PC.max_charge cells_amount++ capacity = KJ_TO_KWM(DYNAMIC_CELL_UNITS_TO_KJ(C)) diff --git a/code/modules/power/cell.dm b/code/modules/power/cells/cell.dm similarity index 58% rename from code/modules/power/cell.dm rename to code/modules/power/cells/cell.dm index 9757c4173c31..2d45452159fa 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cells/cell.dm @@ -14,14 +14,72 @@ throw_speed = 3 throw_range = 5 w_class = WEIGHT_CLASS_NORMAL + + //* -- Set by type generation -- *// + + /// should we run typegen from the power cell datum we're provided? + /// + /// These things are affected, on the power cell datum side + /// * typegen_capacity + /// * typegen_material + /// * typegen_visual + /// * typegen_worth + /// + /// The following things are statically set by the #define generator + /// * indicator color + /// * stripe color + /// * charge capacity + /// + /// The following things are set at init + /// * materials + /// + /// The following things are read at runtime + /// * worth + /// + /// This should never be modified after Initialize() runs. + var/tmp/typegen_active = FALSE + #warn we should set name and desc via macro too.. + + //* Behavior *// + /// cell component; loaded at init, set to typepath or anonymous type + var/datum/power_cell/cell_datum + + //* Charge *// + /// current charge + var/charge + /// maximum charge + /// + /// * also used as a base for type generation + var/max_charge = POWER_CELL_CAPACITY_BASE + + //* Configuration *// + /// allow rechargers + var/can_be_recharged = TRUE + #warn impl + + //* Rendering *// + /// perform default rendering + var/rendering_system = FALSE + /// total states; 0 to disable auto render + var/indicator_count + /// our indicator color + var/indicator_color = "#00aa00" + /// our stripe color; null for no stripe + var/stripe_color + + //* Self Recharge *// + /// do we self recharge? + var/self_recharge = FALSE + /// cell units to give, per second, if self-recharging + var/self_recharge_amount = 50 + /// how long to wait until after the last use to start recharging + var/self_recharge_delay = 0 SECONDS + + //* legacy below *// /// Are we EMP immune? var/emp_proof = FALSE - var/charge - var/maxcharge = 1000 var/rigged = 0 // true if rigged to explode var/minor_fault = 0 //If not 100% reliable, it will build up faults. - var/self_recharge = FALSE // If true, the cell will recharge itself. - var/charge_amount = 25 // How much power to give, if self_recharge is true. The number is in absolute cell charge, as it gets divided by CELLRATE later. var/last_use = 0 // A tracker for use in self-charging var/charge_delay = 0 // How long it takes for the cell to start recharging after last use var/rating = 1 @@ -30,12 +88,20 @@ // Overlay stuff. var/overlay_half_state = "cell-o1" // Overlay used when not fully charged but not empty. var/overlay_full_state = "cell-o2" // Overlay used when fully charged. - var/last_overlay_state = null // Used to optimize update_icon() calls. /obj/item/cell/Initialize(mapload) + #warn cell datum; use it to do materials mod + if(!isnull(typegen_material_modify) && !is_typelist(NAMEOF(src, materials_base), materials_base)) + if(has_typelist(NAMEOF(src, materials_base))) + materials_base = get_typelist(NAMEOF(src, materials_base)) + else + var/list/multiplied = materials_base.Copy() + for(var/key in multiplied) + multiplied[key] = multiplied[key] * typegen_material_modify + materials_base = typelist(NAMEOF(src, materials_base), multiplied) . = ..() if(isnull(charge)) - charge = maxcharge + charge = max_charge update_icon() if(self_recharge) START_PROCESSING(SSobj, src) @@ -45,19 +111,17 @@ STOP_PROCESSING(SSobj, src) return ..() +/obj/item/cell/get_worth(flags) + . = ..() + if(typegen_active) + . *= cell_datum?.typegen_worth_multiplier + /obj/item/cell/get_rating() return rating /obj/item/cell/get_cell(inducer) return src -/obj/item/cell/process(delta_time) - if(self_recharge) - if(world.time >= last_use + charge_delay) - give(charge_amount) - else - return PROCESS_KILL - /obj/item/cell/drain_energy(datum/actor, amount, flags) if(charge <= 0) return 0 @@ -66,57 +130,21 @@ /obj/item/cell/can_drain_energy(datum/actor, flags) return TRUE -#define OVERLAY_FULL 2 -#define OVERLAY_PARTIAL 1 -#define OVERLAY_EMPTY 0 - -/obj/item/cell/update_icon() - var/new_overlay = null // The overlay that is needed. - // If it's different than the current overlay, then it'll get changed. - // Otherwise nothing happens, to save on CPU. - - if(charge < 0.01) // Empty. - new_overlay = OVERLAY_EMPTY - if(last_overlay_state != new_overlay) - cut_overlays() - - else if(charge/maxcharge >= 0.995) // Full - new_overlay = OVERLAY_FULL - if(last_overlay_state != new_overlay) - cut_overlay(overlay_half_state) - add_overlay(overlay_full_state) - - - else // Inbetween. - new_overlay = OVERLAY_PARTIAL - if(last_overlay_state != new_overlay) - cut_overlay(overlay_full_state) - add_overlay(overlay_half_state) - - last_overlay_state = new_overlay - -#undef OVERLAY_FULL -#undef OVERLAY_PARTIAL -#undef OVERLAY_EMPTY - -/obj/item/cell/proc/percent() // return % charge of cell - if(!maxcharge) - return 0 - return 100.0*charge/maxcharge - /obj/item/cell/proc/fully_charged() - return (charge == maxcharge) + return (charge == max_charge) // checks if the power cell is able to provide the specified amount of charge /obj/item/cell/proc/check_charge(var/amount) + #warn cell datum return (charge >= amount) // Returns how much charge is missing from the cell, useful to make sure not overdraw from the grid when recharging. /obj/item/cell/proc/amount_missing() - return max(maxcharge - charge, 0) + return max(max_charge - charge, 0) // use power from a cell, returns the amount actually used /obj/item/cell/proc/use(var/amount) + #warn cell datum if(rigged && amount > 0) explode() return 0 @@ -134,41 +162,27 @@ use(amount) return 1 -/** - * use x cell units, affected by GLOB.cellefficiency - */ -/obj/item/cell/proc/use_scaled(amount) - return use(amount / GLOB.cellefficiency) * GLOB.cellefficiency - -/** - * uses x cell units but only if we have enough, affected by GLOB.cellefficiency - * - * returns TRUE/FALSE - */ -/obj/item/cell/proc/checked_use_scaled(amount) - return checked_use(amount / GLOB.cellefficiency) - // recharge the cell /obj/item/cell/proc/give(var/amount) + #warn cell datum if(rigged && amount > 0) explode() return FALSE - var/amount_used = min(maxcharge-charge,amount) + var/amount_used = min(max_charge-charge,amount) charge += amount_used update_icon() if(loc) loc.update_icon() return amount_used - /obj/item/cell/examine(mob/user, dist) . = ..() if(get_dist(src, user) <= 1) - . += " It has a power rating of [maxcharge].\nThe charge meter reads [round(src.percent() )]%." - if(maxcharge < 30000) - . += "[desc]\nThe manufacturer's label states this cell has a power rating of [maxcharge], and that you should not swallow it.\nThe charge meter reads [round(src.percent() )]%." + . += " It has a power rating of [max_charge].\nThe charge meter reads [round(src.percent() )]%." + if(max_charge < 30000) + . += "[desc]\nThe manufacturer's label states this cell has a power rating of [max_charge], and that you should not swallow it.\nThe charge meter reads [round(src.percent() )]%." else - . += "This power cell has an exciting chrome finish, as it is an uber-capacity cell type! It has a power rating of [maxcharge]!\nThe charge meter reads [round(src.percent() )]%." + . += "This power cell has an exciting chrome finish, as it is an uber-capacity cell type! It has a power rating of [max_charge]!\nThe charge meter reads [round(src.percent() )]%." /obj/item/cell/attackby(obj/item/W, mob/user) ..() @@ -215,7 +229,7 @@ /obj/item/cell/proc/corrupt() charge /= 2 - maxcharge /= 2 + max_charge /= 2 if (prob(10)) rigged = 1 //broken batteries are dangerous @@ -235,7 +249,6 @@ update_icon() /obj/item/cell/legacy_ex_act(severity) - switch(severity) if(1.0) qdel(src) @@ -252,7 +265,6 @@ return if (prob(25)) corrupt() - return /obj/item/cell/proc/get_electrocute_damage() //1kW = 5 @@ -270,7 +282,51 @@ else return 0 -/obj/item/cell/suicide_act(mob/user) - var/datum/gender/TU = GLOB.gender_datums[user.get_visible_gender()] - user.visible_message("\The [user] is licking the electrodes of \the [src]! It looks like [TU.he] [TU.is] trying to commit suicide.") - return (FIRELOSS) +//* Calculations *// + +/** + * Returns percent remaining, [0, 100] + */ +/obj/item/cell/proc/percent() + return max_charge ? (100 * charge / max_charge) : 0 + +/** + * Returns ratio remaining, [0, 1] + */ +/obj/item/cell/proc/ratio() + return max_charge ? (charge / max_charge) : 0 + +//* Processing *// + +/obj/item/cell/process(delta_time) + if(!self_recharge) + return PROCESS_KILL + if(world.time < last_use + self_recharge_delay) + return + give(self_recharge_amount * delta_time) + +//* Rendering *// + +/obj/item/cell/update_icon() + if(rendering_system) + cut_overlays() + + if(stripe_color) + var/image/stripe = image(icon, "cell-stripe") + stripe.color = stripe_color + add_overlay(stripe) + + if(indicator_count) + var/image/indicator = image(icon, "cell-[charge <= 1? "empty" : "[ceil(charge / max_charge * 5)]"]") + indicator.color = indicator_color + add_overlay(indicator) + else + //! LEGACY CODE !// + cut_overlays() + if(charge < 0.01) // Empty. + else if(charge/max_charge >= 0.995) // Full + add_overlay(overlay_full_state) + else // Inbetween. + add_overlay(overlay_half_state) + //! END !// + return ..() diff --git a/code/modules/power/cells/power_cells.dm b/code/modules/power/cells/cells_legacy.dm similarity index 58% rename from code/modules/power/cells/power_cells.dm rename to code/modules/power/cells/cells_legacy.dm index 820512bf6547..b43829554150 100644 --- a/code/modules/power/cells/power_cells.dm +++ b/code/modules/power/cells/cells_legacy.dm @@ -1,75 +1,3 @@ -/obj/item/cell/crap - name = "\improper rechargable AA battery" - desc = "You can't top the plasma top." //TOTALLY TRADEMARK INFRINGEMENT - origin_tech = list(TECH_POWER = 0) - maxcharge = 500 - materials_base = list(MAT_STEEL = 700, MAT_GLASS = 40) - -/obj/item/cell/crap/empty - charge = 0 - -/obj/item/cell/secborg - name = "security borg rechargable D battery" - origin_tech = list(TECH_POWER = 0) - maxcharge = 600 //600 max charge / 100 charge per shot = six shots - materials_base = list(MAT_STEEL = 700, MAT_GLASS = 40) - -/obj/item/cell/secborg/empty - charge = 0 - -/obj/item/cell/apc - name = "heavy-duty power cell" - origin_tech = list(TECH_POWER = 1) - maxcharge = 5000 - materials_base = list(MAT_STEEL = 700, MAT_GLASS = 50) - -/obj/item/cell/high - name = "high-capacity power cell" - origin_tech = list(TECH_POWER = 2) - icon_state = "hcell" - maxcharge = 10000 - materials_base = list(MAT_STEEL = 700, MAT_GLASS = 60) - rating = 2 - -/obj/item/cell/high/empty - charge = 0 - -/obj/item/cell/super - name = "super-capacity power cell" - origin_tech = list(TECH_POWER = 5) - icon_state = "scell" - maxcharge = 20000 - materials_base = list(MAT_STEEL = 700, MAT_GLASS = 70) - rating = 3 - -/obj/item/cell/super/empty - charge = 0 - -/obj/item/cell/hyper - name = "hyper-capacity power cell" - origin_tech = list(TECH_POWER = 6) - icon_state = "hpcell" - maxcharge = 30000 - materials_base = list(MAT_STEEL = 700, MAT_GLASS = 80) - rating = 4 - -/obj/item/cell/hyper/empty - charge = 0 - -/obj/item/cell/infinite - name = "infinite-capacity power cell!" - icon_state = "icell" - origin_tech = null - maxcharge = 30000 //determines how badly mobs get shocked - materials_base = list(MAT_STEEL = 700, MAT_GLASS = 80) - rating = 6 - -/obj/item/cell/infinite/check_charge() - return 1 - -/obj/item/cell/infinite/use() - return 1 - /obj/item/cell/potato name = "potato battery" desc = "A rechargable starch based power cell." @@ -77,7 +5,7 @@ icon = 'icons/obj/power.dmi' //'icons/obj/harvest.dmi' icon_state = "potato_cell" //"potato_battery" charge = 100 - maxcharge = 300 + max_charge = 300 minor_fault = 1 /obj/item/cell/slime @@ -87,12 +15,13 @@ icon = 'icons/mob/slimes.dmi' //'icons/obj/harvest.dmi' icon_state = "yellow slime extract" //"potato_battery" description_info = "This 'cell' holds a max charge of 10k and self recharges over time." - maxcharge = 10000 + max_charge = 10000 materials_base = null rating = 5 self_recharge = TRUE charge_amount = 750 +// todo: this isn't even a fucking cell get it out of here //Not actually a cell, but if people look for it, they'll probably look near other cells /obj/item/fbp_backup_cell name = "backup battery" @@ -136,7 +65,7 @@ /obj/item/cell/emergency_light name = "miniature power cell" desc = "A tiny power cell with a very low power capacity. Used in light fixtures to power them in the event of an outage." - maxcharge = 120 //Emergency lights use 0.2 W per tick, meaning ~10 minutes of emergency power from a cell + max_charge = 120 //Emergency lights use 0.2 W per tick, meaning ~10 minutes of emergency power from a cell materials_base = list(MAT_GLASS = 20) w_class = WEIGHT_CLASS_TINY diff --git a/code/modules/power/cells/datums/basic.dm b/code/modules/power/cells/datums/basic.dm new file mode 100644 index 000000000000..a6cde5e772ac --- /dev/null +++ b/code/modules/power/cells/datums/basic.dm @@ -0,0 +1,52 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/datum/power_cell/basic + abstract_type = /datum/power_cell/basic + functional = FALSE + +POWER_CELL_GENERATE_TYPES(/datum/power_cell/basic/tier_1, /basic/tier_1, "basic-t1") +/datum/power_cell/basic/tier_1 + cell_name = "basic" + cell_desc = "Tier 1: This one is a standard design, and performs about what you expect for a power cell." + typegen_capacity_multiplier = /datum/power_cell/basic::typegen_capacity_multiplier * 1.0 + +POWER_CELL_GENERATE_TYPES(/datum/power_cell/basic/tier_2, /basic/tier_2, "basic-t2") +/datum/power_cell/basic/tier_2 + cell_name = "upgraded" + cell_desc = "Tier 2: This one utilizes more advanced materials in its electrolytes, allowing it to store a sizeable chunk more power than a basic cell." + typegen_capacity_multiplier = /datum/power_cell/basic::typegen_capacity_multiplier * 1.2 + +POWER_CELL_GENERATE_TYPES(/datum/power_cell/basic/tier_3, /basic/tier_3, "basic-t3") +/datum/power_cell/basic/tier_3 + cell_name = "advanced" + cell_desc = "Tier 3: This one is even more overtuned than an upgraded cell, utilizing novel crystalline lattices to improve energy densities." + typegen_capacity_multiplier = /datum/power_cell/basic::typegen_capacity_multiplier * 1.4 + +#warn new way + +// POWER_CELL_GENERATE_TYPES(/obj/item/cell/basic) +// /obj/item/cell/basic +// materials_base = list( +// /datum/material/steel::id = 200, +// /datum/material/glass::id = 75, +// ) + +// /obj/item/cell/basic/tier_2 +// materials_base = list( +// /datum/material/steel::id = 250, +// /datum/material/glass::id = 125, +// /datum/material/copper::id = 50, +// /datum/material/gold::id = 75, +// /datum/material/silver::id = 75, +// ) + +// /obj/item/cell/basic/tier_3 +// materials_base = list( +// /datum/material/steel::id = 175, +// /datum/material/glass::id = 100, +// /datum/material/copper::id = 100, +// /datum/material/gold::id = 100, +// /datum/material/silver::id = 100, +// /datum/material/diamond::id = 50, +// ) diff --git a/code/modules/power/cells/datums/infinite.dm b/code/modules/power/cells/datums/infinite.dm new file mode 100644 index 000000000000..afbeea40a717 --- /dev/null +++ b/code/modules/power/cells/datums/infinite.dm @@ -0,0 +1,21 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +POWER_CELL_GENERATE_TYPES(/datum/power_cell/infinite, /infinite) +/datum/power_cell/infinite + cell_name = "fractal" + cell_desc = "This one is unlike anything you've seen before, boasting a seemingly limitless energy output." + + typegen_visual_stripe_color = "#ffff00" + typegen_worth_multiplier = null + + functional = TRUE + +/datum/power_cell/infinite/use(obj/item/cell/cell, amount) + return amount + +/datum/power_cell/infinite/check(obj/item/cell/cell, amount) + return TRUE + +/datum/power_cell/infinite/give(obj/item/cell/cell, amount) + return 0 diff --git a/code/modules/power/cells/datums/microfission.dm b/code/modules/power/cells/datums/microfission.dm new file mode 100644 index 000000000000..c49b77154ae4 --- /dev/null +++ b/code/modules/power/cells/datums/microfission.dm @@ -0,0 +1,66 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +POWER_CELL_GENERATE_TYPES(/datum/power_cell/microfission, /microfission) +/datum/power_cell/microfission + functional = TRUE + + cell_name = "microfission" + cell_desc = "This one contains highly enriched nuclear material, which is constantly used to recharge the cell with an induced process." + + typegen_visual_stripe_color = "#007700" + typegen_capacity_multiplier = 1 / 4 // we're, however, very small, because this is mostly just a nuclear accident in a can. + +#warn new way + + +/** + * COBALT-60: DROP AND RUN + */ +/obj/item/cell/microfission + + can_be_recharged = FALSE + + /// are we leaking? + var/leaking = FALSE + /// catastrophic failure: force reaction rate to maximum + var/leaking_catastrophically = FALSE + /// radiation power at minimum charge rate (or when not charging) + var/leaking_noncharge_strength = RAD_POWER_CELL_MICROFISSION_LEAK_MINIMUIM + /// radiation power at maximum charge rate + var/leaking_noncharge_strength = RAD_POWER_CELL_MICROFISSION_LEAK_MAXIMUM + /// radiation power falloff + var/leaking_falloff = RAD_FALLOFF_CELL_MICROFISSION + #warn sprite for leaking + #warn add_filter("rad_glow", 2, list("type" = "outline", "color" = "#14fff714", "size" = 2)) + + /// additional cell units able to be recharged + var/regen_left + /// original [regen_left] + var/regen_initial + /// if set, hard-sets additional cell units to be recharged; overrides [regen_as_multiplier] + var/regen_as_static + /// if set, sets cell units to be recharged to be a multiplier of our maxcharge + var/regen_as_multiplier = 35 * (1 / 4) // multiply back our 1/4'd capacity + /// if set, lose this much 'latent' charge per second; defaults to being set from [regen_loss_per_second_as_ratio] + var/regen_loss_per_second + /// if set, lose this much maximum charge per second as a ratio of [regen_left] + var/regen_loss_per_second_as_ratio = 1 / ((1 HOURS) / 10) // / 10 because the macros turn time into deciseconds. + /// minimum recharge per second + var/regen_min_per_second = STATIC_KW_TO_CELL_UNITS(2.5, 1) + /// maximum recharge per second + var/regen_max_per_second = STATIC_KW_TO_CELL_UNITS(25, 1) + /// at what % of [regen_initial] we start to have regen drop + var/regen_drop_start = 2 / 3 + /// at what % of [regen_initial] we fall to minimum regen + var/regen_drop_end = 1 / 10 + +/obj/item/cell/microfission/Initialize(mapload) + . = ..() + #warn calc regen + START_PROCESSING(SSobj, start) + +/obj/item/cell/microfission/process(delta_time) + ..() + #warn impl + #warn impl - leak diff --git a/code/modules/power/cells/datums/regen.dm b/code/modules/power/cells/datums/regen.dm new file mode 100644 index 000000000000..0e385a21ee95 --- /dev/null +++ b/code/modules/power/cells/datums/regen.dm @@ -0,0 +1,22 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +POWER_CELL_GENERATE_TYPES(/datum/power_cell/regen, /regen) +/datum/power_cell/regen + functional = TRUE + requires_processing = TRUE + + cell_name = "void" + cell_desc = "This one is unlike anything you've seen before, able to generate energy seemingly out of nowhere." + + typegen_visual_stripe_color = "#aa00aa" + +/datum/power_cell/regen/on_process(obj/item/cell/cell, dt) + + +#warn new way + +// POWER_CELL_GENERATE_TYPES(/obj/item/cell/regen) +/obj/item/cell/regen + + self_recharge = TRUE diff --git a/code/modules/power/cells/device_cells.dm b/code/modules/power/cells/device_cells.dm deleted file mode 100644 index 51c67e608999..000000000000 --- a/code/modules/power/cells/device_cells.dm +++ /dev/null @@ -1,77 +0,0 @@ -//currently only used by energy-type guns, that may change in the future. -/obj/item/cell/device - name = "device power cell" - desc = "A small power cell designed to power handheld devices." - icon_state = "dcell" - item_state = "egg6" - w_class = WEIGHT_CLASS_SMALL - damage_force = 0 - throw_speed = 5 - throw_range = 7 - maxcharge = 480 - charge_amount = 5 - materials_base = list("metal" = 350, MAT_GLASS = 50) - preserve_item = 1 - - worth_intrinsic = 25 - -/obj/item/cell/device/empty - charge = 0 - -/obj/item/cell/device/weapon - name = "weapon power cell" - desc = "A small power cell designed to power handheld weaponry." - icon_state = "wcell" - maxcharge = 2400 - charge_amount = 20 - - worth_intrinsic = 50 - -/obj/item/cell/device/weapon/empty - charge = 0 - -/obj/item/cell/device/weapon/empproof - emp_proof = TRUE - -/obj/item/cell/device/weapon/recharge - name = "self-charging weapon power cell" - desc = "A small power cell designed to power handheld weaponry. This one recharges itself." -// icon_state = "wcell" //TODO: Different sprite - self_recharge = TRUE - charge_amount = 120 - charge_delay = 75 - -/obj/item/cell/device/weapon/recharge/captain - charge_amount = 160 //Recharges a lot more quickly... - charge_delay = 100 //... but it takes a while to get started - -/obj/item/cell/device/weapon/recharge/sniper - charge_amount = 600 - charge_delay = 100 - -/datum/category_item/catalogue/anomalous/precursor_a/alien_void_cell - name = "Precursor Alpha Object - Void Cell" - desc = "This is a very enigmatic and small machine. It is able to output a direct electrical current \ - from itself to another device or machine that it is connected to. Its shape has a similar form as \ - a battery cell, which might imply that the species who created these had a desire for some form of \ - a modular power supply.\ -

\ - These appear to be limited in throughput, only able to put out so much energy at a time. It is unknown \ - if this was intentional, or was a design constraint that the creators of this object had to work around. \ - Regardless, it will likely function inside of various devices which run off of conventional power cells.\ -

\ - Scanning similar objects may yield more information." - value = CATALOGUER_REWARD_EASY - -/obj/item/cell/device/weapon/recharge/alien - name = "void cell" - desc = "An alien technology that produces energy seemingly out of nowhere. Its small, cylinderal shape means it might be able to be used with human technology, perhaps?" - catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_void_cell) - icon = 'icons/obj/abductor.dmi' - icon_state = "cell" - charge_amount = 120 // 5%. - charge_delay = 50 // Every five seconds, bit faster than the default. - origin_tech = list(TECH_POWER = 8, TECH_ENGINEERING = 6) - -/obj/item/cell/device/weapon/recharge/alien/update_icon() - return // No overlays please. diff --git a/code/modules/power/cells/power_cell.dm b/code/modules/power/cells/power_cell.dm new file mode 100644 index 000000000000..a978d302f912 --- /dev/null +++ b/code/modules/power/cells/power_cell.dm @@ -0,0 +1,111 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Encapsulates power cell behavior. + */ +/datum/power_cell + //* Descriptors *// + + /// our cell name + /// + /// * used for type generation + var/cell_name = "unknown" + /// our cell description append. + /// + /// * used for type generation + var/cell_desc = "Some unknown technology, probably. What is this?" + + //* Function *// + + /// are we an actual functional power cell datum, or just a template? + /// + /// * If set to FALSE, the power cell will not grab a datum instance of us, rather than just setting variables via us. + var/functional = FALSE + /// do we require processing? + /// + /// * requires [functional] + var/requires_processing = FALSE + #warn impl + + //* Capacity - Type Generation *// + + var/typegen_capacity_multiplier = 1 + /// compounded with [typegen_capacity_multiplier] + var/typegen_capacity_multiplier_small = 1 + /// compounded with [typegen_capacity_multiplier] + var/typegen_capacity_multiplier_medium = 1 + /// compounded with [typegen_capacity_multiplier] + var/typegen_capacity_multiplier_large = 1 + /// compounded with [typegen_capacity_multiplier] + var/typegen_capacity_multiplier_weapon = 1 + + //* Materials - Type Generation *// + + var/typegen_material_multiply = 1 + /// compounded with [typegen_material_multiply] + var/typegen_material_multiply_small = 1 + /// compounded with [typegen_material_multiply] + var/typegen_material_multiply_medium = 1 + /// compounded with [typegen_material_multiply] + var/typegen_material_multiply_large = 1 + /// compounded with [typegen_material_multiply] + var/typegen_material_multiply_weapon = 1 + + /// sets base materials; negative values are allowed + /// + /// * this is applied before typegen material multiply + var/list/typegen_materials_base + #warn impl + /// added to the base materials; negative values are allowed + /// + /// * this is applied after typegen material multiply + var/list/typegen_materials_base_adjust + #warn impl + + //* Visuals - Type Generation *// + + /// color of the cell's stripe + var/typegen_visual_stripe_color + /// color of the cell's indicator + var/typegen_visual_indicator_color + + //* Worth / Materials *// + + /// worth multiplier + /// + /// * set to null to say "we have no worth / are invaluable" (useful for infinite cells) + /// * null behaves like 0 right now but might not later + var/typegen_worth_multiplier = 1 + +/** + * Intercepts 'use' behavior + * + * @return amount that could used + */ +/datum/power_cell/proc/use(obj/item/cell/cell, amount) + return 0 + +/** + * Intercepts 'check' behavior + * + * @return if we have that amount + */ +/datum/power_cell/proc/check(obj/item/cell/cell, amount) + return FALSE + +/** + * Intercepts 'give' behavior + * + * @return amount consumed + */ +/datum/power_cell/proc/give(obj/item/cell/cell, amount) + return 0 + +/** + * Intercepts / requests processing. Only when `requires_processing` is enabled. + */ +/datum/power_cell/proc/on_process(obj/item/cell/cell, dt) + return + +#warn impl all diff --git a/code/modules/power/cells/types/large.dm b/code/modules/power/cells/types/large.dm new file mode 100644 index 000000000000..3fdac5dfaa95 --- /dev/null +++ b/code/modules/power/cells/types/large.dm @@ -0,0 +1,9 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/obj/item/cell/large + #warn sprite + worth_intrinsic = 75 + max_charge = POWER_CELL_CAPACITY_BASE * POWER_CELL_CAPACITY_MULTIPLIER_LARGE + rendering_system = TRUE + indicator_count = 4 diff --git a/code/modules/power/cells/types/medium.dm b/code/modules/power/cells/types/medium.dm new file mode 100644 index 000000000000..bea8a8827d4e --- /dev/null +++ b/code/modules/power/cells/types/medium.dm @@ -0,0 +1,9 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/obj/item/cell/medium + #warn sprite + worth_intrinsic = 40 + max_charge = POWER_CELL_CAPACITY_BASE * POWER_CELL_CAPACITY_MULTIPLIER_MEDIUM + rendering_system = TRUE + indicator_count = 4 diff --git a/code/modules/power/cells/types/small.dm b/code/modules/power/cells/types/small.dm new file mode 100644 index 000000000000..d1ecf58001bd --- /dev/null +++ b/code/modules/power/cells/types/small.dm @@ -0,0 +1,9 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/obj/item/cell/small + #warn sprite + worth_intrinsic = 10 + max_charge = POWER_CELL_CAPACITY_BASE * POWER_CELL_CAPACITY_MULTIPLIER_SMALL + rendering_system = TRUE + indicator_count = 4 diff --git a/code/modules/power/cells/types/weapon.dm b/code/modules/power/cells/types/weapon.dm new file mode 100644 index 000000000000..038a48bc9d66 --- /dev/null +++ b/code/modules/power/cells/types/weapon.dm @@ -0,0 +1,9 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/obj/item/cell/weapon + #warn sprite + worth_intrinsic = 30 + max_charge = POWER_CELL_CAPACITY_BASE * POWER_CELL_CAPACITY_MULTIPLIER_WEAPON + rendering_system = TRUE + indicator_count = 4 diff --git a/code/modules/power/lighting/lighting.dm b/code/modules/power/lighting/lighting.dm index 26577eea4278..7fd72841b7c3 100644 --- a/code/modules/power/lighting/lighting.dm +++ b/code/modules/power/lighting/lighting.dm @@ -662,7 +662,7 @@ var/global/list/light_type_cache = list() if(LIGHT_BROKEN) . += "[desc] The [fitting] has been smashed." if(cell) - to_chat(user, "Its backup power charge meter reads [round((cell.charge / cell.maxcharge) * 100, 0.1)]%.") + to_chat(user, "Its backup power charge meter reads [round((cell.charge / cell.max_charge) * 100, 0.1)]%.") /obj/machinery/light/proc/get_fitting_name() var/obj/item/light/L = light_type @@ -831,7 +831,7 @@ var/global/list/light_type_cache = list() status = LIGHT_BURNED return FALSE cell.use(pwr) - set_light(brightness_range * bulb_emergency_brightness_mul, max(bulb_emergency_pow_min, bulb_emergency_pow_mul * (cell.charge / cell.maxcharge)), bulb_emergency_colour) + set_light(brightness_range * bulb_emergency_brightness_mul, max(bulb_emergency_pow_min, bulb_emergency_pow_mul * (cell.charge / cell.max_charge)), bulb_emergency_colour) return TRUE @@ -986,9 +986,9 @@ var/global/list/light_type_cache = list() if(has_power()) emergency_mode = FALSE update(FALSE) - if(cell.charge == cell.maxcharge) + if(cell.charge == cell.max_charge) return PROCESS_KILL - cell.charge = min(cell.maxcharge, cell.charge + LIGHT_EMERGENCY_POWER_USE*2) //Recharge emergency power automatically while not using it + cell.charge = min(cell.max_charge, cell.charge + LIGHT_EMERGENCY_POWER_USE*2) //Recharge emergency power automatically while not using it if(emergency_mode && !use_emergency_power(LIGHT_EMERGENCY_POWER_USE)) update(FALSE) //Disables emergency mode and sets the color to normal diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index 89db582917b5..8209e8371f47 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -52,14 +52,14 @@ /obj/item/gun/energy/process(delta_time) if(self_recharge) //Every [recharge_time] ticks, recharge a shot for the battery if(world.time > last_shot + charge_delay) //Doesn't work if you've fired recently - if(!power_supply || power_supply.charge >= power_supply.maxcharge) + if(!power_supply || power_supply.charge >= power_supply.max_charge) return 0 // check if we actually need to recharge charge_tick++ if(charge_tick < recharge_time) return 0 charge_tick = 0 - var/rechargeamt = power_supply.maxcharge*0.2 + var/rechargeamt = power_supply.max_charge*0.2 if(use_external_power) var/obj/item/cell/external = get_external_power_supply() @@ -250,4 +250,4 @@ /obj/item/gun/energy/get_ammo_ratio() if(!power_supply) return 0 - return power_supply.charge / power_supply.maxcharge + return power_supply.charge / power_supply.max_charge diff --git a/code/modules/projectiles/guns/energy/modular/gunframes.dm b/code/modules/projectiles/guns/energy/modular/gunframes.dm index 8fb9c34a61f8..b260b0dde0b5 100644 --- a/code/modules/projectiles/guns/energy/modular/gunframes.dm +++ b/code/modules/projectiles/guns/energy/modular/gunframes.dm @@ -71,7 +71,7 @@ /obj/item/cell/device/weapon/modcannon charge = 4800 - maxcharge = 4800 + max_charge = 4800 /obj/item/gun/energy/modular/nuke name = "advanced modular energy gun" diff --git a/code/modules/projectiles/guns/energy/netgun_vr.dm b/code/modules/projectiles/guns/energy/netgun_vr.dm index f87e7ceeb060..cb949946544f 100644 --- a/code/modules/projectiles/guns/energy/netgun_vr.dm +++ b/code/modules/projectiles/guns/energy/netgun_vr.dm @@ -22,7 +22,7 @@ var/list/overlays_to_add = list() if(power_supply) - var/ratio = power_supply.charge / power_supply.maxcharge + var/ratio = power_supply.charge / power_supply.max_charge if(power_supply.charge < charge_cost) ratio = 0 diff --git a/code/modules/projectiles/guns/energy/particle.dm b/code/modules/projectiles/guns/energy/particle.dm index 1a230c11a3d5..2bb62425e3ca 100644 --- a/code/modules/projectiles/guns/energy/particle.dm +++ b/code/modules/projectiles/guns/energy/particle.dm @@ -112,7 +112,7 @@ sparks.set_up(2, 1, T) sparks.start() power_supply.charge = 0 - power_supply.maxcharge = 1 //just to avoid div/0 runtimes + power_supply.max_charge = 1 //just to avoid div/0 runtimes power_supply.desc += " It seems to be burnt out!" desc += " The casing is covered in scorch-marks." fire_delay += fire_delay // even if you swap out the cell for a good one, the gun's cluckety-clucked. diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm index 14aa3f933823..1dd0a31f4d29 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -455,7 +455,7 @@ projectile_type = /obj/projectile/bullet/cyanideround/jezzail fire_delay = 20 charge_cost = 600 - cell_type = /obj/item/cell/device/weapon + cell_type = /obj/item/cell/weapon/basic/tier_1 battery_lock = 1 slot_flags = SLOT_BACK w_class = WEIGHT_CLASS_BULKY diff --git a/code/modules/projectiles/guns/legacy_vr_guns/gunsword.dm b/code/modules/projectiles/guns/legacy_vr_guns/gunsword.dm index b83837bc0de2..7b743a6bb534 100644 --- a/code/modules/projectiles/guns/legacy_vr_guns/gunsword.dm +++ b/code/modules/projectiles/guns/legacy_vr_guns/gunsword.dm @@ -35,22 +35,23 @@ icon_state = "gsaberoff" icon_override = 'icons/vore/custom_guns_vr.dmi' item_state = "gsaberoff" - maxcharge = 2400 - charge_amount = 20 + atom_flags = NOBLOODY + max_charge = 2400 + self_recharge_amount = 20 damage_force = 3 throw_force = 5 throw_speed = 1 throw_range = 5 w_class = WEIGHT_CLASS_SMALL origin_tech = list(TECH_MAGNET = 3, TECH_COMBAT = 5) + damage_mode = NONE + armor_penetration = 50 var/active = 0 var/active_force = 30 var/active_throwforce = 20 var/active_w_class = WEIGHT_CLASS_BULKY var/active_embed_chance = 0 //In the off chance one of these is supposed to embed, you can just tweak this var - armor_penetration = 50 - atom_flags = NOBLOODY var/lrange = 2 var/lpower = 2 var/lcolor = "#800080" diff --git a/code/modules/projectiles/guns/legacy_vr_guns/protector.dm b/code/modules/projectiles/guns/legacy_vr_guns/protector.dm index ac559ad91380..877e8372e145 100644 --- a/code/modules/projectiles/guns/legacy_vr_guns/protector.dm +++ b/code/modules/projectiles/guns/legacy_vr_guns/protector.dm @@ -73,7 +73,7 @@ itemState += "[modifystate]" */ if(power_supply) - ratio = CEILING(((power_supply.charge / power_supply.maxcharge) * charge_sections), 1) + ratio = CEILING(((power_supply.charge / power_supply.max_charge) * charge_sections), 1) if(power_supply.charge < charge_cost) overlays_to_add += "[icon_state]_empty" diff --git a/code/modules/projectiles/guns/magnetic/magnetic.dm b/code/modules/projectiles/guns/magnetic/magnetic.dm index 8dffab58d8e4..2839735386f0 100644 --- a/code/modules/projectiles/guns/magnetic/magnetic.dm +++ b/code/modules/projectiles/guns/magnetic/magnetic.dm @@ -76,7 +76,7 @@ show_ammo(user) if(cell) - . += "The installed [cell.name] has a charge level of [round((cell.charge/cell.maxcharge)*100)]%." + . += "The installed [cell.name] has a charge level of [round((cell.charge/cell.max_charge)*100)]%." if(capacitor) . += "The installed [capacitor.name] has a charge level of [round((capacitor.charge/capacitor.max_charge)*100)]%." diff --git a/code/modules/reagents/machinery/dispenser/dispenser.dm b/code/modules/reagents/machinery/dispenser/dispenser.dm index 7e001e134515..84445c9bceef 100644 --- a/code/modules/reagents/machinery/dispenser/dispenser.dm +++ b/code/modules/reagents/machinery/dispenser/dispenser.dm @@ -125,7 +125,7 @@ return if(!cell || !charging) return - var/wanted = max(0, DYNAMIC_CELL_UNITS_TO_KW(cell.maxcharge - cell.charge, delta_time)) + var/wanted = max(0, DYNAMIC_CELL_UNITS_TO_KW(cell.max_charge - cell.charge, delta_time)) if(!wanted) return // todo: this is shit, it doesn't update area power because our power code is primitive. @@ -198,7 +198,7 @@ .["amount_max"] = dispense_amount_max .["has_cell"] = !!cell .["cell_charge"] = cell?.charge - .["cell_capacity"] = cell?.maxcharge + .["cell_capacity"] = cell?.max_charge .["panel_open"] = panel_open .["has_beaker"] = !!inserted .["beaker"] = inserted?.reagents? list( diff --git a/code/modules/research/designs/power_cells.dm b/code/modules/research/designs/power_cells.dm index 159766d29402..a8c4c9c97d38 100644 --- a/code/modules/research/designs/power_cells.dm +++ b/code/modules/research/designs/power_cells.dm @@ -8,7 +8,7 @@ /datum/prototype/design/science/powercell/generate_desc(template_name, template_desc) if(build_path) var/obj/item/cell/C = build_path - return "Allows the construction of power cells that can hold [initial(C.maxcharge)] units of energy." + return "Allows the construction of power cells that can hold [initial(C.max_charge)] units of energy." return "ERROR" /datum/prototype/design/science/powercell/print(atom/where) @@ -17,6 +17,8 @@ C.update_icon() return C +#warn all the designs + /datum/prototype/design/science/powercell/basic design_name = "basic" lathe_type = LATHE_TYPE_PROTOLATHE | LATHE_TYPE_MECHA diff --git a/code/modules/shieldgen/handheld_defuser.dm b/code/modules/shieldgen/handheld_defuser.dm index 3235d95a9ed1..209fdefee3ef 100644 --- a/code/modules/shieldgen/handheld_defuser.dm +++ b/code/modules/shieldgen/handheld_defuser.dm @@ -31,11 +31,11 @@ for(var/direction in GLOB.cardinal) var/turf/simulated/shielded_tile = get_step(get_turf(src), direction) for(var/obj/effect/shield/S in shielded_tile) - if(istype(S) && !S.diffused_for && !S.disabled_for && cell.checked_use_scaled(CELL_COST_SHIELD_DIFFUSION)) + if(istype(S) && !S.diffused_for && !S.disabled_for && cell.checked_use(CELL_COST_SHIELD_DIFFUSION)) S.diffuse(20) // Legacy shield support for(var/obj/effect/energy_field/S in shielded_tile) - if(istype(S) && cell.checked_use_scaled(CELL_COST_SHIELD_DIFFUSION)) + if(istype(S) && cell.use(CELL_COST_SHIELD_DIFFUSION)) qdel(S) /obj/item/shield_diffuser/update_icon() diff --git a/code/modules/spells/aoe_turf/charge.dm b/code/modules/spells/aoe_turf/charge.dm index 98e3e585d312..8aae60658952 100644 --- a/code/modules/spells/aoe_turf/charge.dm +++ b/code/modules/spells/aoe_turf/charge.dm @@ -56,10 +56,10 @@ if(istype(target, /obj/item/cell/)) var/obj/item/cell/C = target if(prob(80)) - C.maxcharge -= 200 - if(C.maxcharge <= 1) //Div by 0 protection - C.maxcharge = 1 - C.charge = C.maxcharge + C.max_charge -= 200 + if(C.max_charge <= 1) //Div by 0 protection + C.max_charge = 1 + C.charge = C.max_charge charged_item = C if(!charged_item) diff --git a/code/modules/tgui/modules/ntos-only/configurator.dm b/code/modules/tgui/modules/ntos-only/configurator.dm index 8397c3bde8d9..9389a83eda19 100644 --- a/code/modules/tgui/modules/ntos-only/configurator.dm +++ b/code/modules/tgui/modules/ntos-only/configurator.dm @@ -17,11 +17,11 @@ data["power_usage"] = movable.last_power_usage data["battery_exists"] = movable.battery_module ? 1 : 0 if(movable.battery_module) - data["battery_rating"] = movable.battery_module.battery.maxcharge + data["battery_rating"] = movable.battery_module.battery.max_charge data["battery_percent"] = round(movable.battery_module.battery.percent()) if(movable.battery_module && movable.battery_module.battery) - data["battery"] = list("max" = movable.battery_module.battery.maxcharge, "charge" = round(movable.battery_module.battery.charge)) + data["battery"] = list("max" = movable.battery_module.battery.max_charge, "charge" = round(movable.battery_module.battery.charge)) var/list/hardware = movable.get_all_components() var/list/all_entries[0] diff --git a/code/modules/vehicles/sealed/mecha/equipment/tools/energy_relay.dm b/code/modules/vehicles/sealed/mecha/equipment/tools/energy_relay.dm index 9e99c5c99db4..5cfc1f5069c0 100644 --- a/code/modules/vehicles/sealed/mecha/equipment/tools/energy_relay.dm +++ b/code/modules/vehicles/sealed/mecha/equipment/tools/energy_relay.dm @@ -100,7 +100,7 @@ ER.set_ready_state(1) ER.occupant_message("No powercell detected.") return - if(cur_charge 0) if(istype(mech)) mech.give_power(t) diff --git a/code/modules/vehicles/sealed/mecha/mecha.dm b/code/modules/vehicles/sealed/mecha/mecha.dm index 30a9c3ae6bd5..eb4fd2469f55 100644 --- a/code/modules/vehicles/sealed/mecha/mecha.dm +++ b/code/modules/vehicles/sealed/mecha/mecha.dm @@ -2549,7 +2549,7 @@ if(mecha.get_charge()) mecha.spark_system.start() mecha.cell.charge -= min(20,mecha.cell.charge) - mecha.cell.maxcharge -= min(20,mecha.cell.maxcharge) + mecha.cell.max_charge -= min(20,mecha.cell.max_charge) return @@ -2603,7 +2603,7 @@ /obj/vehicle/sealed/mecha/proc/update_cell_alerts() if(occupant_legacy && cell) - var/cellcharge = cell.charge/cell.maxcharge + var/cellcharge = cell.charge/cell.max_charge switch(cellcharge) if(0.75 to INFINITY) occupant_legacy.clear_alert("charge") diff --git a/code/modules/vehicles/sealed/mecha/subtypes/combat/fighter.dm b/code/modules/vehicles/sealed/mecha/subtypes/combat/fighter.dm index f1db8cc7d3f2..ba65b876eef0 100644 --- a/code/modules/vehicles/sealed/mecha/subtypes/combat/fighter.dm +++ b/code/modules/vehicles/sealed/mecha/subtypes/combat/fighter.dm @@ -59,7 +59,7 @@ return cell = new(src) cell.charge = 30000 - cell.maxcharge = 30000 + cell.max_charge = 30000 /obj/vehicle/sealed/mecha/combat/fighter/occupant_added(mob/adding, datum/event_args/actor/actor, control_flags, silent) . = ..() diff --git a/code/modules/vehicles/sealed/mecha/subtypes/combat/gygax.dm b/code/modules/vehicles/sealed/mecha/subtypes/combat/gygax.dm index 3a35579489a0..d10d3479f4c4 100644 --- a/code/modules/vehicles/sealed/mecha/subtypes/combat/gygax.dm +++ b/code/modules/vehicles/sealed/mecha/subtypes/combat/gygax.dm @@ -83,7 +83,7 @@ return cell = new(src) cell.charge = 30000 - cell.maxcharge = 30000 + cell.max_charge = 30000 /obj/vehicle/sealed/mecha/combat/gygax/serenity desc = "A lightweight exosuit made from a modified Gygax chassis combined with proprietary VeyMed medical tech. It's faster and sturdier than most medical mechs, but much of the armor plating has been stripped out, leaving it more vulnerable than a regular Gygax." diff --git a/code/modules/vehicles/sealed/mecha/subtypes/combat/honker.dm b/code/modules/vehicles/sealed/mecha/subtypes/combat/honker.dm index 61558aa81208..90cdba317f6b 100644 --- a/code/modules/vehicles/sealed/mecha/subtypes/combat/honker.dm +++ b/code/modules/vehicles/sealed/mecha/subtypes/combat/honker.dm @@ -71,4 +71,4 @@ return cell = new(src) cell.charge = 30000 - cell.maxcharge = 30000 + cell.max_charge = 30000 diff --git a/code/modules/vehicles/sealed/mecha/subtypes/combat/reticent.dm b/code/modules/vehicles/sealed/mecha/subtypes/combat/reticent.dm index 39159d2f60e2..38b08dbde94a 100644 --- a/code/modules/vehicles/sealed/mecha/subtypes/combat/reticent.dm +++ b/code/modules/vehicles/sealed/mecha/subtypes/combat/reticent.dm @@ -72,4 +72,4 @@ return cell = new(src) cell.charge = 30000 - cell.maxcharge = 30000 + cell.max_charge = 30000 diff --git a/code/modules/xenoarcheaology/finds/find_spawning.dm b/code/modules/xenoarcheaology/finds/find_spawning.dm index 1da2aa25e49e..8b4758a7264b 100644 --- a/code/modules/xenoarcheaology/finds/find_spawning.dm +++ b/code/modules/xenoarcheaology/finds/find_spawning.dm @@ -305,10 +305,10 @@ if(prob(5)) new_gun.power_supply.rigged = 1 if(prob(10)) - new_gun.power_supply.maxcharge = 0 + new_gun.power_supply.max_charge = 0 LAZYSET(new_gun.origin_tech, TECH_ARCANE, rand(0, 1)) if(prob(15)) - new_gun.power_supply.charge = rand(0, new_gun.power_supply.maxcharge) + new_gun.power_supply.charge = rand(0, new_gun.power_supply.max_charge) LAZYSET(new_gun.origin_tech, TECH_ARCANE, 1) else new_gun.power_supply.charge = 0 diff --git a/code/modules/xenoarcheaology/tools/suspension_generator.dm b/code/modules/xenoarcheaology/tools/suspension_generator.dm index 9d94bddb67ca..a255d6e5d7aa 100644 --- a/code/modules/xenoarcheaology/tools/suspension_generator.dm +++ b/code/modules/xenoarcheaology/tools/suspension_generator.dm @@ -60,7 +60,7 @@ data["cell"] = cell data["cellCharge"] = cell?.charge - data["cellMaxCharge"] = cell?.maxcharge + data["cellMaxCharge"] = cell?.max_charge data["locked"] = locked data["suspension_field"] = suspension_field diff --git a/icons/README.md b/icons/README.md index 29507811d3e8..98a227c6bf1a 100644 --- a/icons/README.md +++ b/icons/README.md @@ -33,7 +33,6 @@ Yes, this currently includes all turfs, mobs, objs, and misc things. Sorry. We'l used in the abstraction of limb sprite from limb definition. - /sprite_accessories - unconverted sprite accessories - /sprite_accessory - modern sprite accessory system - - /modules - used for specific departments / content packs / logical bundles - /{modulename} - the examples before are just that, examples. some modules will require different styles of icon organization. - /items - items diff --git a/icons/items/power/cells/large.dmi b/icons/items/power/cells/large.dmi new file mode 100644 index 000000000000..abc507282fc8 Binary files /dev/null and b/icons/items/power/cells/large.dmi differ diff --git a/icons/items/power/cells/medium.dmi b/icons/items/power/cells/medium.dmi new file mode 100644 index 000000000000..f691dfaa566a Binary files /dev/null and b/icons/items/power/cells/medium.dmi differ diff --git a/icons/items/power/cells/small.dmi b/icons/items/power/cells/small.dmi new file mode 100644 index 000000000000..f11aee7c8fb0 Binary files /dev/null and b/icons/items/power/cells/small.dmi differ diff --git a/icons/items/power/cells/weapon.dmi b/icons/items/power/cells/weapon.dmi new file mode 100644 index 000000000000..1f13ca54b6e0 Binary files /dev/null and b/icons/items/power/cells/weapon.dmi differ diff --git a/icons/obj/power.dmi b/icons/obj/power.dmi index 754b59629010..686a2a28431d 100644 Binary files a/icons/obj/power.dmi and b/icons/obj/power.dmi differ