mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 15:47:15 +01:00
Fixing cell power usage (Part 3) (#82204)
## About The Pull Request Continuation of #82198 Fixes these issues in #82196 - Borg hypo spray - Borg projectile dampen - Borg chameleon - Firelance - MODlink scryer - Emergency light usage ## Changelog 🆑 fix: Fixed more energy usages for cells(Part 3). See PR 82204 for details /🆑 --------- Co-authored-by: Pickle-Coding <58013024+Pickle-Coding@users.noreply.github.com>
This commit is contained in:
co-authored by
Pickle-Coding
parent
d3de4df4e5
commit
8aa93de044
@@ -1,5 +1,5 @@
|
||||
///How much power emergency lights will consume per tick
|
||||
#define LIGHT_EMERGENCY_POWER_USE 0.2
|
||||
#define LIGHT_EMERGENCY_POWER_USE (0.1 KILO WATTS)
|
||||
// status values shared between lighting fixtures and items
|
||||
#define LIGHT_OK 0
|
||||
#define LIGHT_EMPTY 1
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
*/
|
||||
var/max_volume_per_reagent = 30
|
||||
/// Cell cost for charging a reagent
|
||||
var/charge_cost = 50
|
||||
var/charge_cost = 50 KILO JOULES
|
||||
/// Counts up to the next time we charge
|
||||
var/charge_timer = 0
|
||||
/// Time it takes for shots to recharge (in seconds)
|
||||
@@ -308,7 +308,7 @@
|
||||
Also metabolizes potassium iodide for radiation poisoning, inacusiate for ear damage and morphine for offense."
|
||||
icon_state = "borghypo_s"
|
||||
tgui_theme = "syndicate"
|
||||
charge_cost = 20
|
||||
charge_cost = 20 KILO JOULES
|
||||
recharge_time = 2
|
||||
default_reagent_types = BASE_SYNDICATE_REAGENTS
|
||||
bypass_protection = TRUE
|
||||
@@ -321,7 +321,7 @@
|
||||
icon_state = "shaker"
|
||||
possible_transfer_amounts = list(5,10,20,1)
|
||||
// Lots of reagents all regenerating at once, so the charge cost is lower. They also regenerate faster.
|
||||
charge_cost = 20
|
||||
charge_cost = 20 KILO JOULES
|
||||
recharge_time = 3
|
||||
dispensed_temperature = WATER_MATTERSTATE_CHANGE_TEMP //Water stays wet, ice stays ice
|
||||
default_reagent_types = BASE_SERVICE_REAGENTS
|
||||
@@ -393,7 +393,7 @@
|
||||
icon_state = "flour"
|
||||
possible_transfer_amounts = list(5,10,20,1)
|
||||
// Lots of reagents all regenerating at once, so the charge cost is lower. They also regenerate faster.
|
||||
charge_cost = 40 //Costs double the power of the borgshaker due to synthesizing solids
|
||||
charge_cost = 40 KILO JOULES //Costs double the power of the borgshaker due to synthesizing solids
|
||||
recharge_time = 6 //Double the recharge time too, for the same reason.
|
||||
dispensed_temperature = WATER_MATTERSTATE_CHANGE_TEMP
|
||||
default_reagent_types = EXPANDED_SERVICE_REAGENTS
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#define PKBORG_DAMPEN_CYCLE_DELAY (2 SECONDS)
|
||||
#define POWER_RECHARGE_CYBORG_DRAIN_MULTIPLIER (0.4 KILO WATTS)
|
||||
|
||||
/obj/item/cautery/prt //it's a subtype of cauteries so that it inherits the cautery sprites and behavior and stuff, because I'm too lazy to make sprites for this thing
|
||||
name = "plating repair tool"
|
||||
@@ -24,8 +25,6 @@
|
||||
var/energy = 1500
|
||||
/// Recharging rate in energy per second
|
||||
var/energy_recharge = 37.5
|
||||
/// Charge draining right
|
||||
var/energy_recharge_cyborg_drain_coefficient = 0.4
|
||||
/// Critical power level percentage
|
||||
var/cyborg_cell_critical_percentage = 0.05
|
||||
/// The owner of the dampener
|
||||
@@ -156,7 +155,7 @@
|
||||
energy = clamp(energy + energy_recharge * seconds_per_tick, 0, maxenergy)
|
||||
return
|
||||
if(host.cell && (host.cell.charge >= (host.cell.maxcharge * cyborg_cell_critical_percentage)) && (energy < maxenergy))
|
||||
host.cell.use(energy_recharge * seconds_per_tick * energy_recharge_cyborg_drain_coefficient)
|
||||
host.cell.use(energy_recharge * seconds_per_tick * POWER_RECHARGE_CYBORG_DRAIN_MULTIPLIER)
|
||||
energy += energy_recharge * seconds_per_tick
|
||||
|
||||
/obj/item/borg/projectile_dampen/proc/dampen_projectile(datum/source, obj/projectile/projectile)
|
||||
@@ -176,3 +175,4 @@
|
||||
projectile.cut_overlay(projectile_effect)
|
||||
|
||||
#undef PKBORG_DAMPEN_CYCLE_DELAY
|
||||
#undef POWER_RECHARGE_CYBORG_DRAIN_MULTIPLIER
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#define ACTIVATION_COST (300 KILO JOULES)
|
||||
#define ACTIVATION_UP_KEEP (25 KILO WATTS)
|
||||
|
||||
/obj/item/borg_chameleon
|
||||
name = "cyborg chameleon projector"
|
||||
icon = 'icons/obj/devices/syndie_gadget.dmi'
|
||||
@@ -11,8 +14,6 @@
|
||||
var/friendlyName
|
||||
var/savedName
|
||||
var/active = FALSE
|
||||
var/activationCost = 300
|
||||
var/activationUpkeep = 50
|
||||
var/disguise = "engineer"
|
||||
var/mob/listeningTo
|
||||
var/static/list/signalCache = list( // list here all signals that should break the camouflage
|
||||
@@ -44,13 +45,13 @@
|
||||
disrupt(user)
|
||||
|
||||
/obj/item/borg_chameleon/attack_self(mob/living/silicon/robot/user)
|
||||
if (user && user.cell && user.cell.charge > activationCost)
|
||||
if (user && user.cell && user.cell.charge > ACTIVATION_COST)
|
||||
if (isturf(user.loc))
|
||||
toggle(user)
|
||||
else
|
||||
to_chat(user, span_warning("You can't use [src] while inside something!"))
|
||||
else
|
||||
to_chat(user, span_warning("You need at least [activationCost] charge in your cell to use [src]!"))
|
||||
to_chat(user, span_warning("You need at least [display_energy(ACTIVATION_COST)] of charge in your cell to use [src]!"))
|
||||
|
||||
/obj/item/borg_chameleon/proc/toggle(mob/living/silicon/robot/user)
|
||||
if(active)
|
||||
@@ -65,7 +66,7 @@
|
||||
to_chat(user, span_notice("You activate \the [src]."))
|
||||
playsound(src, 'sound/effects/seedling_chargeup.ogg', 100, TRUE, -6)
|
||||
apply_wibbly_filters(user)
|
||||
if (do_after(user, 50, target=user) && user.cell.use(activationCost))
|
||||
if (do_after(user, 50, target=user) && user.cell.use(ACTIVATION_COST))
|
||||
playsound(src, 'sound/effects/bamf.ogg', 100, TRUE, -6)
|
||||
to_chat(user, span_notice("You are now disguised as the Nanotrasen engineering borg \"[friendlyName]\"."))
|
||||
activate(user)
|
||||
@@ -75,9 +76,9 @@
|
||||
remove_wibbly_filters(user)
|
||||
animation_playing = FALSE
|
||||
|
||||
/obj/item/borg_chameleon/process()
|
||||
/obj/item/borg_chameleon/process(seconds_per_tick)
|
||||
if (user)
|
||||
if (!user.cell || !user.cell.use(activationUpkeep))
|
||||
if (!user.cell || !user.cell.use(ACTIVATION_UP_KEEP * seconds_per_tick))
|
||||
disrupt(user)
|
||||
else
|
||||
return PROCESS_KILL
|
||||
@@ -119,3 +120,6 @@
|
||||
if(active)
|
||||
to_chat(user, span_danger("Your chameleon field deactivates."))
|
||||
deactivate(user)
|
||||
|
||||
#undef ACTIVATION_COST
|
||||
#undef ACTIVATION_UP_KEEP
|
||||
|
||||
@@ -152,7 +152,6 @@ GLOBAL_LIST_INIT(adventure_loot_generator_index,generate_generator_index())
|
||||
lefthand_file = 'icons/mob/inhands/items/firelance_lefthand.dmi'
|
||||
var/windup_time = 10 SECONDS
|
||||
var/melt_range = 3
|
||||
var/charge_per_use = 200
|
||||
var/obj/item/stock_parts/cell/cell
|
||||
|
||||
/obj/item/firelance/Initialize(mapload)
|
||||
@@ -176,7 +175,7 @@ GLOBAL_LIST_INIT(adventure_loot_generator_index,generate_generator_index())
|
||||
return
|
||||
if(LAZYACCESS(user.do_afters, "firelance"))
|
||||
return
|
||||
if(!cell.use(charge_per_use))
|
||||
if(!cell.use(200 KILO JOULES))
|
||||
to_chat(user,span_warning("[src] battery ran dry!"))
|
||||
return
|
||||
ADD_TRAIT(user, TRAIT_IMMOBILIZED, REF(src))
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
/obj/item/clothing/neck/link_scryer/process(seconds_per_tick)
|
||||
if(!mod_link.link_call)
|
||||
return
|
||||
cell.use(min(20 * seconds_per_tick, cell.charge))
|
||||
cell.use(20 KILO WATTS * seconds_per_tick, force = TRUE)
|
||||
|
||||
/obj/item/clothing/neck/link_scryer/attackby(obj/item/attacked_by, mob/user, params)
|
||||
. = ..()
|
||||
|
||||
@@ -292,11 +292,11 @@
|
||||
if(cell)
|
||||
if(cell.charge == cell.maxcharge && !reagents) //If the cell is done mooching station power, and reagents don't need processing, stop processing
|
||||
return PROCESS_KILL
|
||||
cell.charge = min(cell.maxcharge, cell.charge + LIGHT_EMERGENCY_POWER_USE) //Recharge emergency power automatically while not using it
|
||||
charge_cell(LIGHT_EMERGENCY_POWER_USE * seconds_per_tick, cell = cell) //Recharge emergency power automatically while not using it
|
||||
if(reagents) //with most reagents coming out at 300, and with most meaningful reactions coming at 370+, this rate gives a few seconds of time to place it in and get out of dodge regardless of input.
|
||||
reagents.adjust_thermal_energy(8 * reagents.total_volume * SPECIFIC_HEAT_DEFAULT * seconds_per_tick)
|
||||
reagents.handle_reactions()
|
||||
if(low_power_mode && !use_emergency_power(LIGHT_EMERGENCY_POWER_USE))
|
||||
if(low_power_mode && !use_emergency_power(LIGHT_EMERGENCY_POWER_USE * seconds_per_tick))
|
||||
update(FALSE) //Disables emergency mode and sets the color to normal
|
||||
|
||||
/obj/machinery/light/proc/burn_out()
|
||||
|
||||
Reference in New Issue
Block a user