From 1e705faa1973eacc9437444343e78c2dd99fcdde Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 9 Sep 2020 08:19:23 +0200 Subject: [PATCH] [MIRROR] Process procs now properly utilize deltatime when implementing rates, timers and probabilities (#709) * Process procs now properly utilize deltatime when implementing rates, timers and probabilities (#52981) * Process procs now properly use deltatime when implementing rates, timers and probabilities * Review fixes * Geiger counters cleanup Made hardsuit geiger code more similar to geiger counter code Geiger counters are more responsive now * Moved SS*_DT defines to subsystems.dm * Rebase fix * Redefined the SS*_DT defines to use the subsystem wait vars * Implemented suggested changes by @AnturK * Commented /datum/proc/process about the deltatime stuff * Send delta_time as a process parameter instead of the defines Also DTfied acid_processing * Dtfied new acid component * Process procs now properly utilize deltatime when implementing rates, timers and probabilities Co-authored-by: Donkie --- code/__DEFINES/acid.dm | 2 +- code/__DEFINES/atmospherics.dm | 6 +- code/__DEFINES/maths.dm | 12 ++++ code/__DEFINES/radiation.dm | 3 + code/__DEFINES/subsystems.dm | 6 ++ code/controllers/subsystem/air.dm | 24 ++++---- code/controllers/subsystem/dcs.dm | 1 + code/controllers/subsystem/events.dm | 2 +- code/controllers/subsystem/fire_burning.dm | 3 +- code/controllers/subsystem/machines.dm | 4 +- code/controllers/subsystem/mobs.dm | 4 +- code/controllers/subsystem/moods.dm | 1 + .../subsystem/processing/fastprocess.dm | 4 +- .../subsystem/processing/nanites.dm | 2 +- code/controllers/subsystem/processing/obj.dm | 2 +- .../subsystem/processing/processing.dm | 22 +++++-- .../subsystem/processing/quirks.dm | 4 +- code/controllers/subsystem/radiation.dm | 1 + code/controllers/subsystem/tgui.dm | 6 +- code/datums/components/acid.dm | 49 ++++++++------- code/datums/components/embedded.dm | 6 +- code/datums/components/mood.dm | 18 +++--- code/datums/components/nanites.dm | 4 +- code/datums/components/radioactive.dm | 4 +- code/datums/components/rot.dm | 4 +- code/datums/elements/earhealing.dm | 6 +- code/datums/radiation_wave.dm | 4 +- code/datums/traits/_quirk.dm | 4 +- code/datums/traits/good.dm | 18 +++--- code/datums/traits/negative.dm | 32 +++++----- .../game/gamemodes/clown_ops/clown_weapons.dm | 17 ++++-- code/game/machinery/bank_machine.dm | 9 +-- code/game/machinery/cell_charger.dm | 12 ++-- code/game/machinery/defibrillator_mount.dm | 6 +- code/game/machinery/electrolyzer.dm | 4 +- .../embedded_controller_base.dm | 4 +- code/game/machinery/fat_sucker.dm | 10 ++-- code/game/machinery/hypnochair.dm | 4 +- code/game/machinery/iv_drip.dm | 6 +- code/game/machinery/recharger.dm | 8 +-- code/game/machinery/rechargestation.dm | 8 +-- code/game/machinery/shieldgen.dm | 4 +- code/game/machinery/slotmachine.dm | 4 +- code/game/machinery/spaceheater.dm | 18 +++--- code/game/machinery/status_display.dm | 2 +- code/game/machinery/suit_storage_unit.dm | 8 +-- .../machinery/telecomms/telecomunications.dm | 6 +- code/game/machinery/washing_machine.dm | 6 +- code/game/objects/effects/anomalies.dm | 25 +++++--- code/game/objects/effects/spiders.dm | 6 +- code/game/objects/items/RSF.dm | 4 +- code/game/objects/items/candle.dm | 11 ++-- code/game/objects/items/chrono_eraser.dm | 16 ++--- code/game/objects/items/cigs_lighters.dm | 60 ++++++++++--------- code/game/objects/items/devices/flashlight.dm | 36 ++++++----- .../items/devices/forcefieldprojector.dm | 6 +- .../objects/items/devices/geiger_counter.dm | 36 +++++------ .../objects/items/devices/laserpointer.dm | 4 +- .../items/devices/reverse_bear_trap.dm | 6 +- .../objects/items/devices/traitordevices.dm | 6 +- code/game/objects/items/granters.dm | 2 +- code/game/objects/items/grenades/festive.dm | 9 +-- code/game/objects/items/his_grace.dm | 6 +- code/game/objects/items/mop.dm | 11 ++-- code/game/objects/items/robot/robot_items.dm | 29 +++++---- .../objects/items/robot/robot_upgrades.dm | 10 ++-- code/game/objects/items/storage/firstaid.dm | 14 ++--- code/game/objects/items/tanks/watertank.dm | 10 ++-- code/game/objects/items/tools/weldingtool.dm | 10 ++-- code/game/objects/structures/fireplace.dm | 4 +- .../objects/structures/petrified_statue.dm | 6 +- code/game/objects/structures/shower.dm | 2 +- code/game/objects/structures/watercloset.dm | 2 +- code/game/turfs/open/lava.dm | 12 ++-- code/modules/NTNet/relays.dm | 8 +-- .../abductor/equipment/abduction_gear.dm | 19 +++--- .../antagonists/blob/structures/core.dm | 4 +- .../changeling/powers/mutations.dm | 4 +- .../eldritch_cult/eldritch_antag.dm | 4 +- .../eldritch_cult/eldritch_magic.dm | 6 +- .../eldritch_cult/knowledge/rust_lore.dm | 9 +-- code/modules/assembly/proximity.dm | 6 +- code/modules/assembly/timer.dm | 10 ++-- .../components/binary_devices/volume_pump.dm | 6 +- .../components/trinary_devices/filter.dm | 4 +- .../components/unary_devices/cryo.dm | 19 +++--- .../unary_devices/outlet_injector.dm | 10 ++-- .../components/unary_devices/vent_scrubber.dm | 16 ++--- .../atmospherics/machinery/other/miner.dm | 11 ++-- .../machinery/pipes/heat_exchange/he_pipes.dm | 4 +- .../machinery/portable/canister.dm | 4 +- .../atmospherics/machinery/portable/pump.dm | 4 +- .../machinery/portable/scrubber.dm | 16 ++--- .../awaymissions/bluespaceartillery.dm | 8 +-- code/modules/awaymissions/capture_the_flag.dm | 13 ++-- .../awaymissions/mission_code/Academy.dm | 4 +- .../mission_code/stationCollision.dm | 4 +- .../cargo/blackmarket/blackmarket_telepad.dm | 10 ++-- code/modules/clothing/spacesuits/hardsuit.dm | 34 ++++++----- code/modules/events/spacevine.dm | 8 +-- code/modules/flufftext/Hallucination.dm | 4 +- .../food_and_drinks/food/snacks_other.dm | 14 ++--- .../kitchen_machinery/deep_fryer.dm | 22 ++++--- .../kitchen_machinery/grill.dm | 34 ++++++----- .../kitchen_machinery/smartfridge.dm | 6 +- code/modules/food_and_drinks/pizzabox.dm | 16 ++--- code/modules/holodeck/computer.dm | 6 +- code/modules/hydroponics/grown/chili.dm | 6 +- code/modules/hydroponics/grown/misc.dm | 4 +- code/modules/hydroponics/grown/towercap.dm | 20 +++---- code/modules/hydroponics/hydroponics.dm | 8 +-- .../modules/mining/equipment/explorer_gear.dm | 6 +- code/modules/mining/machine_processing.dm | 21 +++---- code/modules/mob/living/silicon/pai/pai.dm | 6 +- .../mob/living/silicon/robot/robot_modules.dm | 2 +- .../simple_animal/friendly/farm_animals.dm | 6 +- .../hostile/mining_mobs/elites/elite.dm | 4 +- .../simple_animal/hostile/netherworld.dm | 4 +- .../simple_animal/hostile/space_dragon.dm | 11 ++-- .../computers/item/computer.dm | 8 +-- .../computers/item/computer_power.dm | 4 +- .../computers/machinery/modular_computer.dm | 4 +- .../modular_computers/file_system/program.dm | 2 +- .../suit/n_suit_verbs/energy_net_nets.dm | 12 ++-- .../suit/n_suit_verbs/ninja_adrenaline.dm | 2 +- .../ninja/suit/n_suit_verbs/ninja_empulse.dm | 2 +- .../ninja/suit/n_suit_verbs/ninja_smoke.dm | 2 +- code/modules/ninja/suit/suit.dm | 18 +++--- code/modules/plumbing/plumbers/acclimator.dm | 6 +- code/modules/plumbing/plumbers/destroyer.dm | 8 +-- code/modules/plumbing/plumbers/pumps.dm | 12 ++-- code/modules/plumbing/plumbers/synthesizer.dm | 6 +- code/modules/power/cell.dm | 4 +- code/modules/power/singularity/collector.dm | 6 +- code/modules/power/singularity/emitter.dm | 4 +- code/modules/power/singularity/generator.dm | 4 +- .../guns/ballistic/laser_gatling.dm | 6 +- code/modules/projectiles/guns/energy.dm | 12 ++-- .../projectiles/guns/energy/energy_gun.dm | 6 +- code/modules/projectiles/guns/magic.dm | 14 ++--- .../chemistry/machinery/chem_dispenser.dm | 6 +- .../chemistry/machinery/chem_heater.dm | 6 +- .../reagents/reagent_containers/borghydro.dm | 12 ++-- .../reagents/reagent_containers/maunamug.dm | 6 +- code/modules/recycling/disposal/bin.dm | 4 +- .../xenobiology/crossbreeding/_weapons.dm | 8 +-- .../xenobiology/crossbreeding/recurring.dm | 20 +++---- code/modules/shuttle/emergency.dm | 4 +- code/modules/spells/spell.dm | 8 +-- code/modules/surgery/organs/organ_internal.dm | 8 +-- code/modules/tgui/tgui.dm | 2 +- code/modules/vehicles/atv.dm | 4 +- code/modules/vehicles/mecha/_mecha.dm | 18 +++--- .../mecha/equipment/tools/medical_tools.dm | 22 +++---- .../mecha/equipment/tools/other_tools.dm | 45 +++++++------- code/modules/vehicles/mecha/mech_bay.dm | 10 ++-- code/modules/vehicles/secway.dm | 4 +- code/modules/vending/_vending.dm | 10 ++-- code/modules/zombie/organs.dm | 6 +- 159 files changed, 808 insertions(+), 719 deletions(-) diff --git a/code/__DEFINES/acid.dm b/code/__DEFINES/acid.dm index 86199b67495..5f28ceebb5c 100644 --- a/code/__DEFINES/acid.dm +++ b/code/__DEFINES/acid.dm @@ -1,6 +1,6 @@ /// The acid power required to destroy most closed turfs. #define ACID_POWER_MELT_TURF 200 -/// The maximum amount of damage (per tick) acid can deal to an [/obj]. +/// The maximum amount of damage (per second) acid can deal to an [/obj]. #define OBJ_ACID_DAMAGE_MAX 300 /// Maximum acid volume that can be applied to an [/obj]. #define OBJ_ACID_VOLUME_MAX 300 diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm index 255df74d7f3..f6fceb58e0b 100644 --- a/code/__DEFINES/atmospherics.dm +++ b/code/__DEFINES/atmospherics.dm @@ -208,9 +208,9 @@ /// (kPa) What pressure pumps and powered equipment max out at. #define MAX_OUTPUT_PRESSURE 4500 /// (L/s) Maximum speed powered equipment can work at. -#define MAX_TRANSFER_RATE 200 -/// 10% of an overclocked volume pump leaks into the air -#define VOLUME_PUMP_LEAK_AMOUNT 0.1 +#define MAX_TRANSFER_RATE 400 +/// How many percent of the contents that an overclocked volume pumps leak into the air +#define VOLUME_PUMP_LEAK_AMOUNT 0.2 //used for device_type vars #define UNARY 1 #define BINARY 2 diff --git a/code/__DEFINES/maths.dm b/code/__DEFINES/maths.dm index 5fb5f41efa2..367e8436864 100644 --- a/code/__DEFINES/maths.dm +++ b/code/__DEFINES/maths.dm @@ -84,6 +84,11 @@ // Returns the nth root of x. #define ROOT(n, x) ((x) ** (1 / (n))) +/// Low-pass filter a value to smooth out high frequent peaks. This can be thought of as a moving average filter as well. +/// delta_time is how many seconds since we last ran this command. RC is the filter constant, high RC means more smoothing +/// See https://en.wikipedia.org/wiki/Low-pass_filter#Simple_infinite_impulse_response_filter for the maths +#define LPFILTER(memory, signal, delta_time, RC) (delta_time / (RC + delta_time)) * signal + (1 - delta_time / (RC + delta_time)) * memory + // The quadratic formula. Returns a list with the solutions, or an empty list // if they are imaginary. /proc/SolveQuadratic(a, b, c) @@ -206,4 +211,11 @@ #define LORENTZ_CUMULATIVE_DISTRIBUTION(x, y, s) ( (1/PI)*TORADIANS(arctan((x-y)/s)) + 1/2 ) #define RULE_OF_THREE(a, b, x) ((a*x)/b) + +/// Converts a probability/second chance to probability/delta_time chance +/// For example, if you want an event to happen with a 10% per second chance, but your proc only runs every 5 seconds, do `if(prob(100*DT_PROB_RATE(0.1, 5)))` +#define DT_PROB_RATE(prob_per_second, delta_time) (1 - (1 - prob_per_second) ** delta_time) + +/// Like DT_PROB_RATE but easier to use, simply put `if(DT_PROB(10, 5))` +#define DT_PROB(prob_per_second_percent, delta_time) (prob(100*DT_PROB_RATE(prob_per_second_percent/100, delta_time))) // ) diff --git a/code/__DEFINES/radiation.dm b/code/__DEFINES/radiation.dm index 2e734c1fb72..9c5003e9332 100644 --- a/code/__DEFINES/radiation.dm +++ b/code/__DEFINES/radiation.dm @@ -50,3 +50,6 @@ Ask ninjanomnom if they're around #define RAD_DISTANCE_COEFFICIENT 1 // Lower means further rad spread #define RAD_HALF_LIFE 90 // The half-life of contaminated objects + +#define RAD_GEIGER_RC 4 // RC-constant for the LP filter for geiger counters. See #define LPFILTER for more info. +#define RAD_GEIGER_GRACE_PERIOD 4 // How many seconds after we last detect a radiation pulse until we stop blipping diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index 76ff74dda84..46c7cb5e9ed 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -238,3 +238,9 @@ #define SSEXPLOSIONS_TURFS 2 #define SSEXPLOSIONS_THROWS 3 +// Subsystem delta times or tickrates, in seconds. I.e, how many seconds in between each process() call for objects being processed by that subsystem. +// Only use these defines if you want to access some other objects processing delta_time, otherwise use the delta_time that is sent as a parameter to process() +#define SSFLUIDS_DT (SSfluids.wait/10) +#define SSMACHINES_DT (SSmachines.wait/10) +#define SSMOBS_DT (SSmobs.wait/10) +#define SSOBJ_DT (SSobj.wait/10) diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm index a2744cb27be..afa20b55057 100644 --- a/code/controllers/subsystem/air.dm +++ b/code/controllers/subsystem/air.dm @@ -2,7 +2,7 @@ SUBSYSTEM_DEF(air) name = "Atmospherics" init_order = INIT_ORDER_AIR priority = FIRE_PRIORITY_AIR - wait = 5 + wait = 0.5 SECONDS flags = SS_BACKGROUND runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME @@ -39,6 +39,8 @@ SUBSYSTEM_DEF(air) var/list/queued_for_activation var/display_all_groups = FALSE + var/lasttick = 0 + /datum/controller/subsystem/air/stat_entry(msg) msg += "C:{" msg += "AT:[round(cost_turfs,1)]|" @@ -72,6 +74,7 @@ SUBSYSTEM_DEF(air) /datum/controller/subsystem/air/fire(resumed = FALSE) var/timer = TICK_USAGE_REAL + var/delta_time = wait * 0.1 if(currentpart == SSAIR_REBUILD_PIPENETS) var/list/pipenet_rebuilds = pipenets_needing_rebuilt @@ -86,7 +89,7 @@ SUBSYSTEM_DEF(air) currentpart = SSAIR_PIPENETS if(currentpart == SSAIR_PIPENETS || !resumed) - process_pipenets(resumed) + process_pipenets(delta_time, resumed) cost_pipenets = MC_AVERAGE(cost_pipenets, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) if(state != SS_RUNNING) return @@ -95,7 +98,7 @@ SUBSYSTEM_DEF(air) if(currentpart == SSAIR_ATMOSMACHINERY) timer = TICK_USAGE_REAL - process_atmos_machinery(resumed) + process_atmos_machinery(delta_time, resumed) cost_atmos_machinery = MC_AVERAGE(cost_atmos_machinery, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) if(state != SS_RUNNING) return @@ -131,7 +134,7 @@ SUBSYSTEM_DEF(air) if(currentpart == SSAIR_HOTSPOTS) timer = TICK_USAGE_REAL - process_hotspots(resumed) + process_hotspots(delta_time, resumed) cost_hotspots = MC_AVERAGE(cost_hotspots, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) if(state != SS_RUNNING) return @@ -150,7 +153,7 @@ SUBSYSTEM_DEF(air) SStgui.update_uis(SSair) //Lightning fast debugging motherfucker -/datum/controller/subsystem/air/proc/process_pipenets(resumed = FALSE) +/datum/controller/subsystem/air/proc/process_pipenets(delta_time, resumed = FALSE) if (!resumed) src.currentrun = networks.Copy() //cache for sanic speed (lists are references anyways) @@ -159,7 +162,7 @@ SUBSYSTEM_DEF(air) var/datum/thing = currentrun[currentrun.len] currentrun.len-- if(thing) - thing.process() + thing.process(delta_time) else networks.Remove(thing) if(MC_TICK_CHECK) @@ -169,8 +172,7 @@ SUBSYSTEM_DEF(air) if(istype(atmos_machine, /obj/machinery/atmospherics)) pipenets_needing_rebuilt += atmos_machine -/datum/controller/subsystem/air/proc/process_atmos_machinery(resumed = FALSE) - var/seconds = wait * 0.1 +/datum/controller/subsystem/air/proc/process_atmos_machinery(delta_time, resumed = FALSE) if (!resumed) src.currentrun = atmos_machinery.Copy() //cache for sanic speed (lists are references anyways) @@ -178,7 +180,7 @@ SUBSYSTEM_DEF(air) while(currentrun.len) var/obj/machinery/M = currentrun[currentrun.len] currentrun.len-- - if(!M || (M.process_atmos(seconds) == PROCESS_KILL)) + if(!M || (M.process_atmos(delta_time) == PROCESS_KILL)) atmos_machinery.Remove(M) if(MC_TICK_CHECK) return @@ -196,7 +198,7 @@ SUBSYSTEM_DEF(air) if(MC_TICK_CHECK) return -/datum/controller/subsystem/air/proc/process_hotspots(resumed = FALSE) +/datum/controller/subsystem/air/proc/process_hotspots(delta_time, resumed = FALSE) if (!resumed) src.currentrun = hotspots.Copy() //cache for sanic speed (lists are references anyways) @@ -205,7 +207,7 @@ SUBSYSTEM_DEF(air) var/obj/effect/hotspot/H = currentrun[currentrun.len] currentrun.len-- if (H) - H.process() + H.process(delta_time) else hotspots -= H if(MC_TICK_CHECK) diff --git a/code/controllers/subsystem/dcs.dm b/code/controllers/subsystem/dcs.dm index 8b068e5d675..104c3eef31d 100644 --- a/code/controllers/subsystem/dcs.dm +++ b/code/controllers/subsystem/dcs.dm @@ -1,6 +1,7 @@ PROCESSING_SUBSYSTEM_DEF(dcs) name = "Datum Component System" flags = SS_NO_INIT + wait = 1 SECONDS var/list/elements_by_type = list() diff --git a/code/controllers/subsystem/events.dm b/code/controllers/subsystem/events.dm index 43cce09c44d..167d9130206 100644 --- a/code/controllers/subsystem/events.dm +++ b/code/controllers/subsystem/events.dm @@ -37,7 +37,7 @@ SUBSYSTEM_DEF(events) var/datum/thing = currentrun[currentrun.len] currentrun.len-- if(thing) - thing.process() + thing.process(wait * 0.1) else running.Remove(thing) if (MC_TICK_CHECK) diff --git a/code/controllers/subsystem/fire_burning.dm b/code/controllers/subsystem/fire_burning.dm index f2ae4890c0a..a5e903221a8 100644 --- a/code/controllers/subsystem/fire_burning.dm +++ b/code/controllers/subsystem/fire_burning.dm @@ -18,6 +18,7 @@ SUBSYSTEM_DEF(fire_burning) //cache for sanic speed (lists are references anyways) var/list/currentrun = src.currentrun + var/delta_time = wait * 0.1 while(currentrun.len) var/obj/O = currentrun[currentrun.len] @@ -31,7 +32,7 @@ SUBSYSTEM_DEF(fire_burning) if(O.resistance_flags & ON_FIRE) //in case an object is extinguished while still in currentrun if(!(O.resistance_flags & FIRE_PROOF)) - O.take_damage(20, BURN, FIRE, 0) + O.take_damage(10 * delta_time, BURN, FIRE, 0) else O.extinguish() diff --git a/code/controllers/subsystem/machines.dm b/code/controllers/subsystem/machines.dm index 60bf8314db3..23190574d8e 100644 --- a/code/controllers/subsystem/machines.dm +++ b/code/controllers/subsystem/machines.dm @@ -2,6 +2,7 @@ SUBSYSTEM_DEF(machines) name = "Machines" init_order = INIT_ORDER_MACHINES flags = SS_KEEP_TIMING + wait = 2 SECONDS var/list/processing = list() var/list/currentrun = list() var/list/powernets = list() @@ -36,11 +37,10 @@ SUBSYSTEM_DEF(machines) //cache for sanic speed (lists are references anyways) var/list/currentrun = src.currentrun - var/seconds = wait * 0.1 while(currentrun.len) var/obj/machinery/thing = currentrun[currentrun.len] currentrun.len-- - if(!QDELETED(thing) && thing.process(seconds) != PROCESS_KILL) + if(!QDELETED(thing) && thing.process(wait * 0.1) != PROCESS_KILL) if(thing.use_power) thing.auto_use_power() //add back the power state else diff --git a/code/controllers/subsystem/mobs.dm b/code/controllers/subsystem/mobs.dm index 94140c0f8fe..29a0c82de85 100644 --- a/code/controllers/subsystem/mobs.dm +++ b/code/controllers/subsystem/mobs.dm @@ -3,6 +3,7 @@ SUBSYSTEM_DEF(mobs) priority = FIRE_PRIORITY_MOBS flags = SS_KEEP_TIMING | SS_NO_INIT runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME + wait = 2 SECONDS var/list/currentrun = list() var/static/list/clients_by_zlevel[][] @@ -25,7 +26,6 @@ SUBSYSTEM_DEF(mobs) dead_players_by_zlevel[dead_players_by_zlevel.len] = list() /datum/controller/subsystem/mobs/fire(resumed = FALSE) - var/seconds = wait * 0.1 if (!resumed) src.currentrun = GLOB.mob_living_list.Copy() @@ -36,7 +36,7 @@ SUBSYSTEM_DEF(mobs) var/mob/living/L = currentrun[currentrun.len] currentrun.len-- if(L) - L.Life(seconds, times_fired) + L.Life(times_fired) else GLOB.mob_living_list.Remove(L) if (MC_TICK_CHECK) diff --git a/code/controllers/subsystem/moods.dm b/code/controllers/subsystem/moods.dm index f6b6ffcb404..20111747bdb 100644 --- a/code/controllers/subsystem/moods.dm +++ b/code/controllers/subsystem/moods.dm @@ -2,3 +2,4 @@ PROCESSING_SUBSYSTEM_DEF(mood) name = "Mood" flags = SS_NO_INIT | SS_BACKGROUND priority = 20 + wait = 1 SECONDS diff --git a/code/controllers/subsystem/processing/fastprocess.dm b/code/controllers/subsystem/processing/fastprocess.dm index 9622e021469..1b30ca44c24 100644 --- a/code/controllers/subsystem/processing/fastprocess.dm +++ b/code/controllers/subsystem/processing/fastprocess.dm @@ -1,6 +1,4 @@ -//Fires five times every second. - PROCESSING_SUBSYSTEM_DEF(fastprocess) name = "Fast Processing" - wait = 2 + wait = 0.2 SECONDS stat_tag = "FP" diff --git a/code/controllers/subsystem/processing/nanites.dm b/code/controllers/subsystem/processing/nanites.dm index e138832b6b1..b8109a904af 100644 --- a/code/controllers/subsystem/processing/nanites.dm +++ b/code/controllers/subsystem/processing/nanites.dm @@ -1,7 +1,7 @@ PROCESSING_SUBSYSTEM_DEF(nanites) name = "Nanites" flags = SS_BACKGROUND|SS_POST_FIRE_TIMING|SS_NO_INIT - wait = 10 + wait = 1 SECONDS var/list/datum/nanite_cloud_backup/cloud_backups = list() var/list/mob/living/nanite_monitored_mobs = list() diff --git a/code/controllers/subsystem/processing/obj.dm b/code/controllers/subsystem/processing/obj.dm index 26021fb267a..3566e8a4dc2 100644 --- a/code/controllers/subsystem/processing/obj.dm +++ b/code/controllers/subsystem/processing/obj.dm @@ -2,4 +2,4 @@ PROCESSING_SUBSYSTEM_DEF(obj) name = "Objects" priority = FIRE_PRIORITY_OBJ flags = SS_NO_INIT - wait = 20 + wait = 2 SECONDS diff --git a/code/controllers/subsystem/processing/processing.dm b/code/controllers/subsystem/processing/processing.dm index f099c3afb2d..457cb4fbc77 100644 --- a/code/controllers/subsystem/processing/processing.dm +++ b/code/controllers/subsystem/processing/processing.dm @@ -1,10 +1,10 @@ -//Used to process objects. Fires once every second. +//Used to process objects. SUBSYSTEM_DEF(processing) name = "Processing" priority = FIRE_PRIORITY_PROCESS flags = SS_BACKGROUND|SS_POST_FIRE_TIMING|SS_NO_INIT - wait = 10 + wait = 1 SECONDS var/stat_tag = "P" //Used for logging var/list/processing = list() @@ -25,14 +25,26 @@ SUBSYSTEM_DEF(processing) current_run.len-- if(QDELETED(thing)) processing -= thing - else if(thing.process(wait) == PROCESS_KILL) + else if(thing.process(wait * 0.1) == PROCESS_KILL) // fully stop so that a future START_PROCESSING will work STOP_PROCESSING(src, thing) if (MC_TICK_CHECK) return -///This proc is called on a datum if it is being processed in a subsystem. If you override this do not call parent, as it will return PROCESS_KILL. This is done to prevent objects that dont override process() from staying in the processing list -/datum/proc/process() +/** + * This proc is called on a datum on every "cycle" if it is being processed by a subsystem. The time between each cycle is determined by the subsystem's "wait" setting. + * You can start and stop processing a datum using the START_PROCESSING and STOP_PROCESSING defines. + * + * Since the wait setting of a subsystem can be changed at any time, it is important that any rate-of-change that you implement in this proc is multiplied by the delta_time that is sent as a parameter, + * Additionally, any "prob" you use in this proc should instead use the DT_PROB define to make sure that the final probability per second stays the same even if the subsystem's wait is altered. + * Examples where this must be considered: + * - Implementing a cooldown timer, use `mytimer -= delta_time`, not `mytimer -= 1`. This way, `mytimer` will always have the unit of seconds + * - Damaging a mob, do `L.adjustFireLoss(20 * delta_time)`, not `L.adjustFireLoss(20)`. This way, the damage per second stays constant even if the wait of the subsystem is changed + * - Probability of something happening, do `if(DT_PROB(25, delta_time))`, not `if(prob(25))`. This way, if the subsystem wait is e.g. lowered, there won't be a higher chance of this event happening per second + * + * If you override this do not call parent, as it will return PROCESS_KILL. This is done to prevent objects that dont override process() from staying in the processing list + */ +/datum/proc/process(delta_time) set waitfor = FALSE return PROCESS_KILL diff --git a/code/controllers/subsystem/processing/quirks.dm b/code/controllers/subsystem/processing/quirks.dm index 2b7563c90c9..68ab39a28f7 100644 --- a/code/controllers/subsystem/processing/quirks.dm +++ b/code/controllers/subsystem/processing/quirks.dm @@ -6,15 +6,15 @@ PROCESSING_SUBSYSTEM_DEF(quirks) name = "Quirks" init_order = INIT_ORDER_QUIRKS flags = SS_BACKGROUND - wait = 10 runlevels = RUNLEVEL_GAME + wait = 1 SECONDS var/list/quirks = list() //Assoc. list of all roundstart quirk datum types; "name" = /path/ var/list/quirk_points = list() //Assoc. list of quirk names and their "point cost"; positive numbers are good traits, and negative ones are bad var/list/quirk_objects = list() //A list of all quirk objects in the game, since some may process var/list/quirk_blacklist = list() //A list of quirks that can not be used with each other. Format: list(quirk1,quirk2),list(quirk3,quirk4) ///An assoc list of quirks that can be obtained as a hardcore character, and their hardcore value. - var/list/hardcore_quirks = list() + var/list/hardcore_quirks = list() /datum/controller/subsystem/processing/quirks/Initialize(timeofday) if(!quirks.len) diff --git a/code/controllers/subsystem/radiation.dm b/code/controllers/subsystem/radiation.dm index 2f7d27aca99..2d764d84ddb 100644 --- a/code/controllers/subsystem/radiation.dm +++ b/code/controllers/subsystem/radiation.dm @@ -1,6 +1,7 @@ PROCESSING_SUBSYSTEM_DEF(radiation) name = "Radiation" flags = SS_NO_INIT | SS_BACKGROUND + wait = 1 SECONDS var/list/warned_atoms = list() diff --git a/code/controllers/subsystem/tgui.dm b/code/controllers/subsystem/tgui.dm index 511ab623da4..6075c9b6751 100644 --- a/code/controllers/subsystem/tgui.dm +++ b/code/controllers/subsystem/tgui.dm @@ -43,7 +43,7 @@ SUBSYSTEM_DEF(tgui) current_run.len-- // TODO: Move user/src_object check to process() if(ui && ui.user && ui.src_object) - ui.process() + ui.process(wait * 0.1) else open_uis.Remove(ui) if(MC_TICK_CHECK) @@ -192,7 +192,7 @@ SUBSYSTEM_DEF(tgui) for(var/datum/tgui/ui in open_uis_by_src[key]) // Check if UI is valid. if(ui && ui.src_object && ui.user && ui.src_object.ui_host(ui.user)) - ui.process(force = 1) + ui.process(wait * 0.1, force = 1) count++ return count @@ -251,7 +251,7 @@ SUBSYSTEM_DEF(tgui) return count for(var/datum/tgui/ui in user.tgui_open_uis) if(isnull(src_object) || ui.src_object == src_object) - ui.process(force = 1) + ui.process(wait * 0.1, force = 1) count++ return count diff --git a/code/datums/components/acid.dm b/code/datums/components/acid.dm index 80487255bd7..341d51527df 100644 --- a/code/datums/components/acid.dm +++ b/code/datums/components/acid.dm @@ -16,6 +16,8 @@ var/datum/looping_sound/acid/sizzle /// Used exclusively for melting turfs. TODO: Move integrity to the atom level so that this can be dealt with there. var/parent_integrity = 30 + /// How far the acid melting of turfs has progressed + var/stage = 0 /// The proc used to handle the parent [/atom] when processing. TODO: Unify damage and resistance flags so that this doesn't need to exist! var/datum/callback/process_effect @@ -94,25 +96,25 @@ /// Handles the slow corrosion of the parent [/atom]. -/datum/component/acid/process() - process_effect?.InvokeAsync() +/datum/component/acid/process(delta_time) + process_effect?.InvokeAsync(delta_time) if(QDELING(src)) //The process effect deals damage, and on turfs diminishes the acid volume, potentially destroying the component. Let's not destroy it twice. return - set_volume(acid_volume - (ACID_DECAY_BASE + (ACID_DECAY_SCALING*round(sqrt(acid_volume))))) + set_volume(acid_volume - (ACID_DECAY_BASE + (ACID_DECAY_SCALING*round(sqrt(acid_volume)))) * delta_time) /// Handles processing on a [/obj]. -/datum/component/acid/proc/process_obj(obj/target) +/datum/component/acid/proc/process_obj(obj/target, delta_time) if(target.resistance_flags & ACID_PROOF) return - target.take_damage(min(1 + round(sqrt(acid_power * acid_volume)*0.3), OBJ_ACID_DAMAGE_MAX), BURN, ACID, 0) + target.take_damage(min(1 + round(sqrt(acid_power * acid_volume)*0.3), OBJ_ACID_DAMAGE_MAX) * delta_time, BURN, ACID, 0) /// Handles processing on a [/mob/living]. -/datum/component/acid/proc/process_mob(mob/living/target) - target.acid_act(acid_power, acid_volume) +/datum/component/acid/proc/process_mob(mob/living/target, delta_time) + target.acid_act(acid_power, acid_volume * delta_time) /// Handles processing on a [/turf]. -/datum/component/acid/proc/process_turf(turf/target_turf) - var/acid_used = min(acid_volume * 0.05, 20) +/datum/component/acid/proc/process_turf(turf/target_turf, delta_time) + var/acid_used = min(acid_volume * 0.05, 20) * delta_time var/applied_targets = 0 for(var/am in target_turf) var/atom/movable/target_movable = am @@ -126,19 +128,22 @@ if(acid_power < ACID_POWER_MELT_TURF) return - switch(parent_integrity--) - if(-INFINITY to 0) - target_turf.visible_message("[target_turf] collapses under its own weight into a puddle of goop and undigested debris!") - target_turf.acid_melt() - if(0 to 4) - target_turf.visible_message("[target_turf] begins to crumble under the acid!") - if(4 to 8) - target_turf.visible_message("[target_turf] is struggling to withstand the acid!") - if(8 to 16) - target_turf.visible_message("[target_turf] is being melted by the acid!") - if(16 to 24) - target_turf.visible_message("[target_turf] is holding up against the acid!") - + parent_integrity -= delta_time + if(parent_integrity <= 0) + target_turf.visible_message("[target_turf] collapses under its own weight into a puddle of goop and undigested debris!") + target_turf.acid_melt() + else if(parent_integrity <= 4 && stage <= 3) + target_turf.visible_message("[target_turf] begins to crumble under the acid!") + stage = 4 + else if(parent_integrity <= 8 && stage <= 2) + target_turf.visible_message("[target_turf] is struggling to withstand the acid!") + stage = 3 + else if(parent_integrity <= 16 && stage <= 1) + target_turf.visible_message("[target_turf] is being melted by the acid!") + stage = 2 + else if(parent_integrity <= 24 && stage == 0) + target_turf.visible_message("[target_turf] is holding up against the acid!") + stage = 1 /// Used to maintain the acid overlay on the parent [/atom]. /datum/component/acid/proc/on_update_overlays(atom/parent_atom, list/overlays) diff --git a/code/datums/components/embedded.dm b/code/datums/components/embedded.dm index 572265cbb18..bba33c6a9f2 100644 --- a/code/datums/components/embedded.dm +++ b/code/datums/components/embedded.dm @@ -120,7 +120,7 @@ /datum/component/embedded/UnregisterFromParent() UnregisterSignal(parent, list(COMSIG_MOVABLE_MOVED, COMSIG_CARBON_EMBED_RIP, COMSIG_CARBON_EMBED_REMOVAL)) -/datum/component/embedded/process() +/datum/component/embedded/process(delta_time) var/mob/living/carbon/victim = parent if(!victim || !limb) // in case the victim and/or their limbs exploded (say, due to a sticky bomb) @@ -132,7 +132,7 @@ return var/damage = weapon.w_class * pain_mult - var/pain_chance_current = pain_chance + var/pain_chance_current = DT_PROB_RATE(pain_chance / 100, delta_time) * 100 if(pain_stam_pct && HAS_TRAIT_FROM(victim, TRAIT_INCAPACITATED, STAMINA)) //if it's a less-lethal embed, give them a break if they're already stamcritted pain_chance_current *= 0.2 damage *= 0.5 @@ -143,7 +143,7 @@ limb.receive_damage(brute=(1-pain_stam_pct) * damage, stamina=pain_stam_pct * damage, wound_bonus = CANT_WOUND) to_chat(victim, "[weapon] embedded in your [limb.name] hurts!") - var/fall_chance_current = fall_chance + var/fall_chance_current = DT_PROB_RATE(fall_chance / 100, delta_time) * 100 if(victim.mobility_flags & ~MOBILITY_STAND) fall_chance_current *= 0.2 diff --git a/code/datums/components/mood.dm b/code/datums/components/mood.dm index 6ef4d2e31cb..ecb7f4651c3 100644 --- a/code/datums/components/mood.dm +++ b/code/datums/components/mood.dm @@ -170,26 +170,26 @@ break ///Called on SSmood process -/datum/component/mood/process() +/datum/component/mood/process(delta_time) switch(mood_level) if(1) - setSanity(sanity-0.3, SANITY_INSANE) + setSanity(sanity-0.3*delta_time, SANITY_INSANE) if(2) - setSanity(sanity-0.15, SANITY_INSANE) + setSanity(sanity-0.15*delta_time, SANITY_INSANE) if(3) - setSanity(sanity-0.1, SANITY_CRAZY) + setSanity(sanity-0.1*delta_time, SANITY_CRAZY) if(4) - setSanity(sanity-0.05, SANITY_UNSTABLE) + setSanity(sanity-0.05*delta_time, SANITY_UNSTABLE) if(5) setSanity(sanity, SANITY_UNSTABLE) //This makes sure that mood gets increased should you be below the minimum. if(6) - setSanity(sanity+0.2, SANITY_UNSTABLE) + setSanity(sanity+0.2*delta_time, SANITY_UNSTABLE) if(7) - setSanity(sanity+0.3, SANITY_UNSTABLE) + setSanity(sanity+0.3*delta_time, SANITY_UNSTABLE) if(8) - setSanity(sanity+0.4, SANITY_NEUTRAL, SANITY_MAXIMUM) + setSanity(sanity+0.4*delta_time, SANITY_NEUTRAL, SANITY_MAXIMUM) if(9) - setSanity(sanity+0.6, SANITY_NEUTRAL, SANITY_MAXIMUM) + setSanity(sanity+0.6*delta_time, SANITY_NEUTRAL, SANITY_MAXIMUM) HandleNutrition() ///Sets sanity to the specified amount and applies effects. diff --git a/code/datums/components/nanites.dm b/code/datums/components/nanites.dm index 00af8534450..1a06bf872a3 100644 --- a/code/datums/components/nanites.dm +++ b/code/datums/components/nanites.dm @@ -109,9 +109,9 @@ else adjust_nanites(null, amount) //just add to the nanite volume -/datum/component/nanites/process() +/datum/component/nanites/process(delta_time) if(!IS_IN_STASIS(host_mob)) - adjust_nanites(null, regen_rate + (SSresearch.science_tech.researched_nodes["nanite_harmonic"] ? HARMONIC_REGEN_BOOST : 0)) + adjust_nanites(null, (regen_rate + (SSresearch.science_tech.researched_nodes["nanite_harmonic"] ? HARMONIC_REGEN_BOOST : 0)) * delta_time) add_research() for(var/X in programs) var/datum/nanite_program/NP = X diff --git a/code/datums/components/radioactive.dm b/code/datums/components/radioactive.dm index bdbb9cf56d1..852e4fa4d3f 100644 --- a/code/datums/components/radioactive.dm +++ b/code/datums/components/radioactive.dm @@ -39,8 +39,8 @@ master.remove_filter("rad_glow") return ..() -/datum/component/radioactive/process() - if(!prob(50)) +/datum/component/radioactive/process(delta_time) + if(!DT_PROB(50, delta_time)) return radiation_pulse(parent, strength, RAD_DISTANCE_COEFFICIENT*2, FALSE, can_contaminate) if(!hl3_release_date) diff --git a/code/datums/components/rot.dm b/code/datums/components/rot.dm index 9b1d45f9acf..586b632ac73 100644 --- a/code/datums/components/rot.dm +++ b/code/datums/components/rot.dm @@ -10,7 +10,7 @@ START_PROCESSING(SSprocessing, src) -/datum/component/rot/process() +/datum/component/rot/process(delta_time) var/atom/A = parent var/turf/open/T = get_turf(A) @@ -19,7 +19,7 @@ var/datum/gas_mixture/stank = new ADD_GAS(/datum/gas/miasma, stank.gases) - stank.gases[/datum/gas/miasma][MOLES] = amount + stank.gases[/datum/gas/miasma][MOLES] = amount * delta_time stank.temperature = BODYTEMP_NORMAL // otherwise we have gas below 2.7K which will break our lag generator T.assume_air(stank) T.air_update_turf() diff --git a/code/datums/elements/earhealing.dm b/code/datums/elements/earhealing.dm index a1e038d998c..673230ac9d8 100644 --- a/code/datums/elements/earhealing.dm +++ b/code/datums/elements/earhealing.dm @@ -25,12 +25,12 @@ else user_by_item -= source -/datum/element/earhealing/process() +/datum/element/earhealing/process(delta_time) for(var/i in user_by_item) var/mob/living/carbon/user = user_by_item[i] var/obj/item/organ/ears/ears = user.getorganslot(ORGAN_SLOT_EARS) if(!ears || HAS_TRAIT_NOT_FROM(user, TRAIT_DEAF, EAR_DAMAGE)) continue - ears.deaf = max(ears.deaf - 0.25, (ears.damage < ears.maxHealth ? 0 : 1)) // Do not clear deafness if our ears are too damaged - ears.damage = max(ears.damage - 0.025, 0) + ears.deaf = max(ears.deaf - 0.25 * delta_time, (ears.damage < ears.maxHealth ? 0 : 1)) // Do not clear deafness if our ears are too damaged + ears.damage = max(ears.damage - 0.025 * delta_time, 0) CHECK_TICK diff --git a/code/datums/radiation_wave.dm b/code/datums/radiation_wave.dm index cd38c3e0955..87b2e2e14b5 100644 --- a/code/datums/radiation_wave.dm +++ b/code/datums/radiation_wave.dm @@ -41,12 +41,12 @@ STOP_PROCESSING(SSradiation, src) ..() -/datum/radiation_wave/process() +/datum/radiation_wave/process(delta_time) master_turf = get_step(master_turf, move_dir) if(!master_turf) qdel(src) return - steps++ + steps += delta_time var/list/atoms = get_rad_atoms() var/strength diff --git a/code/datums/traits/_quirk.dm b/code/datums/traits/_quirk.dm index c7878b57702..1907d7dad0b 100644 --- a/code/datums/traits/_quirk.dm +++ b/code/datums/traits/_quirk.dm @@ -75,14 +75,14 @@ /datum/quirk/proc/post_add() //for text, disclaimers etc. given after you spawn in with the trait /datum/quirk/proc/on_transfer() //code called when the trait is transferred to a new mob -/datum/quirk/process() +/datum/quirk/process(delta_time) if(QDELETED(quirk_holder)) quirk_holder = null qdel(src) return if(quirk_holder.stat == DEAD) return - on_process() + on_process(delta_time) /** * get_quirk_string() is used to get a printable string of all the quirk traits someone has for certain criteria diff --git a/code/datums/traits/good.dm b/code/datums/traits/good.dm index 36bb8d27e3b..ce82e5a26f2 100644 --- a/code/datums/traits/good.dm +++ b/code/datums/traits/good.dm @@ -37,18 +37,18 @@ lose_text = "You no longer feel like drinking would ease your pain." medical_record_text = "Patient has unusually efficient liver metabolism and can slowly regenerate wounds by drinking alcoholic beverages." -/datum/quirk/drunkhealing/on_process() +/datum/quirk/drunkhealing/on_process(delta_time) var/mob/living/carbon/C = quirk_holder switch(C.drunkenness) if (6 to 40) - C.adjustBruteLoss(-0.1, FALSE) - C.adjustFireLoss(-0.05, FALSE) + C.adjustBruteLoss(-0.1*delta_time, FALSE) + C.adjustFireLoss(-0.05*delta_time, FALSE) if (41 to 60) - C.adjustBruteLoss(-0.4, FALSE) - C.adjustFireLoss(-0.2, FALSE) + C.adjustBruteLoss(-0.4*delta_time, FALSE) + C.adjustFireLoss(-0.2*delta_time, FALSE) if (61 to INFINITY) - C.adjustBruteLoss(-0.8, FALSE) - C.adjustFireLoss(-0.4, FALSE) + C.adjustBruteLoss(-0.8*delta_time, FALSE) + C.adjustFireLoss(-0.4*delta_time, FALSE) /datum/quirk/empath name = "Empath" @@ -126,8 +126,8 @@ mood_quirk = TRUE medical_record_text = "Patient demonstrates constant euthymia irregular for environment. It's a bit much, to be honest." -/datum/quirk/jolly/on_process() - if(prob(0.05)) +/datum/quirk/jolly/on_process(delta_time) + if(DT_PROB(0.05, delta_time)) SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "jolly", /datum/mood_event/jolly) /datum/quirk/light_step diff --git a/code/datums/traits/negative.dm b/code/datums/traits/negative.dm index c00e91cab33..90c0feb2f48 100644 --- a/code/datums/traits/negative.dm +++ b/code/datums/traits/negative.dm @@ -32,13 +32,13 @@ medical_record_text = "Patient requires regular treatment for blood loss due to low production of blood." hardcore_value = 8 -/datum/quirk/blooddeficiency/on_process() +/datum/quirk/blooddeficiency/on_process(delta_time) var/mob/living/carbon/human/H = quirk_holder if(NOBLOOD in H.dna.species.species_traits) //can't lose blood if your species doesn't have any return else if (H.blood_volume > (BLOOD_VOLUME_SAFE - 25)) // just barely survivable without treatment - H.blood_volume -= 0.275 + H.blood_volume -= 0.275 * delta_time /datum/quirk/blindness name = "Blind" @@ -93,10 +93,10 @@ to_chat(quirk_holder, "There is a bottle of mannitol pills [where] to keep you alive until you can secure a supply of medication. Don't rely on it too much!") -/datum/quirk/brainproblems/on_process() +/datum/quirk/brainproblems/on_process(delta_time) if(HAS_TRAIT(quirk_holder, TRAIT_TUMOR_SUPPRESSED)) return - quirk_holder.adjustOrganLoss(ORGAN_SLOT_BRAIN, 0.2) + quirk_holder.adjustOrganLoss(ORGAN_SLOT_BRAIN, 0.2 * delta_time) /datum/quirk/deafness name = "Deaf" @@ -119,8 +119,8 @@ mood_quirk = TRUE hardcore_value = 1 -/datum/quirk/depression/on_process() - if(prob(0.05)) +/datum/quirk/depression/on_process(delta_time) + if(DT_PROB(0.05, delta_time)) SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "depression_mild", /datum/mood_event/depression_mild) /datum/quirk/family_heirloom @@ -462,11 +462,11 @@ medical_record_text = "Patient suffers from acute Reality Dissociation Syndrome and experiences vivid hallucinations." hardcore_value = 6 -/datum/quirk/insanity/on_process() +/datum/quirk/insanity/on_process(delta_time) if(quirk_holder.has_reagent(/datum/reagent/toxin/mindbreaker, needs_metabolizing = TRUE)) quirk_holder.hallucination = 0 return - if(prob(2)) //we'll all be mad soon enough + if(DT_PROB(2, delta_time)) //we'll all be mad soon enough madness() /datum/quirk/insanity/proc/madness() @@ -495,18 +495,18 @@ /datum/quirk/social_anxiety/remove() UnregisterSignal(quirk_holder, list(COMSIG_MOB_EYECONTACT, COMSIG_MOB_EXAMINATE)) -/datum/quirk/social_anxiety/on_process() +/datum/quirk/social_anxiety/on_process(delta_time) var/nearby_people = 0 for(var/mob/living/carbon/human/H in oview(3, quirk_holder)) if(H.client) nearby_people++ var/mob/living/carbon/human/H = quirk_holder - if(prob(2 + nearby_people)) + if(DT_PROB(2 + nearby_people, delta_time)) H.stuttering = max(3, H.stuttering) - else if(prob(min(3, nearby_people)) && !H.silent) + else if(DT_PROB(min(3, nearby_people), delta_time) && !H.silent) to_chat(H, "You retreat into yourself. You really don't feel up to talking.") H.silent = max(10, H.silent) - else if(prob(0.5) && dumb_thing) + else if(DT_PROB(0.5, delta_time) && dumb_thing) to_chat(H, "You think of a dumb thing you said a long time ago and scream internally.") dumb_thing = FALSE //only once per life if(prob(1)) @@ -704,7 +704,7 @@ dogtag.display = display human_holder.equip_in_one_of_slots(dogtag, slots , qdel_on_fail = TRUE) -/datum/quirk/allergic/on_process() +/datum/quirk/allergic/on_process(delta_time) . = ..() if(!iscarbon(quirk_holder)) return @@ -718,9 +718,9 @@ instantiated_med.reagent_removal_skip_list |= ALLERGIC_REMOVAL_SKIP return //intentionally stops the entire proc so we avoid the organ damage after the loop instantiated_med.reagent_removal_skip_list -= ALLERGIC_REMOVAL_SKIP - carbon_quirk_holder.adjustToxLoss(3) - carbon_quirk_holder.reagents.add_reagent(/datum/reagent/toxin/histamine,3) - if(prob(10)) + carbon_quirk_holder.adjustToxLoss(3 * delta_time) + carbon_quirk_holder.reagents.add_reagent(/datum/reagent/toxin/histamine, 3 * delta_time) + if(DT_PROB(10, delta_time)) carbon_quirk_holder.vomit() carbon_quirk_holder.adjustOrganLoss(pick(ORGAN_SLOT_BRAIN,ORGAN_SLOT_APPENDIX,ORGAN_SLOT_LUNGS,ORGAN_SLOT_HEART,ORGAN_SLOT_LIVER,ORGAN_SLOT_STOMACH),10) diff --git a/code/game/gamemodes/clown_ops/clown_weapons.dm b/code/game/gamemodes/clown_ops/clown_weapons.dm index 058da3c061a..c08f3cf023a 100644 --- a/code/game/gamemodes/clown_ops/clown_weapons.dm +++ b/code/game/gamemodes/clown_ops/clown_weapons.dm @@ -23,6 +23,10 @@ permeability_coefficient = 0.05 pocket_storage_component_path = /datum/component/storage/concrete/pockets/shoes +/// Recharging rate in PPS (peels per second) +#define BANANA_SHOES_RECHARGE_RATE 17 +#define BANANA_SHOES_MAX_CHARGE 3000 + //The super annoying version /obj/item/clothing/shoes/clown_shoes/banana_shoes/combat name = "mk-honk combat shoes" @@ -34,24 +38,25 @@ permeability_coefficient = 0.05 pocket_storage_component_path = /datum/component/storage/concrete/pockets/shoes always_noslip = TRUE - var/max_recharge = 3000 //30 peels worth - var/recharge_rate = 34 //about 1/3 of a peel per tick /obj/item/clothing/shoes/clown_shoes/banana_shoes/combat/Initialize() . = ..() var/datum/component/material_container/bananium = GetComponent(/datum/component/material_container) - bananium.insert_amount_mat(max_recharge, /datum/material/bananium) + bananium.insert_amount_mat(BANANA_SHOES_MAX_CHARGE, /datum/material/bananium) START_PROCESSING(SSobj, src) -/obj/item/clothing/shoes/clown_shoes/banana_shoes/combat/process() +/obj/item/clothing/shoes/clown_shoes/banana_shoes/combat/process(delta_time) var/datum/component/material_container/bananium = GetComponent(/datum/component/material_container) var/bananium_amount = bananium.get_material_amount(/datum/material/bananium) - if(bananium_amount < max_recharge) - bananium.insert_amount_mat(min(recharge_rate, max_recharge - bananium_amount), /datum/material/bananium) + if(bananium_amount < BANANA_SHOES_MAX_CHARGE) + bananium.insert_amount_mat(min(BANANA_SHOES_RECHARGE_RATE * delta_time, BANANA_SHOES_MAX_CHARGE - bananium_amount), /datum/material/bananium) /obj/item/clothing/shoes/clown_shoes/banana_shoes/combat/attack_self(mob/user) ui_action_click(user) +#undef BANANA_SHOES_RECHARGE_RATE +#undef BANANA_SHOES_MAX_CHARGE + //BANANIUM SWORD /obj/item/melee/transforming/energy/sword/bananium diff --git a/code/game/machinery/bank_machine.dm b/code/game/machinery/bank_machine.dm index 75a71ea2875..38132e3d4f8 100644 --- a/code/game/machinery/bank_machine.dm +++ b/code/game/machinery/bank_machine.dm @@ -39,21 +39,22 @@ return return ..() -/obj/machinery/computer/bank_machine/process() +/obj/machinery/computer/bank_machine/process(delta_time) ..() if(siphoning) if (machine_stat & (BROKEN|NOPOWER)) say("Insufficient power. Halting siphon.") end_syphon() + var/siphon_am = 100 * delta_time var/datum/bank_account/D = SSeconomy.get_dep_account(ACCOUNT_CAR) - if(!D.has_money(200)) + if(!D.has_money(siphon_am)) say("Cargo budget depleted. Halting siphon.") end_syphon() return playsound(src, 'sound/items/poster_being_created.ogg', 100, TRUE) - syphoning_credits += 200 - D.adjust_money(-200) + syphoning_credits += siphon_am + D.adjust_money(-siphon_am) if(next_warning < world.time && prob(15)) var/area/A = get_area(loc) var/message = "Unauthorized credit withdrawal underway in [initial(A.name)]!!" diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm index f23c7b7bf1f..746a7ddc373 100644 --- a/code/game/machinery/cell_charger.dm +++ b/code/game/machinery/cell_charger.dm @@ -10,7 +10,7 @@ circuit = /obj/item/circuitboard/machine/cell_charger pass_flags = PASSTABLE var/obj/item/stock_parts/cell/charging = null - var/charge_rate = 500 + var/charge_rate = 250 /obj/machinery/cell_charger/update_overlays() . = ..() @@ -30,7 +30,7 @@ if(charging) . += "Current charge: [round(charging.percent(), 1)]%." if(in_range(user, src) || isobserver(user)) - . += "The status display reads: Charge rate at [charge_rate]J per cycle." + . += "The status display reads: Charging power: [charge_rate]W." /obj/machinery/cell_charger/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/stock_parts/cell) && !panel_open) @@ -115,17 +115,17 @@ charging.emp_act(severity) /obj/machinery/cell_charger/RefreshParts() - charge_rate = 500 + charge_rate = 250 for(var/obj/item/stock_parts/capacitor/C in component_parts) charge_rate *= C.rating -/obj/machinery/cell_charger/process() +/obj/machinery/cell_charger/process(delta_time) if(!charging || !anchored || (machine_stat & (BROKEN|NOPOWER))) return if(charging.percent() >= 100) return - use_power(charge_rate) - charging.give(charge_rate) //this is 2558, efficient batteries exist + use_power(charge_rate * delta_time) + charging.give(charge_rate * delta_time) //this is 2558, efficient batteries exist update_icon() diff --git a/code/game/machinery/defibrillator_mount.dm b/code/game/machinery/defibrillator_mount.dm index 6729611c8c7..ef042071031 100644 --- a/code/game/machinery/defibrillator_mount.dm +++ b/code/game/machinery/defibrillator_mount.dm @@ -193,13 +193,13 @@ begin_processing() -/obj/machinery/defibrillator_mount/charging/process() +/obj/machinery/defibrillator_mount/charging/process(delta_time) var/obj/item/stock_parts/cell/C = get_cell() if(!C || !is_operational) return PROCESS_KILL if(C.charge < C.maxcharge) - use_power(100) - C.give(80) + use_power(50 * delta_time) + C.give(40 * delta_time) update_icon() //wallframe, for attaching the mounts easily diff --git a/code/game/machinery/electrolyzer.dm b/code/game/machinery/electrolyzer.dm index 3d288e64702..e2954b91005 100644 --- a/code/game/machinery/electrolyzer.dm +++ b/code/game/machinery/electrolyzer.dm @@ -63,7 +63,7 @@ if(panel_open) . += "electrolyzer-open" -/obj/machinery/electrolyzer/process() +/obj/machinery/electrolyzer/process(delta_time) if(!is_operational && on) on = FALSE if(!on) @@ -93,7 +93,7 @@ var/datum/gas_mixture/env = L.return_air() //get air from the turf var/datum/gas_mixture/removed = env.remove(0.1 * env.total_moles()) removed.assert_gases(/datum/gas/water_vapor, /datum/gas/oxygen, /datum/gas/hydrogen) - var/proportion = min(removed.gases[/datum/gas/water_vapor][MOLES], (3 * workingPower))//Works to max 12 moles at a time. + var/proportion = min(removed.gases[/datum/gas/water_vapor][MOLES], (1.5 * delta_time * workingPower))//Works to max 12 moles at a time. removed.gases[/datum/gas/water_vapor][MOLES] -= proportion * 2 * workingPower removed.gases[/datum/gas/oxygen][MOLES] += proportion * workingPower removed.gases[/datum/gas/hydrogen][MOLES] += proportion * 2 * workingPower diff --git a/code/game/machinery/embedded_controller/embedded_controller_base.dm b/code/game/machinery/embedded_controller/embedded_controller_base.dm index 2d9cc6cf983..68237b30e28 100644 --- a/code/game/machinery/embedded_controller/embedded_controller_base.dm +++ b/code/game/machinery/embedded_controller/embedded_controller_base.dm @@ -53,9 +53,9 @@ usr.set_machine(src) addtimer(CALLBACK(src, .proc/updateDialog), 5) -/obj/machinery/embedded_controller/process() +/obj/machinery/embedded_controller/process(delta_time) if(program) - program.process() + program.process(delta_time) update_icon() src.updateDialog() diff --git a/code/game/machinery/fat_sucker.dm b/code/game/machinery/fat_sucker.dm index b1ce8c8f519..4bf686faeb2 100644 --- a/code/game/machinery/fat_sucker.dm +++ b/code/game/machinery/fat_sucker.dm @@ -11,7 +11,7 @@ var/start_at = NUTRITION_LEVEL_WELL_FED var/stop_at = NUTRITION_LEVEL_STARVING var/free_exit = TRUE //set to false to prevent people from exiting before being completely stripped of fat - var/bite_size = 15 //amount of nutrients we take per process + var/bite_size = 7.5 //amount of nutrients we take per second var/nutrients //amount of nutrients we got build up var/nutrient_to_meat = 90 //one slab of meat gives about 52 nutrition var/datum/looping_sound/microwave/soundloop //100% stolen from microwaves @@ -37,7 +37,7 @@ var/rating = 0 for(var/obj/item/stock_parts/micro_laser/L in component_parts) rating += L.rating - bite_size = initial(bite_size) + rating * 5 + bite_size = initial(bite_size) + rating * 2.5 nutrient_to_meat = initial(nutrient_to_meat) - rating * 5 /obj/machinery/fat_sucker/examine(mob/user) @@ -128,7 +128,7 @@ if(panel_open) . += "[icon_state]_panel" -/obj/machinery/fat_sucker/process() +/obj/machinery/fat_sucker/process(delta_time) if(!processing) return if(!powered() || !occupant || !iscarbon(occupant)) @@ -140,8 +140,8 @@ open_machine() playsound(src, 'sound/machines/microwave/microwave-end.ogg', 100, FALSE) return - C.adjust_nutrition(-bite_size) - nutrients += bite_size + C.adjust_nutrition(-bite_size * delta_time) + nutrients += bite_size * delta_time if(next_fact <= 0) next_fact = initial(next_fact) diff --git a/code/game/machinery/hypnochair.dm b/code/game/machinery/hypnochair.dm index 226e5dfba15..9d856c5dc38 100644 --- a/code/game/machinery/hypnochair.dm +++ b/code/game/machinery/hypnochair.dm @@ -97,12 +97,12 @@ update_icon() timerid = addtimer(CALLBACK(src, .proc/finish_interrogation), 450, TIMER_STOPPABLE) -/obj/machinery/hypnochair/process() +/obj/machinery/hypnochair/process(delta_time) var/mob/living/carbon/C = occupant if(!istype(C) || C != victim) interrupt_interrogation() return - if(prob(10) && !(C.get_eye_protection() > 0)) + if(DT_PROB(5, delta_time) && !(C.get_eye_protection() > 0)) to_chat(C, "[pick(\ "...blue... red... green... blue, red, green, blueredgreenblueredgreen",\ "...pretty colors...",\ diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index 8e57ad9f498..8aec8304814 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -117,7 +117,7 @@ new /obj/item/stack/sheet/metal(loc) qdel(src) -/obj/machinery/iv_drip/process() +/obj/machinery/iv_drip/process(delta_time) if(!attached) return PROCESS_KILL @@ -138,13 +138,13 @@ if(istype(beaker, /obj/item/reagent_containers/blood)) // speed up transfer on blood packs transfer_amount *= 2 - beaker.reagents.trans_to(attached, transfer_amount, methods = INJECT, show_message = FALSE) //make reagents reacts, but don't spam messages + beaker.reagents.trans_to(attached, transfer_amount * delta_time * 0.5, methods = INJECT, show_message = FALSE) //make reagents reacts, but don't spam messages update_icon() // Take blood else var/amount = beaker.reagents.maximum_volume - beaker.reagents.total_volume - amount = min(amount, 4) + amount = min(amount, 4) * delta_time * 0.5 // If the beaker is full, ping if(!amount) if(prob(5)) diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index 0ffed0d203e..614cbefde6f 100755 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -119,7 +119,7 @@ charging.forceMove(drop_location()) setCharging(null) -/obj/machinery/recharger/process() +/obj/machinery/recharger/process(delta_time) if(machine_stat & (NOPOWER|BROKEN) || !anchored) return PROCESS_KILL @@ -128,8 +128,8 @@ var/obj/item/stock_parts/cell/C = charging.get_cell() if(C) if(C.charge < C.maxcharge) - C.give(C.chargerate * recharge_coeff) - use_power(250 * recharge_coeff) + C.give(C.chargerate * recharge_coeff * delta_time / 2) + use_power(125 * recharge_coeff * delta_time) using_power = TRUE update_icon() @@ -137,7 +137,7 @@ var/obj/item/ammo_box/magazine/recharge/R = charging if(R.stored_ammo.len < R.max_ammo) R.stored_ammo += new R.ammo_type(R) - use_power(200 * recharge_coeff) + use_power(100 * recharge_coeff * delta_time) using_power = TRUE update_icon() return diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index 8cdbcb59b3c..7f2e49acdc3 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -48,9 +48,9 @@ begin_processing() -/obj/machinery/recharge_station/process() +/obj/machinery/recharge_station/process(delta_time) if(occupant) - process_occupant() + process_occupant(delta_time) return 1 /obj/machinery/recharge_station/relaymove(mob/living/user, direction) @@ -107,7 +107,7 @@ else icon_state = (state_open ? "borgcharger-u0" : "borgcharger-u1") -/obj/machinery/recharge_station/proc/process_occupant() +/obj/machinery/recharge_station/proc/process_occupant(delta_time) if(!occupant) return - SEND_SIGNAL(occupant, COMSIG_PROCESS_BORGCHARGER_OCCUPANT, recharge_speed, repairs) + SEND_SIGNAL(occupant, COMSIG_PROCESS_BORGCHARGER_OCCUPANT, recharge_speed * delta_time / 2, repairs) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index bba702a85df..eaae315dbf1 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -144,9 +144,9 @@ update_icon() QDEL_LIST(deployed_shields) -/obj/machinery/shieldgen/process() +/obj/machinery/shieldgen/process(delta_time) if((machine_stat & BROKEN) && active) - if(deployed_shields.len && prob(5)) + if(deployed_shields.len && DT_PROB(2.5, delta_time)) qdel(pick(deployed_shields)) diff --git a/code/game/machinery/slotmachine.dm b/code/game/machinery/slotmachine.dm index 6cf7413d71c..392639aaf23 100644 --- a/code/game/machinery/slotmachine.dm +++ b/code/game/machinery/slotmachine.dm @@ -59,12 +59,12 @@ give_payout(balance) return ..() -/obj/machinery/computer/slot_machine/process() +/obj/machinery/computer/slot_machine/process(delta_time) . = ..() //Sanity checks. if(!.) return . - money++ //SPESSH MAJICKS + money += round(delta_time / 2) //SPESSH MAJICKS /obj/machinery/computer/slot_machine/update_icon_state() if(machine_stat & NOPOWER) diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index 43022f0c058..d02d4d90128 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -20,7 +20,7 @@ var/mode = HEATER_MODE_STANDBY var/setMode = "auto" // Anything other than "heat" or "cool" is considered auto. var/targetTemperature = T20C - var/heatingPower = 40000 + var/heatingPower = 20000 var/efficiency = 20000 var/temperatureTolerance = 1 var/settableTemperatureMedian = 30 + T0C @@ -55,7 +55,7 @@ else . += "There is no power cell installed." if(in_range(user, src) || isobserver(user)) - . += "The status display reads: Temperature range at [settableTemperatureRange]°C.
Heating power at [heatingPower*0.001]kJ.
Power consumption at [(efficiency*-0.0025)+150]%.
" //100%, 75%, 50%, 25% + . += "The status display reads: Temperature range at [settableTemperatureRange]°C.
Heating power at [siunit(heatingPower, "W", 1)].
Power consumption at [(efficiency*-0.0025)+150]%.
" //100%, 75%, 50%, 25% /obj/machinery/space_heater/update_icon_state() if(on) @@ -69,7 +69,7 @@ if(panel_open) . += "sheater-open" -/obj/machinery/space_heater/process() +/obj/machinery/space_heater/process(delta_time) if(!on || !is_operational) if (on) // If it's broken, turn it off too on = FALSE @@ -99,19 +99,19 @@ return var/heat_capacity = env.heat_capacity() - var/requiredPower = abs(env.temperature - targetTemperature) * heat_capacity - requiredPower = min(requiredPower, heatingPower) + var/requiredEnergy = abs(env.temperature - targetTemperature) * heat_capacity + requiredEnergy = min(requiredEnergy, heatingPower * delta_time) - if(requiredPower < 1) + if(requiredEnergy < 1) return - var/deltaTemperature = requiredPower / heat_capacity + var/deltaTemperature = requiredEnergy / heat_capacity if(mode == HEATER_MODE_COOL) deltaTemperature *= -1 if(deltaTemperature) env.temperature += deltaTemperature air_update_turf() - cell.use(requiredPower / efficiency) + cell.use(requiredEnergy / efficiency) else on = FALSE update_icon() @@ -125,7 +125,7 @@ for(var/obj/item/stock_parts/capacitor/M in component_parts) cap += M.rating - heatingPower = laser * 40000 + heatingPower = laser * 20000 settableTemperatureRange = cap * 30 efficiency = (cap + 1) * 10000 diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index cabbf60f224..3e711d5e8bd 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -101,7 +101,7 @@ /// Update the display and, if necessary, re-enable processing. /obj/machinery/status_display/proc/update() - if (process() != PROCESS_KILL) + if (process(SSMACHINES_DT) != PROCESS_KILL) START_PROCESSING(SSmachines, src) /obj/machinery/status_display/power_change() diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index d91c8cb48b0..9dc20810414 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -48,7 +48,7 @@ /// How long it takes to break out of the SSU. var/breakout_time = 300 /// How fast it charges cells in a suit - var/charge_rate = 500 + var/charge_rate = 250 /obj/machinery/suit_storage_unit/Initialize() . = ..() @@ -407,7 +407,7 @@ if(occupant) dump_contents() -/obj/machinery/suit_storage_unit/process() +/obj/machinery/suit_storage_unit/process(delta_time) if(!suit) return if(!istype(suit, /obj/item/clothing/suit/space)) @@ -416,8 +416,8 @@ return var/obj/item/stock_parts/cell/C = suit.cell - use_power(charge_rate) - C.give(charge_rate) + use_power(charge_rate * delta_time) + C.give(charge_rate * delta_time) /obj/machinery/suit_storage_unit/proc/shock(mob/user, prb) if(!prob(prb)) diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm index ecb464acbbe..38fef07d6b8 100644 --- a/code/game/machinery/telecomms/telecomunications.dm +++ b/code/game/machinery/telecomms/telecomunications.dm @@ -19,7 +19,7 @@ GLOBAL_LIST_EMPTY(telecomms_list) critical_machine = TRUE var/list/links = list() // list of machines this machine is linked to var/traffic = 0 // value increases as traffic increases - var/netspeed = 5 // how much traffic to lose per tick (50 gigabytes/second * netspeed) + var/netspeed = 2.5 // how much traffic to lose per second (50 gigabytes/second * netspeed) var/list/autolinkers = list() // list of text/number values to link with var/id = "NULL" // identification string var/network = "NULL" // the network of the machinery @@ -132,14 +132,14 @@ GLOBAL_LIST_EMPTY(telecomms_list) else on = FALSE -/obj/machinery/telecomms/process() +/obj/machinery/telecomms/process(delta_time) update_power() // Update the icon update_icon() if(traffic > 0) - traffic -= netspeed + traffic -= netspeed * delta_time /obj/machinery/telecomms/emp_act(severity) . = ..() diff --git a/code/game/machinery/washing_machine.dm b/code/game/machinery/washing_machine.dm index 60c08003708..92d07427b4d 100644 --- a/code/game/machinery/washing_machine.dm +++ b/code/game/machinery/washing_machine.dm @@ -165,18 +165,18 @@ GLOBAL_LIST_INIT(dye_registry, list( START_PROCESSING(SSfastprocess, src) -/obj/machinery/washing_machine/process() +/obj/machinery/washing_machine/process(delta_time) if(!busy) animate(src, transform=matrix(), time=2) return PROCESS_KILL if(anchored) - if(prob(5)) + if(DT_PROB(2.5, delta_time)) var/matrix/M = new M.Translate(rand(-1, 1), rand(0, 1)) animate(src, transform=M, time=1) animate(transform=matrix(), time=1) else - if(prob(1)) + if(DT_PROB(0.5, delta_time)) step(src, pick(GLOB.cardinals)) var/matrix/M = new M.Translate(rand(-3, 3), rand(-1, 3)) diff --git a/code/game/objects/effects/anomalies.dm b/code/game/objects/effects/anomalies.dm index cb6de2ed016..061a880bce7 100644 --- a/code/game/objects/effects/anomalies.dm +++ b/code/game/objects/effects/anomalies.dm @@ -1,5 +1,8 @@ //Anomalies, used for events. Note that these DO NOT work by themselves; their procs are called by the event datum. +/// Chance of taking a step per second +#define ANOMALY_MOVECHANCE 45 + /obj/effect/anomaly name = "anomaly" desc = "A mysterious anomaly, seen commonly only in the region of space that the station orbits..." @@ -7,7 +10,7 @@ density = FALSE anchored = TRUE light_range = 3 - var/movechance = 70 + var/obj/item/assembly/signaler/anomaly/aSignal = /obj/item/assembly/signaler/anomaly var/area/impact_area @@ -48,8 +51,8 @@ countdown.color = countdown_colour countdown.start() -/obj/effect/anomaly/process() - anomalyEffect() +/obj/effect/anomaly/process(delta_time) + anomalyEffect(delta_time) if(death_time < world.time) if(loc) detonate() @@ -63,8 +66,8 @@ QDEL_NULL(aSignal) return ..() -/obj/effect/anomaly/proc/anomalyEffect() - if(prob(movechance)) +/obj/effect/anomaly/proc/anomalyEffect(delta_time) + if(DT_PROB(ANOMALY_MOVECHANCE, delta_time)) step(src,pick(GLOB.alldirs)) /obj/effect/anomaly/proc/detonate() @@ -273,15 +276,17 @@ name = "pyroclastic anomaly" icon_state = "mustard" var/ticks = 0 + /// How many seconds between each gas release + var/releasedelay = 10 aSignal = /obj/item/assembly/signaler/anomaly/pyro -/obj/effect/anomaly/pyro/anomalyEffect() +/obj/effect/anomaly/pyro/anomalyEffect(delta_time) ..() - ticks++ - if(ticks < 5) + ticks += delta_time + if(ticks < releasedelay) return else - ticks = 0 + ticks -= releasedelay var/turf/open/T = get_turf(src) if(istype(T)) T.atmos_spawn_air("o2=5;plasma=5;TEMP=1000") @@ -376,3 +381,5 @@ SSexplosions.medturf += T if(EXPLODE_LIGHT) SSexplosions.lowturf += T + +#undef ANOMALY_MOVECHANCE diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index d8c06b97e71..1bc1a8eeae5 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -89,10 +89,10 @@ START_PROCESSING(SSobj, src) . = ..() -/obj/structure/spider/eggcluster/process() - amount_grown += rand(0,2) +/obj/structure/spider/eggcluster/process(delta_time) + amount_grown += rand(0,1) * delta_time if(amount_grown >= 100) - var/num = rand(3,12) + var/num = round(rand(1.5, 6) * delta_time) for(var/i=0, iCookie Synthesizer reset.
") -/obj/item/rsf/cookiesynth/process() - matter = min(matter + 1, max_matter) //We add 1 up to a point +/obj/item/rsf/cookiesynth/process(delta_time) + matter = min(matter += delta_time, max_matter) //We add 1 up to a point if(matter >= max_matter) STOP_PROCESSING(SSprocessing, src) diff --git a/code/game/objects/items/candle.dm b/code/game/objects/items/candle.dm index b4d27e3e714..bd73390dd0d 100644 --- a/code/game/objects/items/candle.dm +++ b/code/game/objects/items/candle.dm @@ -9,7 +9,8 @@ w_class = WEIGHT_CLASS_TINY light_color = LIGHT_COLOR_FIRE heat = 1000 - var/wax = 1000 + /// How many seconds it burns for + var/wax = 2000 var/lit = FALSE var/infinite = FALSE var/start_lit = FALSE @@ -20,7 +21,7 @@ light() /obj/item/candle/update_icon_state() - icon_state = "candle[(wax > 400) ? ((wax > 750) ? 1 : 2) : 3][lit ? "_lit" : ""]" + icon_state = "candle[(wax > 800) ? ((wax > 1500) ? 1 : 2) : 3][lit ? "_lit" : ""]" /obj/item/candle/attackby(obj/item/W, mob/user, params) var/msg = W.ignition_effect(src, user) @@ -58,12 +59,12 @@ put_out_candle() return ..() -/obj/item/candle/process() +/obj/item/candle/process(delta_time) if(!lit) return PROCESS_KILL if(!infinite) - wax-- - if(!wax) + wax -= delta_time + if(wax <= 0) new /obj/item/trash/candle(loc) qdel(src) update_icon() diff --git a/code/game/objects/items/chrono_eraser.dm b/code/game/objects/items/chrono_eraser.dm index 375d407ef54..3bcdb4442de 100644 --- a/code/game/objects/items/chrono_eraser.dm +++ b/code/game/objects/items/chrono_eraser.dm @@ -168,7 +168,7 @@ interaction_flags_atom = NONE var/mob/living/captured = null var/obj/item/gun/energy/chrono_gun/gun = null - var/tickstokill = 15 + var/timetokill = 30 var/mutable_appearance/mob_underlay var/RPpos = null var/attached = TRUE //if the gun arg isn't included initially, then the chronofield will work without one @@ -201,7 +201,7 @@ return ..() /obj/structure/chrono_field/update_icon() - var/ttk_frame = 1 - (tickstokill / initial(tickstokill)) + var/ttk_frame = 1 - (timetokill / initial(timetokill)) ttk_frame = clamp(CEILING(ttk_frame * CHRONO_FRAME_COUNT, 1), 1, CHRONO_FRAME_COUNT) if(ttk_frame != RPpos) RPpos = ttk_frame @@ -209,13 +209,13 @@ underlays = list() //hack: BYOND refuses to update the underlay to match the icon_state otherwise underlays += mob_underlay -/obj/structure/chrono_field/process() +/obj/structure/chrono_field/process(delta_time) if(captured) - if(tickstokill > initial(tickstokill)) + if(timetokill > initial(timetokill)) for(var/atom/movable/AM in contents) AM.forceMove(drop_location()) qdel(src) - else if(tickstokill <= 0) + else if(timetokill <= 0) to_chat(captured, "As the last essence of your being is erased from time, you are taken back to your most enjoyable memory. You feel happy...") var/mob/dead/observer/ghost = captured.ghostize(1) if(captured.mind) @@ -232,14 +232,14 @@ update_icon() if(gun) if(gun.field_check(src)) - tickstokill-- + timetokill -= delta_time else gun = null return .() else if(!attached) - tickstokill-- + timetokill -= delta_time else - tickstokill++ + timetokill += delta_time else qdel(src) diff --git a/code/game/objects/items/cigs_lighters.dm b/code/game/objects/items/cigs_lighters.dm index b88352ef77c..99f95c0d2b3 100644 --- a/code/game/objects/items/cigs_lighters.dm +++ b/code/game/objects/items/cigs_lighters.dm @@ -22,14 +22,15 @@ CIGARETTE PACKETS ARE IN FANCY.DM icon_state = "match_unlit" var/lit = FALSE var/burnt = FALSE - var/smoketime = 5 // 10 seconds + /// How long the match lasts in seconds + var/smoketime = 10 w_class = WEIGHT_CLASS_TINY heat = 1000 grind_results = list(/datum/reagent/phosphorus = 2) -/obj/item/match/process() - smoketime-- - if(smoketime < 1) +/obj/item/match/process(delta_time) + smoketime -= delta_time + if(smoketime <= 0) matchburnout() else open_flame(heat) @@ -102,7 +103,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/match/firebrand name = "firebrand" desc = "An unlit firebrand. It makes you wonder why it's not just called a stick." - smoketime = 20 //40 seconds + smoketime = 40 custom_materials = list(/datum/material/wood = MINERAL_MATERIAL_AMOUNT) grind_results = list(/datum/reagent/carbon = 2) @@ -123,7 +124,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM body_parts_covered = null grind_results = list() heat = 1000 - var/dragtime = 100 + var/dragtime = 10 var/nextdragtime = 0 var/lit = FALSE var/starts_lit = FALSE @@ -131,7 +132,8 @@ CIGARETTE PACKETS ARE IN FANCY.DM var/icon_off = "cigoff" var/type_butt = /obj/item/cigbutt var/lastHolder = null - var/smoketime = 180 // 1 is 2 seconds, so a single cigarette will last 6 minutes. + /// How long the cigarette lasts in seconds + var/smoketime = 360 var/chem_volume = 30 var/smoke_all = FALSE /// Should we smoke all of the chems in the cig before it runs out. Splits each puff to take a portion of the overall chems so by the end you'll always have consumed all of the chems inside. var/list/list_reagents = list(/datum/reagent/drug/nicotine = 15) @@ -251,7 +253,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM * of chems to give them each time so they'll have smoked it all by the end. */ if (smoke_all) - to_smoke = reagents.total_volume/((smoketime * 2) / (dragtime / 10)) + to_smoke = reagents.total_volume / (smoketime / dragtime) reagents.expose(C, INGEST, fraction) var/obj/item/organ/lungs/L = C.getorganslot(ORGAN_SLOT_LUNGS) @@ -262,13 +264,13 @@ CIGARETTE PACKETS ARE IN FANCY.DM return reagents.remove_any(to_smoke) -/obj/item/clothing/mask/cigarette/process() +/obj/item/clothing/mask/cigarette/process(delta_time) var/turf/location = get_turf(src) var/mob/living/M = loc if(isliving(loc)) M.IgniteMob() - smoketime-- - if(smoketime < 1) + smoketime -= delta_time + if(smoketime <= 0) new type_butt(location) if(ismob(loc)) to_chat(M, "Your [name] goes out.") @@ -276,7 +278,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM return open_flame() if((reagents && reagents.total_volume) && (nextdragtime <= world.time)) - nextdragtime = world.time + dragtime + nextdragtime = world.time + dragtime SECONDS handle_reagents() /obj/item/clothing/mask/cigarette/attack_self(mob/user) @@ -342,7 +344,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/clothing/mask/cigarette/syndicate desc = "An unknown brand cigarette." chem_volume = 60 - smoketime = 60 + smoketime = 2 * 60 smoke_all = TRUE list_reagents = list(/datum/reagent/drug/nicotine = 10, /datum/reagent/medicine/omnizine = 15) @@ -365,7 +367,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM type_butt = /obj/item/cigbutt/roach throw_speed = 0.5 inhand_icon_state = "spliffoff" - smoketime = 120 // four minutes + smoketime = 4 * 60 chem_volume = 50 list_reagents = null @@ -431,7 +433,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/clothing/mask/cigarette/candy name = "Little Timmy's candy cigarette" desc = "For all ages*! Doesn't contain any amount of nicotine. Health and safety risks can be read on the tip of the cigarette." - smoketime = 120 + smoketime = 2 * 60 icon_on = "candyon" icon_off = "candyoff" //make sure to add positional sprites in icons/obj/cigarettes.dmi if you add more. inhand_icon_state = "candyoff" @@ -468,7 +470,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM type_butt = /obj/item/cigbutt/cigarbutt throw_speed = 0.5 inhand_icon_state = "cigaroff" - smoketime = 300 // 11 minutes + smoketime = 11 * 60 chem_volume = 40 list_reagents = list(/datum/reagent/drug/nicotine = 25) @@ -478,7 +480,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM icon_state = "cigar2off" icon_on = "cigar2on" icon_off = "cigar2off" - smoketime = 600 // 20 minutes + smoketime = 20 * 60 chem_volume = 80 list_reagents =list(/datum/reagent/drug/nicotine = 40) @@ -488,7 +490,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM icon_state = "cigar2off" icon_on = "cigar2on" icon_off = "cigar2off" - smoketime = 900 // 30 minutes + smoketime = 30 * 60 chem_volume = 50 list_reagents =list(/datum/reagent/drug/nicotine = 15) @@ -529,10 +531,10 @@ CIGARETTE PACKETS ARE IN FANCY.DM STOP_PROCESSING(SSobj, src) . = ..() -/obj/item/clothing/mask/cigarette/pipe/process() +/obj/item/clothing/mask/cigarette/pipe/process(delta_time) var/turf/location = get_turf(src) - smoketime-- - if(smoketime < 1) + smoketime -= delta_time + if(smoketime <= 0) new /obj/effect/decal/cleanable/ash(location) if(ismob(loc)) var/mob/living/M = loc @@ -556,7 +558,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM if(!packeditem) if(G.dry == 1) to_chat(user, "You stuff [O] into [src].") - smoketime = 400 + smoketime = 13 * 60 packeditem = TRUE name = "[O.name]-packed [initial(name)]" if(O.reagents) @@ -849,6 +851,8 @@ CIGARETTE PACKETS ARE IN FANCY.DM w_class = WEIGHT_CLASS_TINY var/chem_volume = 100 var/vapetime = 0 //this so it won't puff out clouds every tick + /// How often we take a drag in seconds + var/vapedelay = 8 var/screw = FALSE // kinky var/super = FALSE //for the fattest vapes dude. @@ -962,13 +966,13 @@ CIGARETTE PACKETS ARE IN FANCY.DM return reagents.remove_any(REAGENTS_METABOLISM) -/obj/item/clothing/mask/vape/process() +/obj/item/clothing/mask/vape/process(delta_time) var/mob/living/M = loc if(isliving(loc)) M.IgniteMob() - vapetime++ + vapetime += delta_time if(!reagents.total_volume) if(ismob(loc)) @@ -978,17 +982,17 @@ CIGARETTE PACKETS ARE IN FANCY.DM return //open flame removed because vapes are a closed system, they won't light anything on fire - if(super && vapetime > 3)//Time to start puffing those fat vapes, yo. + if(super && vapetime >= vapedelay)//Time to start puffing those fat vapes, yo. var/datum/effect_system/smoke_spread/chem/smoke_machine/s = new s.set_up(reagents, 1, 24, loc) s.start() - vapetime = 0 + vapetime -= vapedelay - if((obj_flags & EMAGGED) && vapetime > 3) + if((obj_flags & EMAGGED) && vapetime >= vapedelay) var/datum/effect_system/smoke_spread/chem/smoke_machine/s = new s.set_up(reagents, 4, 24, loc) s.start() - vapetime = 0 + vapetime -= vapedelay if(prob(5))//small chance for the vape to break and deal damage if it's emagged playsound(get_turf(src), 'sound/effects/pop_expl.ogg', 50, FALSE) M.apply_damage(20, BURN, BODY_ZONE_HEAD) diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index dab651bd5f4..485cb54cbc1 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -270,6 +270,7 @@ inhand_icon_state = "flare" worn_icon_state = "flare" actions_types = list() + /// How many seconds of fuel we have left var/fuel = 0 var/on_damage = 7 var/produce_heat = 1500 @@ -279,12 +280,12 @@ /obj/item/flashlight/flare/Initialize() . = ..() - fuel = rand(800, 1000) // Sorry for changing this so much but I keep under-estimating how long X number of ticks last in seconds. + fuel = rand(1600, 2000) -/obj/item/flashlight/flare/process() +/obj/item/flashlight/flare/process(delta_time) open_flame(heat) - fuel = max(fuel - 1, 0) - if(!fuel || !on) + fuel = max(fuel -= delta_time, 0) + if(fuel <= 0 || !on) turn_off() if(!fuel) icon_state = "[initial(icon_state)]-empty" @@ -313,7 +314,7 @@ /obj/item/flashlight/flare/attack_self(mob/user) // Usual checks - if(!fuel) + if(fuel <= 0) to_chat(user, "[src] is out of fuel!") return if(on) @@ -386,7 +387,9 @@ /obj/item/flashlight/emp var/emp_max_charges = 4 var/emp_cur_charges = 4 - var/charge_tick = 0 + var/charge_timer = 0 + /// How many seconds between each recharge + var/charge_delay = 20 /obj/item/flashlight/emp/New() ..() @@ -396,11 +399,11 @@ STOP_PROCESSING(SSobj, src) . = ..() -/obj/item/flashlight/emp/process() - charge_tick++ - if(charge_tick < 10) +/obj/item/flashlight/emp/process(delta_time) + charge_timer += delta_time + if(charge_timer < charge_delay) return FALSE - charge_tick = 0 + charge_timer -= charge_delay emp_cur_charges = min(emp_cur_charges+1, emp_max_charges) return TRUE @@ -448,11 +451,12 @@ inhand_icon_state = "glowstick" worn_icon_state = "lightstick" grind_results = list(/datum/reagent/phenol = 15, /datum/reagent/hydrogen = 10, /datum/reagent/oxygen = 5) //Meth-in-a-stick + /// How many seconds of fuel we have left var/fuel = 0 /obj/item/flashlight/glowstick/Initialize() - fuel = rand(1600, 2000) + fuel = rand(3200, 4000) set_light_color(color) return ..() @@ -462,9 +466,9 @@ return ..() -/obj/item/flashlight/glowstick/process() - fuel = max(fuel - 1, 0) - if(!fuel) +/obj/item/flashlight/glowstick/process(delta_time) + fuel = max(fuel - delta_time, 0) + if(fuel <= 0) turn_off() STOP_PROCESSING(SSobj, src) update_icon() @@ -476,7 +480,7 @@ /obj/item/flashlight/glowstick/update_icon() inhand_icon_state = "glowstick" cut_overlays() - if(!fuel) + if(fuel <= 0) icon_state = "glowstick-empty" cut_overlays() set_light_on(FALSE) @@ -491,7 +495,7 @@ cut_overlays() /obj/item/flashlight/glowstick/attack_self(mob/user) - if(!fuel) + if(fuel <= 0) to_chat(user, "[src] is spent.") return if(on) diff --git a/code/game/objects/items/devices/forcefieldprojector.dm b/code/game/objects/items/devices/forcefieldprojector.dm index e245e7da11e..7a618fc1292 100644 --- a/code/game/objects/items/devices/forcefieldprojector.dm +++ b/code/game/objects/items/devices/forcefieldprojector.dm @@ -68,11 +68,11 @@ STOP_PROCESSING(SSobj, src) return ..() -/obj/item/forcefield_projector/process() +/obj/item/forcefield_projector/process(delta_time) if(!LAZYLEN(current_fields)) - shield_integrity = min(shield_integrity + 4, max_shield_integrity) + shield_integrity = min(shield_integrity + delta_time * 2, max_shield_integrity) else - shield_integrity = max(shield_integrity - LAZYLEN(current_fields), 0) //fields degrade slowly over time + shield_integrity = max(shield_integrity - LAZYLEN(current_fields) * delta_time * 0.5, 0) //fields degrade slowly over time for(var/obj/structure/projected_forcefield/F in current_fields) if(shield_integrity <= 0 || get_dist(F,src) > field_distance_limit) qdel(F) diff --git a/code/game/objects/items/devices/geiger_counter.dm b/code/game/objects/items/devices/geiger_counter.dm index 1425adc6041..e61ee532268 100644 --- a/code/game/objects/items/devices/geiger_counter.dm +++ b/code/game/objects/items/devices/geiger_counter.dm @@ -4,10 +4,6 @@ #define RAD_LEVEL_VERY_HIGH 800 #define RAD_LEVEL_CRITICAL 1500 -#define RAD_MEASURE_SMOOTHING 5 - -#define RAD_GRACE_PERIOD 2 - /obj/item/geiger_counter //DISCLAIMER: I know nothing about how real-life Geiger counters work. This will not be realistic. ~Xhuis name = "\improper Geiger counter" desc = "A handheld device used for detecting and measuring radiation pulses." @@ -21,7 +17,7 @@ item_flags = NOBLUDGEON custom_materials = list(/datum/material/iron = 150, /datum/material/glass = 150) - var/grace = RAD_GRACE_PERIOD + var/grace = RAD_GEIGER_GRACE_PERIOD var/datum/looping_sound/geiger/soundloop var/scanning = FALSE @@ -41,28 +37,24 @@ STOP_PROCESSING(SSobj, src) return ..() -/obj/item/geiger_counter/process() - update_icon() - update_sound() +/obj/item/geiger_counter/process(delta_time) + if(scanning) + radiation_count = LPFILTER(radiation_count, current_tick_amount, delta_time, RAD_GEIGER_RC) - if(!scanning) - current_tick_amount = 0 - return + if(current_tick_amount) + grace = RAD_GEIGER_GRACE_PERIOD + last_tick_amount = current_tick_amount - radiation_count -= radiation_count/RAD_MEASURE_SMOOTHING - radiation_count += current_tick_amount/RAD_MEASURE_SMOOTHING - - if(current_tick_amount) - grace = RAD_GRACE_PERIOD - last_tick_amount = current_tick_amount - - else if(!(obj_flags & EMAGGED)) - grace-- - if(grace <= 0) - radiation_count = 0 + else if(!(obj_flags & EMAGGED)) + grace -= delta_time + if(grace <= 0) + radiation_count = 0 current_tick_amount = 0 + update_icon() + update_sound() + /obj/item/geiger_counter/examine(mob/user) . = ..() if(!scanning) diff --git a/code/game/objects/items/devices/laserpointer.dm b/code/game/objects/items/devices/laserpointer.dm index e3d63dc60a9..44cb3c09154 100644 --- a/code/game/objects/items/devices/laserpointer.dm +++ b/code/game/objects/items/devices/laserpointer.dm @@ -187,11 +187,11 @@ flick_overlay_view(I, targloc, 10) icon_state = "pointer" -/obj/item/laser_pointer/process() +/obj/item/laser_pointer/process(delta_time) if(!diode) recharging = FALSE return PROCESS_KILL - if(prob(20 + diode.rating*20 - recharge_locked*2)) //t1 is 20, 2 40 + if(DT_PROB(10 + diode.rating*10 - recharge_locked*1, delta_time)) //t1 is 20, 2 40 energy += 1 if(energy >= max_energy) energy = max_energy diff --git a/code/game/objects/items/devices/reverse_bear_trap.dm b/code/game/objects/items/devices/reverse_bear_trap.dm index f51f90cd789..f172f899ed4 100644 --- a/code/game/objects/items/devices/reverse_bear_trap.dm +++ b/code/game/objects/items/devices/reverse_bear_trap.dm @@ -33,12 +33,12 @@ STOP_PROCESSING(SSprocessing, src) return ..() -/obj/item/reverse_bear_trap/process() +/obj/item/reverse_bear_trap/process(delta_time) if(!ticking) return - time_left-- + time_left -= delta_time soundloop2.mid_length = max(0.5, time_left - 5) //beepbeepbeepbeepbeep - if(!time_left || !isliving(loc)) + if(time_left <= 0 || !isliving(loc)) playsound(src, 'sound/machines/microwave/microwave-end.ogg', 100, FALSE) soundloop.stop() soundloop2.stop() diff --git a/code/game/objects/items/devices/traitordevices.dm b/code/game/objects/items/devices/traitordevices.dm index f92adab3ff7..7aaf063f6fa 100644 --- a/code/game/objects/items/devices/traitordevices.dm +++ b/code/game/objects/items/devices/traitordevices.dm @@ -232,7 +232,7 @@ effective or pretty fucking useless. if(user && user.get_item_by_slot(ITEM_SLOT_BELT) != src) Deactivate() -/obj/item/shadowcloak/process() +/obj/item/shadowcloak/process(delta_time) if(user.get_item_by_slot(ITEM_SLOT_BELT) != src) Deactivate() return @@ -240,9 +240,9 @@ effective or pretty fucking useless. if(on) var/lumcount = T.get_lumcount() if(lumcount > 0.3) - charge = max(0,charge - 25)//Quick decrease in light + charge = max(0, charge - 12.5 * delta_time)//Quick decrease in light else - charge = min(max_charge,charge + 50) //Charge in the dark + charge = min(max_charge, charge + 25 * delta_time) //Charge in the dark animate(user,alpha = clamp(255 - charge,0,255),time = 10) diff --git a/code/game/objects/items/granters.dm b/code/game/objects/items/granters.dm index a9d3473b52b..b82a7d6fc7e 100644 --- a/code/game/objects/items/granters.dm +++ b/code/game/objects/items/granters.dm @@ -245,7 +245,7 @@ ..() to_chat(user,"You suddenly feel very solid!") user.Stun(40, ignore_canstun = TRUE) - user.petrify(30) + user.petrify(60) /obj/item/book/granter/spell/knock spell = /obj/effect/proc_holder/spell/aoe_turf/knock diff --git a/code/game/objects/items/grenades/festive.dm b/code/game/objects/items/grenades/festive.dm index b69445c9af0..db8c2e7409c 100644 --- a/code/game/objects/items/grenades/festive.dm +++ b/code/game/objects/items/grenades/festive.dm @@ -7,7 +7,8 @@ icon_state = "sparkler" w_class = WEIGHT_CLASS_TINY heat = 1000 - var/burntime = 60 + /// Burn time in seconds + var/burntime = 120 var/lit = FALSE /obj/item/sparkler/fire_act(exposed_temperature, exposed_volume) @@ -38,9 +39,9 @@ playsound(src, 'sound/effects/fuse.ogg', 20, TRUE) update_icon() -/obj/item/sparkler/process() - burntime-- - if(burntime < 1) +/obj/item/sparkler/process(delta_time) + burntime -= delta_time + if(burntime <= 0) new /obj/item/stack/rods(drop_location()) qdel(src) else diff --git a/code/game/objects/items/his_grace.dm b/code/game/objects/items/his_grace.dm index c72ce45e969..f3286d74da8 100644 --- a/code/game/objects/items/his_grace.dm +++ b/code/game/objects/items/his_grace.dm @@ -75,14 +75,14 @@ user.forceMove(get_turf(src)) user.visible_message("[user] scrambles out of [src]!", "You climb out of [src]!") -/obj/item/his_grace/process() +/obj/item/his_grace/process(delta_time) if(!bloodthirst) drowse() return if(bloodthirst < HIS_GRACE_CONSUME_OWNER && !ascended) - adjust_bloodthirst(1 + FLOOR(LAZYLEN(contents) * 0.5, 1)) //Maybe adjust this? + adjust_bloodthirst((1 + FLOOR(LAZYLEN(contents) * 0.5, 1)) * delta_time) //Maybe adjust this? else - adjust_bloodthirst(1) //don't cool off rapidly once we're at the point where His Grace consumes all. + adjust_bloodthirst(1 * delta_time) //don't cool off rapidly once we're at the point where His Grace consumes all. var/mob/living/master = get_atom_on_turf(src, /mob/living) if(istype(master) && (src in master.held_items)) switch(bloodthirst) diff --git a/code/game/objects/items/mop.dm b/code/game/objects/items/mop.dm index 51b3af2c794..9b28a867703 100644 --- a/code/game/objects/items/mop.dm +++ b/code/game/objects/items/mop.dm @@ -91,7 +91,8 @@ throw_range = 4 mopspeed = 8 var/refill_enabled = TRUE //Self-refill toggle for when a janitor decides to mop with something other than water. - var/refill_rate = 1 //Rate per process() tick mop refills itself + /// Amount of reagent to refill per second + var/refill_rate = 0.5 var/refill_reagent = /datum/reagent/water //Determins what reagent to use for refilling, just in case someone wanted to make a HOLY MOP OF PURGING /obj/item/mop/advanced/New() @@ -107,10 +108,10 @@ to_chat(user, "You set the condenser switch to the '[refill_enabled ? "ON" : "OFF"]' position.") playsound(user, 'sound/machines/click.ogg', 30, TRUE) -/obj/item/mop/advanced/process() - - if(reagents.total_volume < mopcap) - reagents.add_reagent(refill_reagent, refill_rate) +/obj/item/mop/advanced/process(delta_time) + var/amadd = min(mopcap - reagents.total_volume, refill_rate * delta_time) + if(amadd > 0) + reagents.add_reagent(refill_reagent, amadd) /obj/item/mop/advanced/examine(mob/user) . = ..() diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm index 592c6385002..8de6efa9492 100644 --- a/code/game/objects/items/robot/robot_items.dm +++ b/code/game/objects/items/robot/robot_items.dm @@ -582,15 +582,18 @@ icon_state = "shield" var/maxenergy = 1500 var/energy = 1500 - var/energy_recharge = 7.5 + /// Recharging rate in energy per second + var/energy_recharge = 37.5 var/energy_recharge_cyborg_drain_coefficient = 0.4 var/cyborg_cell_critical_percentage = 0.05 var/mob/living/silicon/robot/host = null var/datum/proximity_monitor/advanced/dampening_field var/projectile_damage_coefficient = 0.5 - var/projectile_damage_tick_ecost_coefficient = 2 //Lasers get half their damage chopped off, drains 50 power/tick. Note that fields are processed 5 times per second. + /// Energy cost per tracked projectile damage amount per second + var/projectile_damage_tick_ecost_coefficient = 10 var/projectile_speed_coefficient = 1.5 //Higher the coefficient slower the projectile. - var/projectile_tick_speed_ecost = 15 + /// Energy cost per tracked projectile per second + var/projectile_tick_speed_ecost = 75 var/list/obj/projectile/tracked var/image/projectile_effect var/field_radius = 3 @@ -676,38 +679,38 @@ deactivate_field() . = ..() -/obj/item/borg/projectile_dampen/process() - process_recharge() - process_usage() +/obj/item/borg/projectile_dampen/process(delta_time) + process_recharge(delta_time) + process_usage(delta_time) update_location() /obj/item/borg/projectile_dampen/proc/update_location() if(dampening_field) dampening_field.HandleMove() -/obj/item/borg/projectile_dampen/proc/process_usage() +/obj/item/borg/projectile_dampen/proc/process_usage(delta_time) var/usage = 0 for(var/I in tracked) var/obj/projectile/P = I if(!P.stun && P.nodamage) //No damage continue - usage += projectile_tick_speed_ecost - usage += (tracked[I] * projectile_damage_tick_ecost_coefficient) + usage += projectile_tick_speed_ecost * delta_time + usage += tracked[I] * projectile_damage_tick_ecost_coefficient * delta_time energy = clamp(energy - usage, 0, maxenergy) if(energy <= 0) deactivate_field() visible_message("[src] blinks \"ENERGY DEPLETED\".") -/obj/item/borg/projectile_dampen/proc/process_recharge() +/obj/item/borg/projectile_dampen/proc/process_recharge(delta_time) if(!istype(host)) if(iscyborg(host.loc)) host = host.loc else - energy = clamp(energy + energy_recharge, 0, maxenergy) + energy = clamp(energy + energy_recharge * delta_time, 0, maxenergy) return if(host.cell && (host.cell.charge >= (host.cell.maxcharge * cyborg_cell_critical_percentage)) && (energy < maxenergy)) - host.cell.use(energy_recharge*energy_recharge_cyborg_drain_coefficient) - energy += energy_recharge + host.cell.use(energy_recharge * delta_time * energy_recharge_cyborg_drain_coefficient) + energy += energy_recharge * delta_time /obj/item/borg/projectile_dampen/proc/dampen_projectile(obj/projectile/P, track_projectile = TRUE) if(tracked[P]) diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index 00654738aba..51f554d527e 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -304,7 +304,10 @@ icon_state = "cyborg_upgrade5" require_module = 1 var/repair_amount = -1 - var/repair_tick = 1 + /// world.time of next repair + var/next_repair = 0 + /// Minimum time between repairs in seconds + var/repair_cooldown = 4 var/on = FALSE var/powercost = 10 var/datum/action/toggle_action @@ -354,8 +357,7 @@ update_icon() /obj/item/borg/upgrade/selfrepair/process() - if(!repair_tick) - repair_tick = 1 + if(world.time < next_repair) return var/mob/living/silicon/robot/cyborg = toggle_action.owner @@ -384,7 +386,7 @@ cyborg.cell.use(powercost) else cyborg.cell.use(5) - repair_tick = 0 + next_repair = world.time + repair_cooldown * 10 // Multiply by 10 since world.time is in deciseconds if(!TIMER_COOLDOWN_CHECK(src, COOLDOWN_BORG_SELF_REPAIR)) TIMER_COOLDOWN_START(src, COOLDOWN_BORG_SELF_REPAIR, 200 SECONDS) diff --git a/code/game/objects/items/storage/firstaid.dm b/code/game/objects/items/storage/firstaid.dm index 77c6b0c4fd8..4897158c0eb 100644 --- a/code/game/objects/items/storage/firstaid.dm +++ b/code/game/objects/items/storage/firstaid.dm @@ -560,17 +560,17 @@ RegisterSignal(src, COMSIG_TRY_STORAGE_TAKE, .proc/unfreeze) START_PROCESSING(SSobj, src) -/obj/item/storage/organbox/process() +/obj/item/storage/organbox/process(delta_time) ///if there is enough coolant var var/cool = FALSE - var/amount = reagents.get_reagent_amount(/datum/reagent/cryostylane) - if(amount >= 0.1) - reagents.remove_reagent(/datum/reagent/cryostylane, 0.1) + var/amount = min(reagents.get_reagent_amount(/datum/reagent/cryostylane), 0.05 * delta_time) + if(amount > 0) + reagents.remove_reagent(/datum/reagent/cryostylane, amount) cool = TRUE else - amount = reagents.get_reagent_amount(/datum/reagent/consumable/ice) - if(amount >= 0.3) - reagents.remove_reagent(/datum/reagent/consumable/ice, 0.2) + amount = min(reagents.get_reagent_amount(/datum/reagent/consumable/ice), 0.1 * delta_time) + if(amount > 0) + reagents.remove_reagent(/datum/reagent/consumable/ice, amount) cool = TRUE if(!cooling && cool) cooling = TRUE diff --git a/code/game/objects/items/tanks/watertank.dm b/code/game/objects/items/tanks/watertank.dm index b33ea6bf97f..5b8ac9ed9eb 100644 --- a/code/game/objects/items/tanks/watertank.dm +++ b/code/game/objects/items/tanks/watertank.dm @@ -348,7 +348,8 @@ var/on = FALSE volume = 300 var/usage_ratio = 5 //5 unit added per 1 removed - var/injection_amount = 1 + /// How much to inject per second + var/injection_amount = 0.5 amount_per_transfer_from_this = 5 reagent_flags = OPENCONTAINER spillable = FALSE @@ -406,7 +407,7 @@ if(ismob(loc)) to_chat(loc, "[src] turns off.") -/obj/item/reagent_containers/chemtank/process() +/obj/item/reagent_containers/chemtank/process(delta_time) if(!ishuman(loc)) turn_off() return @@ -418,8 +419,9 @@ turn_off() return - var/used_amount = injection_amount/usage_ratio - reagents.trans_to(user,used_amount,multiplier=usage_ratio, methods = INJECT) + var/inj_am = injection_amount * delta_time + var/used_amount = inj_am / usage_ratio + reagents.trans_to(user, used_amount, multiplier=usage_ratio, methods = INJECT) update_icon() user.update_inv_back() //for overlays update diff --git a/code/game/objects/items/tools/weldingtool.dm b/code/game/objects/items/tools/weldingtool.dm index a200e63a17b..8edfca40aa5 100644 --- a/code/game/objects/items/tools/weldingtool.dm +++ b/code/game/objects/items/tools/weldingtool.dm @@ -1,4 +1,5 @@ -#define WELDER_FUEL_BURN_INTERVAL 13 +/// How many seconds between each fuel depletion tick ("use" proc) +#define WELDER_FUEL_BURN_INTERVAL 26 /obj/item/weldingtool name = "welding tool" desc = "A standard edition welder provided by Nanotrasen." @@ -70,7 +71,7 @@ . += "[initial(icon_state)]-on" -/obj/item/weldingtool/process() +/obj/item/weldingtool/process(delta_time) switch(welding) if(0) force = 3 @@ -83,7 +84,7 @@ if(1) force = 15 damtype = BURN - ++burned_fuel_for + burned_fuel_for += delta_time if(burned_fuel_for >= WELDER_FUEL_BURN_INTERVAL) use(1) update_icon() @@ -188,8 +189,9 @@ if(!isOn() || !check_fuel()) return FALSE - if(used) + if(used > 0) burned_fuel_for = 0 + if(get_fuel() >= used) reagents.remove_reagent(/datum/reagent/fuel, used) check_fuel() diff --git a/code/game/objects/structures/fireplace.dm b/code/game/objects/structures/fireplace.dm index e761ae2dbc4..23db4e2d89b 100644 --- a/code/game/objects/structures/fireplace.dm +++ b/code/game/objects/structures/fireplace.dm @@ -102,7 +102,7 @@ if(2000 to MAXIMUM_BURN_TIMER) set_light(6) -/obj/structure/fireplace/process() +/obj/structure/fireplace/process(delta_time) if(!lit) return if(world.time > flame_expiry_timer) @@ -111,7 +111,7 @@ playsound(src, 'sound/effects/comfyfire.ogg',50,FALSE, FALSE, TRUE) var/turf/T = get_turf(src) - T.hotspot_expose(700, 5) + T.hotspot_expose(700, 2.5 * delta_time) update_icon() adjust_light() diff --git a/code/game/objects/structures/petrified_statue.dm b/code/game/objects/structures/petrified_statue.dm index fa30cb34eb7..2472a9c8602 100644 --- a/code/game/objects/structures/petrified_statue.dm +++ b/code/game/objects/structures/petrified_statue.dm @@ -5,7 +5,7 @@ density = TRUE anchored = TRUE max_integrity = 200 - var/timer = 240 //eventually the person will be freed + var/timer = 480 //eventually the person will be freed var/mob/living/petrified_mob /obj/structure/statue/petrified/New(loc, mob/living/L, statue_timer) @@ -25,10 +25,10 @@ START_PROCESSING(SSobj, src) ..() -/obj/structure/statue/petrified/process() +/obj/structure/statue/petrified/process(delta_time) if(!petrified_mob) STOP_PROCESSING(SSobj, src) - timer-- + timer -= delta_time petrified_mob.Stun(40) //So they can't do anything while petrified if(timer <= 0) STOP_PROCESSING(SSobj, src) diff --git a/code/game/objects/structures/shower.dm b/code/game/objects/structures/shower.dm index 9d4c181238f..3bcda940858 100644 --- a/code/game/objects/structures/shower.dm +++ b/code/game/objects/structures/shower.dm @@ -50,7 +50,7 @@ add_fingerprint(M) if(on) START_PROCESSING(SSmachines, src) - process() + process(SSMACHINES_DT) soundloop.start() else soundloop.stop() diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index 5317efdf3d4..3f71f0bf26f 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -419,7 +419,7 @@ if(!reclaiming) reclaiming = TRUE START_PROCESSING(SSfluids, src) - process() + process(SSFLUIDS_DT) /obj/structure/sink/kitchen name = "kitchen sink" diff --git a/code/game/turfs/open/lava.dm b/code/game/turfs/open/lava.dm index f294b7d915c..de38da24bba 100644 --- a/code/game/turfs/open/lava.dm +++ b/code/game/turfs/open/lava.dm @@ -53,8 +53,8 @@ if(burn_stuff(AM)) START_PROCESSING(SSobj, src) -/turf/open/lava/process() - if(!burn_stuff()) +/turf/open/lava/process(delta_time) + if(!burn_stuff(null, delta_time)) STOP_PROCESSING(SSobj, src) /turf/open/lava/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd) @@ -116,7 +116,7 @@ return LAZYLEN(found_safeties) -/turf/open/lava/proc/burn_stuff(AM) +/turf/open/lava/proc/burn_stuff(AM, delta_time = 1) . = 0 if(is_safe()) @@ -139,7 +139,7 @@ O.resistance_flags &= ~FIRE_PROOF if(O.armor.fire > 50) //obj with 100% fire armor still get slowly burned away. O.armor = O.armor.setRating(fire = 50) - O.fire_act(10000, 1000) + O.fire_act(10000, 1000 * delta_time) else if (isliving(thing)) . = 1 @@ -172,9 +172,9 @@ ADD_TRAIT(L, TRAIT_PERMANENTLY_ONFIRE,TURF_TRAIT) L.update_fire() - L.adjustFireLoss(20) + L.adjustFireLoss(20 * delta_time) if(L) //mobs turning into object corpses could get deleted here. - L.adjust_fire_stacks(20) + L.adjust_fire_stacks(20 * delta_time) L.IgniteMob() /turf/open/lava/smooth diff --git a/code/modules/NTNet/relays.dm b/code/modules/NTNet/relays.dm index dc3a1876997..c6c01394386 100644 --- a/code/modules/NTNet/relays.dm +++ b/code/modules/NTNet/relays.dm @@ -22,7 +22,7 @@ // Denial of Service attack variables var/dos_overload = 0 // Amount of DoS "packets" in this relay's buffer var/dos_capacity = 500 // Amount of DoS "packets" in buffer required to crash the relay - var/dos_dissipate = 1 // Amount of DoS "packets" dissipated over time. + var/dos_dissipate = 0.5 // Amount of DoS "packets" dissipated over time. ///Proc called to change the value of the `relay_enabled` variable and append behavior related to its change. @@ -64,7 +64,7 @@ else icon_state = "bus_off" -/obj/machinery/ntnet_relay/process() +/obj/machinery/ntnet_relay/process(delta_time) if(is_operational) use_power = ACTIVE_POWER_USE else @@ -72,8 +72,8 @@ update_icon() - if(dos_overload) - dos_overload = max(0, dos_overload - dos_dissipate) + if(dos_overload > 0) + dos_overload = max(0, dos_overload - dos_dissipate * delta_time) // If DoS traffic exceeded capacity, crash. if((dos_overload > dos_capacity) && !dos_failure) diff --git a/code/modules/antagonists/abductor/equipment/abduction_gear.dm b/code/modules/antagonists/abductor/equipment/abduction_gear.dm index 0523b095fd7..067962f3b09 100644 --- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm +++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm @@ -24,7 +24,8 @@ ) var/mode = VEST_STEALTH var/stealth_active = FALSE - var/combat_cooldown = 10 + /// Cooldown in seconds + var/combat_cooldown = 20 var/datum/icon_snapshot/disguise var/stealth_armor = list(MELEE = 15, BULLET = 15, LASER = 15, ENERGY = 25, BOMB = 15, BIO = 15, RAD = 15, FIRE = 70, ACID = 70) var/combat_armor = list(MELEE = 50, BULLET = 50, LASER = 50, ENERGY = 50, BOMB = 50, BIO = 50, RAD = 50, FIRE = 90, ACID = 90) @@ -110,7 +111,7 @@ /obj/item/clothing/suit/armor/abductor/vest/proc/Adrenaline() if(ishuman(loc)) - if(combat_cooldown != initial(combat_cooldown)) + if(combat_cooldown < initial(combat_cooldown)) to_chat(loc, "Combat injection is still recharging.") return var/mob/living/carbon/human/M = loc @@ -123,9 +124,9 @@ combat_cooldown = 0 START_PROCESSING(SSobj, src) -/obj/item/clothing/suit/armor/abductor/vest/process() - combat_cooldown++ - if(combat_cooldown==initial(combat_cooldown)) +/obj/item/clothing/suit/armor/abductor/vest/process(delta_time) + combat_cooldown += delta_time + if(combat_cooldown >= initial(combat_cooldown)) STOP_PROCESSING(SSobj, src) /obj/item/clothing/suit/armor/abductor/Destroy() @@ -830,6 +831,8 @@ Congratulations! You are now trained for invasive xenobiology research!"} icon = 'icons/obj/abductor.dmi' icon_state = "bed" can_buckle = 1 + /// Amount to inject per second + var/inject_am = 0.5 var/static/list/injected_reagents = list(/datum/reagent/medicine/cordiolis_hepatico) @@ -839,13 +842,13 @@ Congratulations! You are now trained for invasive xenobiology research!"} START_PROCESSING(SSobj, src) to_chat(AM, "You feel a series of tiny pricks!") -/obj/structure/table/optable/abductor/process() +/obj/structure/table/optable/abductor/process(delta_time) . = PROCESS_KILL for(var/mob/living/carbon/C in get_turf(src)) . = TRUE for(var/chemical in injected_reagents) - if(C.reagents.get_reagent_amount(chemical) < 1) - C.reagents.add_reagent(chemical, 1) + if(C.reagents.get_reagent_amount(chemical) < inject_am * delta_time) + C.reagents.add_reagent(chemical, inject_am * delta_time) /obj/structure/table/optable/abductor/Destroy() STOP_PROCESSING(SSobj, src) diff --git a/code/modules/antagonists/blob/structures/core.dm b/code/modules/antagonists/blob/structures/core.dm index 28226e9f58a..6bdc03fb678 100644 --- a/code/modules/antagonists/blob/structures/core.dm +++ b/code/modules/antagonists/blob/structures/core.dm @@ -52,7 +52,7 @@ if(overmind) //we should have an overmind, but... overmind.update_health_hud() -/obj/structure/blob/core/process() +/obj/structure/blob/core/process(delta_time) if(QDELETED(src)) return if(!overmind) @@ -62,7 +62,7 @@ overmind.update_health_hud() Pulse_Area(overmind, 12, 4, 3) for(var/obj/structure/blob/normal/B in range(1, src)) - if(prob(5)) + if(DT_PROB(2.5, delta_time)) B.change_to(/obj/structure/blob/shield/core, overmind) ..() diff --git a/code/modules/antagonists/changeling/powers/mutations.dm b/code/modules/antagonists/changeling/powers/mutations.dm index 97be416f04f..382ac5c819f 100644 --- a/code/modules/antagonists/changeling/powers/mutations.dm +++ b/code/modules/antagonists/changeling/powers/mutations.dm @@ -493,10 +493,10 @@ /obj/item/clothing/suit/space/changeling/toggle_spacesuit_cell(mob/user) return -/obj/item/clothing/suit/space/changeling/process() +/obj/item/clothing/suit/space/changeling/process(delta_time) if(ishuman(loc)) var/mob/living/carbon/human/H = loc - H.reagents.add_reagent(/datum/reagent/medicine/salbutamol, REAGENTS_METABOLISM) + H.reagents.add_reagent(/datum/reagent/medicine/salbutamol, REAGENTS_METABOLISM * (delta_time / SSMOBS_DT)) H.adjust_bodytemperature(temperature_setting - H.bodytemperature) // force changelings to normal temp step mode played badly /obj/item/clothing/head/helmet/space/changeling diff --git a/code/modules/antagonists/eldritch_cult/eldritch_antag.dm b/code/modules/antagonists/eldritch_cult/eldritch_antag.dm index 551d4218e0a..abb84a14961 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_antag.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_antag.dm @@ -214,9 +214,9 @@ name = "spendtime" var/timer = 5 MINUTES -/datum/objective/stalk/process() +/datum/objective/stalk/process(delta_time) if(owner?.current.stat != DEAD && target?.current.stat != DEAD && (target in view(5,owner.current))) - timer -= 1 SECONDS + timer -= delta_time * 10 // timer is in deciseconds ///we don't want to process after the counter reaches 0, otherwise it is wasted processing if(timer <= 0) STOP_PROCESSING(SSprocessing,src) diff --git a/code/modules/antagonists/eldritch_cult/eldritch_magic.dm b/code/modules/antagonists/eldritch_cult/eldritch_magic.dm index f83f4efbd08..f745cd7107f 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_magic.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_magic.dm @@ -450,15 +450,15 @@ /obj/effect/proc_holder/spell/targeted/fire_sworn/proc/remove() has_fire_ring = FALSE -/obj/effect/proc_holder/spell/targeted/fire_sworn/process() +/obj/effect/proc_holder/spell/targeted/fire_sworn/process(delta_time) . = ..() if(!has_fire_ring) return for(var/turf/T in range(1,current_user)) new /obj/effect/hotspot(T) - T.hotspot_expose(700,50,1) + T.hotspot_expose(700, 250 * delta_time, 1) for(var/mob/living/livies in T.contents - current_user) - livies.adjustFireLoss(5) + livies.adjustFireLoss(25 * delta_time) /obj/effect/proc_holder/spell/targeted/worm_contract diff --git a/code/modules/antagonists/eldritch_cult/knowledge/rust_lore.dm b/code/modules/antagonists/eldritch_cult/knowledge/rust_lore.dm index a3a34ee7442..bc2b7f0cb92 100644 --- a/code/modules/antagonists/eldritch_cult/knowledge/rust_lore.dm +++ b/code/modules/antagonists/eldritch_cult/knowledge/rust_lore.dm @@ -161,7 +161,7 @@ var/list/turfs = list() var/turf/centre var/static/list/blacklisted_turfs = typecacheof(list(/turf/open/indestructible,/turf/closed/indestructible,/turf/open/space,/turf/open/lava,/turf/open/chasm)) - var/spread_per_tick = 6 + var/spread_per_sec = 6 /datum/rust_spread/New(loc) @@ -175,13 +175,14 @@ STOP_PROCESSING(SSprocessing,src) return ..() -/datum/rust_spread/process() +/datum/rust_spread/process(delta_time) + var/spread_am = round(spread_per_sec * delta_time) - if(edge_turfs.len < spread_per_tick) + if(edge_turfs.len < spread_am) compile_turfs() var/turf/T - for(var/i in 0 to spread_per_tick) + for(var/i in 0 to spread_am) if(!edge_turfs.len) continue T = pick(edge_turfs) diff --git a/code/modules/assembly/proximity.dm b/code/modules/assembly/proximity.dm index 1fe05770f55..d37165cfd09 100644 --- a/code/modules/assembly/proximity.dm +++ b/code/modules/assembly/proximity.dm @@ -8,7 +8,7 @@ pickup_sound = 'sound/items/handling/component_pickup.ogg' var/scanning = FALSE var/timing = FALSE - var/time = 10 + var/time = 20 var/sensitivity = 1 var/hearing_range = 3 @@ -73,10 +73,10 @@ next_activate = world.time + 30 return TRUE -/obj/item/assembly/prox_sensor/process() +/obj/item/assembly/prox_sensor/process(delta_time) if(!timing) return - time-- + time -= delta_time if(time <= 0) timing = FALSE toggle_scan(TRUE) diff --git a/code/modules/assembly/timer.dm b/code/modules/assembly/timer.dm index 4f8bea6900d..44753d83e2c 100644 --- a/code/modules/assembly/timer.dm +++ b/code/modules/assembly/timer.dm @@ -8,15 +8,15 @@ pickup_sound = 'sound/items/handling/component_pickup.ogg' var/timing = FALSE - var/time = 5 - var/saved_time = 5 + var/time = 10 + var/saved_time = 10 var/loop = FALSE var/hearing_range = 3 /obj/item/assembly/timer/suicide_act(mob/living/user) user.visible_message("[user] looks at the timer and decides [user.p_their()] fate! It looks like [user.p_theyre()] going to commit suicide!") activate()//doesnt rely on timer_end to prevent weird metas where one person can control the timer and therefore someone's life. (maybe that should be how it works...) - addtimer(CALLBACK(src, .proc/manual_suicide, user), time*10)//kill yourself once the time runs out + addtimer(CALLBACK(src, .proc/manual_suicide, user), time SECONDS)//kill yourself once the time runs out return MANUAL_SUICIDE /obj/item/assembly/timer/proc/manual_suicide(mob/living/user) @@ -66,10 +66,10 @@ timing = TRUE update_icon() -/obj/item/assembly/timer/process() +/obj/item/assembly/timer/process(delta_time) if(!timing) return - time-- + time -= delta_time if(time <= 0) timing = FALSE timer_end() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm index 31de8b18e94..c82b35c7dfb 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm @@ -49,7 +49,7 @@ /obj/machinery/atmospherics/components/binary/volume_pump/update_icon_nopipes() icon_state = on && is_operational ? "volpump_on-[set_overlay_offset(piping_layer)]" : "volpump_off-[set_overlay_offset(piping_layer)]" -/obj/machinery/atmospherics/components/binary/volume_pump/process_atmos() +/obj/machinery/atmospherics/components/binary/volume_pump/process_atmos(delta_time) // ..() if(!on || !is_operational) return @@ -69,14 +69,14 @@ return - var/transfer_ratio = transfer_rate/air1.volume + var/transfer_ratio = (transfer_rate * delta_time) / air1.volume var/datum/gas_mixture/removed = air1.remove_ratio(transfer_ratio) if(overclocked)//Some of the gas from the mixture leaks to the environment when overclocked var/turf/open/T = loc if(istype(T)) - var/datum/gas_mixture/leaked = removed.remove_ratio(VOLUME_PUMP_LEAK_AMOUNT) + var/datum/gas_mixture/leaked = removed.remove_ratio(DT_PROB_RATE(VOLUME_PUMP_LEAK_AMOUNT, delta_time)) T.assume_air(leaked) T.air_update_turf() diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm index 2539aa83fbf..3788dba15e6 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm @@ -59,7 +59,7 @@ var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational icon_state = "filter_[on_state ? "on" : "off"]-[set_overlay_offset(piping_layer)][flipped ? "_f" : ""]" -/obj/machinery/atmospherics/components/trinary/filter/process_atmos() +/obj/machinery/atmospherics/components/trinary/filter/process_atmos(delta_time) ..() if(!on || !(nodes[1] && nodes[2] && nodes[3]) || !is_operational) return @@ -78,7 +78,7 @@ //No need to transfer if target is already full! return - var/transfer_ratio = transfer_rate/air1.volume + var/transfer_ratio = (transfer_rate * delta_time) / air1.volume //Actually transfer the gas diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index db3196ee4a2..4261928f87d 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -197,7 +197,7 @@ begin_processing() -/obj/machinery/atmospherics/components/unary/cryo_cell/process() +/obj/machinery/atmospherics/components/unary/cryo_cell/process(delta_time) ..() if(!on) @@ -239,19 +239,20 @@ if(air1.gases.len) if(mob_occupant.bodytemperature < T0C) // Sleepytime. Why? More cryo magic. - mob_occupant.Sleeping((mob_occupant.bodytemperature * sleep_factor) * 2000) - mob_occupant.Unconscious((mob_occupant.bodytemperature * unconscious_factor) * 2000) + mob_occupant.Sleeping((mob_occupant.bodytemperature * sleep_factor) * 1000 * delta_time) + mob_occupant.Unconscious((mob_occupant.bodytemperature * unconscious_factor) * 1000 * delta_time) if(beaker) if(reagent_transfer == 0) // Magically transfer reagents. Because cryo magic. - beaker.reagents.trans_to(occupant, 1, efficiency * 25, methods = VAPOR) // Transfer reagents. - air1.gases[/datum/gas/oxygen][MOLES] -= max(0,air1.gases[/datum/gas/oxygen][MOLES] - 2 / efficiency) //Let's use gas for this + beaker.reagents.trans_to(occupant, 1, efficiency * 12.5 * delta_time, methods = VAPOR) // Transfer reagents. + air1.gases[/datum/gas/oxygen][MOLES] -= max(0, air1.gases[/datum/gas/oxygen][MOLES] - delta_time / efficiency) //Let's use gas for this air1.garbage_collect() - if(++reagent_transfer >= 10 * efficiency) // Throttle reagent transfer (higher efficiency will transfer the same amount but consume less from the beaker). + reagent_transfer += 0.5 * delta_time + if(reagent_transfer >= 10 * efficiency) // Throttle reagent transfer (higher efficiency will transfer the same amount but consume less from the beaker). reagent_transfer = 0 return 1 -/obj/machinery/atmospherics/components/unary/cryo_cell/process_atmos() +/obj/machinery/atmospherics/components/unary/cryo_cell/process_atmos(delta_time) ..() if(!on) @@ -278,8 +279,8 @@ var/heat = ((1 - cold_protection) * 0.1 + conduction_coefficient) * temperature_delta * (air_heat_capacity * heat_capacity / (air_heat_capacity + heat_capacity)) - air1.temperature = clamp(air1.temperature - heat / air_heat_capacity, TCMB, MAX_TEMPERATURE) - mob_occupant.adjust_bodytemperature(heat / heat_capacity, TCMB) + air1.temperature = clamp(air1.temperature - heat * delta_time / air_heat_capacity, TCMB, MAX_TEMPERATURE) + mob_occupant.adjust_bodytemperature(heat * delta_time / heat_capacity, TCMB) air1.gases[/datum/gas/oxygen][MOLES] = max(0,air1.gases[/datum/gas/oxygen][MOLES] - 0.5 / efficiency) // Magically consume gas? Why not, we run on cryo magic. air1.garbage_collect() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm index 8811fc2d818..75901061a02 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm @@ -13,7 +13,7 @@ var/injecting = 0 - var/volume_rate = 50 + var/volume_rate = 100 var/frequency = 0 var/id = null @@ -52,7 +52,7 @@ else icon_state = "inje_on" -/obj/machinery/atmospherics/components/unary/outlet_injector/process_atmos() +/obj/machinery/atmospherics/components/unary/outlet_injector/process_atmos(delta_time) ..() injecting = 0 @@ -63,7 +63,7 @@ var/datum/gas_mixture/air_contents = airs[1] if(air_contents.temperature > 0) - var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION) + var/transfer_moles = air_contents.return_pressure() * volume_rate * delta_time / (air_contents.temperature * R_IDEAL_GAS_EQUATION) var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) @@ -82,7 +82,7 @@ injecting = 1 if(air_contents.temperature > 0) - var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.temperature * R_IDEAL_GAS_EQUATION) + var/transfer_moles = air_contents.return_pressure() * volume_rate / (air_contents.temperature * R_IDEAL_GAS_EQUATION) var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) loc.assume_air(removed) update_parents() @@ -207,7 +207,7 @@ /obj/machinery/atmospherics/components/unary/outlet_injector/atmos frequency = FREQ_ATMOS_STORAGE on = TRUE - volume_rate = 200 + volume_rate = 400 /obj/machinery/atmospherics/components/unary/outlet_injector/atmos/atmos_waste name = "atmos waste outlet injector" diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm index ba0d0822893..2001629b948 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm @@ -19,7 +19,7 @@ var/scrubbing = SCRUBBING //0 = siphoning, 1 = scrubbing var/filter_types = list(/datum/gas/carbon_dioxide) - var/volume_rate = 200 + var/volume_rate = 400 var/widenet = 0 //is this scrubber acting on the 3x3 area around it. var/list/turf/adjacent_turfs = list() @@ -138,32 +138,32 @@ check_turfs() ..() -/obj/machinery/atmospherics/components/unary/vent_scrubber/process_atmos() +/obj/machinery/atmospherics/components/unary/vent_scrubber/process_atmos(delta_time) ..() if(welded || !is_operational) return FALSE if(!nodes[1] || !on) on = FALSE return FALSE - scrub(loc) + scrub(loc, delta_time) if(widenet) for(var/turf/tile in adjacent_turfs) - scrub(tile) + scrub(tile, delta_time) return TRUE -/obj/machinery/atmospherics/components/unary/vent_scrubber/proc/scrub(turf/tile) +/obj/machinery/atmospherics/components/unary/vent_scrubber/proc/scrub(turf/tile, delta_time = 0.5) if(!istype(tile)) return FALSE var/datum/gas_mixture/environment = tile.return_air() var/datum/gas_mixture/air_contents = airs[1] var/list/env_gases = environment.gases - if(air_contents.return_pressure() >= 50*ONE_ATMOSPHERE) + if(air_contents.return_pressure() >= 50 * ONE_ATMOSPHERE) return FALSE if(scrubbing & SCRUBBING) if(length(env_gases & filter_types)) - var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles() + var/transfer_moles = min(1, volume_rate * delta_time / environment.volume)*environment.total_moles() //Take a gas sample var/datum/gas_mixture/removed = tile.remove_air(transfer_moles) @@ -193,7 +193,7 @@ else //Just siphoning all air - var/transfer_moles = environment.total_moles()*(volume_rate/environment.volume) + var/transfer_moles = environment.total_moles() * (volume_rate * delta_time / environment.volume) var/datum/gas_mixture/removed = tile.remove_air(transfer_moles) diff --git a/code/modules/atmospherics/machinery/other/miner.dm b/code/modules/atmospherics/machinery/other/miner.dm index a53984f1e06..76489060a3a 100644 --- a/code/modules/atmospherics/machinery/other/miner.dm +++ b/code/modules/atmospherics/machinery/other/miner.dm @@ -14,7 +14,8 @@ resistance_flags = INDESTRUCTIBLE|ACID_PROOF|FIRE_PROOF var/spawn_id = null var/spawn_temp = T20C - var/spawn_mol = MOLES_CELLSTANDARD * 10 + /// Moles of gas to spawn per second + var/spawn_mol = MOLES_CELLSTANDARD * 5 var/max_ext_mol = INFINITY var/max_ext_kpa = 6500 var/overlay_color = "#FFFFFF" @@ -117,22 +118,22 @@ on_overlay.color = overlay_color . += on_overlay -/obj/machinery/atmospherics/miner/process() +/obj/machinery/atmospherics/miner/process(delta_time) update_power() check_operation() if(active && !broken) if(isnull(spawn_id)) return FALSE if(do_use_power(active_power_usage)) - mine_gas() + mine_gas(delta_time) -/obj/machinery/atmospherics/miner/proc/mine_gas() +/obj/machinery/atmospherics/miner/proc/mine_gas(delta_time = 2) var/turf/open/O = get_turf(src) if(!isopenturf(O)) return FALSE var/datum/gas_mixture/merger = new merger.assert_gas(spawn_id) - merger.gases[spawn_id][MOLES] = (spawn_mol) + merger.gases[spawn_id][MOLES] = spawn_mol * delta_time merger.temperature = spawn_temp O.assume_air(merger) O.air_update_turf(TRUE) diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm index 2fd2da1a24a..5520b640b7e 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm @@ -49,7 +49,7 @@ L.bodytemperature = avg_temp pipe_air.temperature = avg_temp -/obj/machinery/atmospherics/pipe/heat_exchanging/process() +/obj/machinery/atmospherics/pipe/heat_exchanging/process(delta_time) if(!parent) return //machines subsystem fires before atmos is initialized so this prevents race condition runtimes @@ -78,4 +78,4 @@ if(pipe_air.temperature > heat_limit + 1) for(var/m in buckled_mobs) var/mob/living/buckled_mob = m - buckled_mob.apply_damage(4 * log(pipe_air.temperature - heat_limit), BURN, BODY_ZONE_CHEST) + buckled_mob.apply_damage(delta_time * 2 * log(pipe_air.temperature - heat_limit), BURN, BODY_ZONE_CHEST) diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index 0b0711390c4..7749bae169b 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -391,7 +391,7 @@ else if(valve_open && holding) investigate_log("[key_name(user)] started a transfer into [holding].", INVESTIGATE_ATMOS) -/obj/machinery/portable_atmospherics/canister/process_atmos() +/obj/machinery/portable_atmospherics/canister/process_atmos(delta_time) ..() if(machine_stat & BROKEN) return PROCESS_KILL @@ -412,7 +412,7 @@ ///function used to check the limit of the canisters and also set the amount of damage that the canister can receive, if the heat and pressure are way higher than the limit the more damage will be done if(our_temperature > heat_limit || our_pressure > pressure_limit) - take_damage(clamp((our_temperature/heat_limit) * (our_pressure/pressure_limit), 5, 50), BURN, 0) + take_damage(clamp((our_temperature/heat_limit) * (our_pressure/pressure_limit) * delta_time * 2, 5, 50), BURN, 0) update_icon() /obj/machinery/portable_atmospherics/canister/ui_state(mob/user) diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm index d20e3c2392d..9657ea3642f 100644 --- a/code/modules/atmospherics/machinery/portable/pump.dm +++ b/code/modules/atmospherics/machinery/portable/pump.dm @@ -37,14 +37,14 @@ if(connected_port) . += "siphon-connector" -/obj/machinery/portable_atmospherics/pump/process_atmos() +/obj/machinery/portable_atmospherics/pump/process_atmos(delta_time) ..() var/pressure = air_contents.return_pressure() var/temperature = air_contents.return_temperature() ///function used to check the limit of the pumps and also set the amount of damage that the pump can receive, if the heat and pressure are way higher than the limit the more damage will be done if(temperature > heat_limit || pressure > pressure_limit) - take_damage(clamp((temperature/heat_limit) * (pressure/pressure_limit), 5, 50), BURN, 0) + take_damage(clamp((temperature/heat_limit) * (pressure/pressure_limit) * delta_time * 0.5, 5, 50), BURN, 0) return if(!on) diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm index fd56cc667e9..cc10b743a98 100644 --- a/code/modules/atmospherics/machinery/portable/scrubber.dm +++ b/code/modules/atmospherics/machinery/portable/scrubber.dm @@ -10,7 +10,7 @@ ///Max amount of pressure allowed inside of the canister before it starts to break (different tiers have different limits) var/pressure_limit = 50000 var/on = FALSE - var/volume_rate = 1000 + var/volume_rate = 500 var/overpressure_m = 80 var/use_overlays = TRUE var/list/scrubbing = list( @@ -44,7 +44,7 @@ if(connected_port) . += "scrubber-connector" -/obj/machinery/portable_atmospherics/scrubber/process_atmos() +/obj/machinery/portable_atmospherics/scrubber/process_atmos(delta_time) ..() var/pressure = air_contents.return_pressure() @@ -58,16 +58,16 @@ return if(holding) - scrub(holding.air_contents) + scrub(holding.air_contents, delta_time) else var/turf/T = get_turf(src) - scrub(T.return_air()) + scrub(T.return_air(), delta_time) -/obj/machinery/portable_atmospherics/scrubber/proc/scrub(datum/gas_mixture/mixture) +/obj/machinery/portable_atmospherics/scrubber/proc/scrub(datum/gas_mixture/mixture, delta_time = 2) if(air_contents.return_pressure() >= overpressure_m * ONE_ATMOSPHERE) return - var/transfer_moles = min(1, volume_rate / mixture.volume) * mixture.total_moles() + var/transfer_moles = min(1, volume_rate * delta_time / mixture.volume) * mixture.total_moles() var/datum/gas_mixture/filtering = mixture.remove(transfer_moles) // Remove part of the mixture to filter. var/datum/gas_mixture/filtered = new @@ -170,7 +170,7 @@ /obj/machinery/portable_atmospherics/scrubber/huge/update_icon_state() icon_state = "scrubber:[on]" -/obj/machinery/portable_atmospherics/scrubber/huge/process_atmos() +/obj/machinery/portable_atmospherics/scrubber/huge/process_atmos(delta_time) if((!anchored && !movable) || !is_operational) on = FALSE update_icon() @@ -182,7 +182,7 @@ if(!holding) var/turf/T = get_turf(src) for(var/turf/AT in T.GetAtmosAdjacentTurfs(alldir = TRUE)) - scrub(AT.return_air()) + scrub(AT.return_air(), delta_time) /obj/machinery/portable_atmospherics/scrubber/huge/attackby(obj/item/W, mob/user) if(default_unfasten_wrench(user, W)) diff --git a/code/modules/awaymissions/bluespaceartillery.dm b/code/modules/awaymissions/bluespaceartillery.dm index deb05920e22..22473fcac7a 100644 --- a/code/modules/awaymissions/bluespaceartillery.dm +++ b/code/modules/awaymissions/bluespaceartillery.dm @@ -1,8 +1,8 @@ /obj/machinery/artillerycontrol - var/reload = 60 - var/reload_cooldown = 60 + var/reload = 120 + var/reload_cooldown = 120 var/explosiondev = 3 var/explosionmed = 6 var/explosionlight = 12 @@ -11,9 +11,9 @@ icon = 'icons/obj/machines/particle_accelerator.dmi' density = TRUE -/obj/machinery/artillerycontrol/process() +/obj/machinery/artillerycontrol/process(delta_time) if(reload < reload_cooldown) - reload++ + reload += delta_time /obj/structure/artilleryplaceholder name = "artillery" diff --git a/code/modules/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm index 8937e7f0616..41e04322645 100644 --- a/code/modules/awaymissions/capture_the_flag.dm +++ b/code/modules/awaymissions/capture_the_flag.dm @@ -175,7 +175,7 @@ GLOB.poi_list.Remove(src) ..() -/obj/machinery/capture_the_flag/process() +/obj/machinery/capture_the_flag/process(delta_time) for(var/i in spawned_mobs) if(!i) spawned_mobs -= i @@ -187,9 +187,8 @@ else // The changes that you've been hit with no shield but not // instantly critted are low, but have some healing. - living_participant.adjustBruteLoss(-5) - living_participant.adjustFireLoss(-5) - + living_participant.adjustBruteLoss(-2.5 * delta_time) + living_participant.adjustFireLoss(-2.5 * delta_time) /obj/machinery/capture_the_flag/red name = "Red CTF Controller" @@ -672,11 +671,11 @@ resistance_flags = INDESTRUCTIBLE var/obj/machinery/capture_the_flag/controlling var/team = "none" - var/point_rate = 1 + var/point_rate = 0.5 -/obj/machinery/control_point/process() +/obj/machinery/control_point/process(delta_time) if(controlling) - controlling.control_points += point_rate + controlling.control_points += point_rate * delta_time if(controlling.control_points >= controlling.control_points_to_win) controlling.victory() diff --git a/code/modules/awaymissions/mission_code/Academy.dm b/code/modules/awaymissions/mission_code/Academy.dm index 2c93f33367e..df2114c7b69 100644 --- a/code/modules/awaymissions/mission_code/Academy.dm +++ b/code/modules/awaymissions/mission_code/Academy.dm @@ -69,9 +69,9 @@ /obj/singularity/academy/admin_investigate_setup() return -/obj/singularity/academy/process() +/obj/singularity/academy/process(delta_time) eat() - if(prob(1)) + if(DT_PROB(0.5, delta_time)) mezzer() diff --git a/code/modules/awaymissions/mission_code/stationCollision.dm b/code/modules/awaymissions/mission_code/stationCollision.dm index 4858ec39ddb..4ed9f5d79f6 100644 --- a/code/modules/awaymissions/mission_code/stationCollision.dm +++ b/code/modules/awaymissions/mission_code/stationCollision.dm @@ -147,9 +147,9 @@ GLOBAL_VAR_INIT(sc_safecode5, "[rand(0,9)]") /obj/singularity/narsie/mini/admin_investigate_setup() return -/obj/singularity/narsie/mini/process() +/obj/singularity/narsie/mini/process(delta_time) eat() - if(prob(25)) + if(DT_PROB(13, delta_time)) mezzer() /obj/singularity/narsie/mini/ex_act() diff --git a/code/modules/cargo/blackmarket/blackmarket_telepad.dm b/code/modules/cargo/blackmarket/blackmarket_telepad.dm index 31e081d14c6..76acd6398fd 100644 --- a/code/modules/cargo/blackmarket/blackmarket_telepad.dm +++ b/code/modules/cargo/blackmarket/blackmarket_telepad.dm @@ -26,8 +26,8 @@ var/recharge_time = 0 /// Current recharge progress. var/recharge_cooldown = 0 - /// Base recharge time which is used to get recharge_time. - var/base_recharge_time = 100 + /// Base recharge time in seconds which is used to get recharge_time. + var/base_recharge_time = 200 /// Current /datum/blackmarket_purchase being received. var/receiving /// Current /datum/blackmarket_purchase being sent to the target uplink. @@ -68,12 +68,12 @@ return queue += purchase -/obj/machinery/ltsrbt/process() +/obj/machinery/ltsrbt/process(delta_time) if(machine_stat & NOPOWER) return - if(recharge_cooldown) - recharge_cooldown-- + if(recharge_cooldown > 0) + recharge_cooldown -= delta_time return var/turf/T = get_turf(src) diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index d9a54c34417..bf214233df5 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -20,9 +20,9 @@ actions_types = list(/datum/action/item_action/toggle_helmet_light) flags_cover = HEADCOVERSEYES | HEADCOVERSMOUTH | PEPPERPROOF visor_flags_cover = HEADCOVERSEYES | HEADCOVERSMOUTH | PEPPERPROOF - var/rad_count = 0 - var/rad_record = 0 - var/grace_count = 0 + var/current_tick_amount = 0 + var/radiation_count = 0 + var/grace = RAD_GEIGER_GRACE_PERIOD var/datum/looping_sound/geiger/soundloop /obj/item/clothing/head/helmet/space/hardsuit/Initialize() @@ -72,23 +72,25 @@ if(msg && ishuman(wearer)) wearer.show_message("[icon2html(src, wearer)][msg]", MSG_VISUAL) -/obj/item/clothing/head/helmet/space/hardsuit/rad_act(severity) +/obj/item/clothing/head/helmet/space/hardsuit/rad_act(amount) . = ..() - rad_count += severity - -/obj/item/clothing/head/helmet/space/hardsuit/process() - if(!rad_count) - grace_count++ - if(grace_count == 2) - soundloop.last_radiation = 0 + if(amount <= RAD_BACKGROUND_RADIATION) return + current_tick_amount += amount - grace_count = 0 - rad_record -= rad_record/5 - rad_record += rad_count/5 - rad_count = 0 +/obj/item/clothing/head/helmet/space/hardsuit/process(delta_time) + radiation_count = LPFILTER(radiation_count, current_tick_amount, delta_time, RAD_GEIGER_RC) - soundloop.last_radiation = rad_record + if(current_tick_amount) + grace = RAD_GEIGER_GRACE_PERIOD + else + grace -= delta_time + if(grace <= 0) + radiation_count = 0 + + current_tick_amount = 0 + + soundloop.last_radiation = radiation_count /obj/item/clothing/head/helmet/space/hardsuit/emp_act(severity) . = ..() diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index 0577b38db82..fe5bf7b5a20 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -488,7 +488,7 @@ KZ.set_production(11 - (spread_cap / initial(spread_cap)) * 5) //Reverts spread_cap formula so resulting seed gets original production stat or equivalent back. qdel(src) -/datum/spacevine_controller/process() +/datum/spacevine_controller/process(delta_time) if(!LAZYLEN(vines)) qdel(src) //space vines exterminated. Remove the controller return @@ -496,9 +496,7 @@ qdel(src) //Sanity check return - var/length = 0 - - length = min( spread_cap , max( 1 , vines.len / spread_multiplier ) ) + var/length = round(clamp(delta_time * 0.5 * vines.len / spread_multiplier, 1, spread_cap)) var/i = 0 var/list/obj/structure/spacevine/queue_end = list() @@ -511,7 +509,7 @@ for(var/datum/spacevine_mutation/SM in SV.mutations) SM.process_mutation(SV) if(SV.energy < 2) //If tile isn't fully grown - if(prob(20)) + if(DT_PROB(10, delta_time)) SV.grow() else //If tile is fully grown SV.entangle_mob() diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index ad263c15703..cac1daeb8f2 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -1129,8 +1129,8 @@ GLOBAL_LIST_INIT(hallucination_list, list( . = ..() START_PROCESSING(SSobj, src) -/obj/effect/hallucination/danger/anomaly/process() - if(prob(70)) +/obj/effect/hallucination/danger/anomaly/process(delta_time) + if(DT_PROB(45, delta_time)) step(src,pick(GLOB.alldirs)) /obj/effect/hallucination/danger/anomaly/Destroy() diff --git a/code/modules/food_and_drinks/food/snacks_other.dm b/code/modules/food_and_drinks/food/snacks_other.dm index 2232ddb2a5d..11888e1460e 100644 --- a/code/modules/food_and_drinks/food/snacks_other.dm +++ b/code/modules/food_and_drinks/food/snacks_other.dm @@ -474,8 +474,8 @@ /obj/item/reagent_containers/food/snacks/chewable slot_flags = ITEM_SLOT_MASK value = FOOD_WORTHLESS - ///How long it lasts before being deleted - var/succ_dur = 180 + ///How long it lasts before being deleted in seconds + var/succ_dur = 360 ///The delay between each time it will handle reagents var/succ_int = 100 ///Stores the time set for the next handle_reagents @@ -492,12 +492,12 @@ return reagents.remove_any(REAGENTS_METABOLISM) -/obj/item/reagent_containers/food/snacks/chewable/process() +/obj/item/reagent_containers/food/snacks/chewable/process(delta_time) if(iscarbon(loc)) - if(succ_dur < 1) + if(succ_dur <= 0) qdel(src) return - succ_dur-- + succ_dur -= delta_time if((reagents && reagents.total_volume) && (next_succ <= world.time)) handle_reagents() next_succ = world.time + succ_int @@ -564,7 +564,7 @@ color = "#E48AB5" // craftable custom gums someday? list_reagents = list(/datum/reagent/consumable/sugar = 5) tastes = list("candy" = 1) - succ_dur = 450 //15 minutes + succ_dur = 15 * 60 /obj/item/reagent_containers/food/snacks/chewable/bubblegum/nicotine name = "nicotine gum" @@ -585,7 +585,7 @@ color = "#913D3D" list_reagents = list(/datum/reagent/blood = 15) tastes = list("hell" = 1) - succ_dur = 180 + succ_dur = 6 * 60 /obj/item/reagent_containers/food/snacks/chewable/bubblegum/bubblegum/process() . = ..() diff --git a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm index 39be4652a62..9811cd008b7 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm @@ -20,6 +20,9 @@ God bless America. - */ +#define DEEPFRYER_COOKTIME 60 +#define DEEPFRYER_BURNTIME 120 + /obj/machinery/deepfryer name = "deep fryer" desc = "Deep fried everything." @@ -31,7 +34,7 @@ God bless America. layer = BELOW_OBJ_LAYER var/obj/item/food/deepfryholder/frying //What's being fried RIGHT NOW? var/cook_time = 0 - var/oil_use = 0.05 //How much cooking oil is used per tick + var/oil_use = 0.025 //How much cooking oil is used per second var/fry_speed = 1 //How quickly we fry food var/frying_fried //If the object has been fried; used for messages var/frying_burnt //If the object has been burnt @@ -64,7 +67,7 @@ God bless America. var/oil_efficiency for(var/obj/item/stock_parts/micro_laser/M in component_parts) oil_efficiency += M.rating - oil_use = initial(oil_use) - (oil_efficiency * 0.0095) + oil_use = initial(oil_use) - (oil_efficiency * 0.00475) fry_speed = oil_efficiency /obj/machinery/deepfryer/examine(mob/user) @@ -72,7 +75,7 @@ God bless America. if(frying) . += "You can make out \a [frying] in the oil." if(in_range(user, src) || isobserver(user)) - . += "The status display reads: Frying at [fry_speed*100]% speed.
Using [oil_use*10] units of oil per second.
" + . += "The status display reads: Frying at [fry_speed*100]% speed.
Using [oil_use] units of oil per second.
" /obj/machinery/deepfryer/attackby(obj/item/I, mob/user) if(istype(I, /obj/item/reagent_containers/pill)) @@ -105,20 +108,20 @@ God bless America. icon_state = "fryer_on" fry_loop.start() -/obj/machinery/deepfryer/process() +/obj/machinery/deepfryer/process(delta_time) ..() var/datum/reagent/consumable/cooking_oil/C = reagents.has_reagent(/datum/reagent/consumable/cooking_oil) if(!C) return reagents.chem_temp = C.fry_temperature if(frying) - reagents.trans_to(frying, oil_use, multiplier = fry_speed * 3) //Fried foods gain more of the reagent thanks to space magic - cook_time += fry_speed - if(cook_time >= 30 && !frying_fried) + reagents.trans_to(frying, oil_use * delta_time, multiplier = fry_speed * 3) //Fried foods gain more of the reagent thanks to space magic + cook_time += fry_speed * delta_time + if(cook_time >= DEEPFRYER_COOKTIME && !frying_fried) frying_fried = TRUE //frying... frying... fried playsound(src.loc, 'sound/machines/ding.ogg', 50, TRUE) audible_message("[src] dings!") - else if (cook_time >= 60 && !frying_burnt) + else if (cook_time >= DEEPFRYER_BURNTIME && !frying_burnt) frying_burnt = TRUE visible_message("[src] emits an acrid smell!") @@ -154,3 +157,6 @@ God bless America. C.Paralyze(60) user.changeNext_move(CLICK_CD_MELEE) return ..() + +#undef DEEPFRYER_COOKTIME +#undef DEEPFRYER_BURNTIME diff --git a/code/modules/food_and_drinks/kitchen_machinery/grill.dm b/code/modules/food_and_drinks/kitchen_machinery/grill.dm index ded8aba5be5..1b99c4e2045 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/grill.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/grill.dm @@ -1,5 +1,8 @@ //I JUST WANNA GRILL FOR GOD'S SAKE +#define GRILL_FUELUSAGE_IDLE 0.5 +#define GRILL_FUELUSAGE_ACTIVE 5 + /obj/machinery/grill name = "grill" desc = "Just like the old days." @@ -20,7 +23,7 @@ /obj/machinery/grill/update_icon_state() if(grilled_item) icon_state = "grill" - else if(grill_fuel) + else if(grill_fuel > 0) icon_state = "grill_on" else icon_state = "grill_open" @@ -48,7 +51,7 @@ else if(food_item.foodtype & GRILLED) to_chat(user, "[food_item] has already been grilled!") return - else if(!grill_fuel) + else if(grill_fuel <= 0) to_chat(user, "There is not enough fuel!") return else if(!grilled_item && user.transferItemToLoc(food_item, src)) @@ -67,21 +70,21 @@ return ..() -/obj/machinery/grill/process() +/obj/machinery/grill/process(delta_time) ..() update_icon() - if(!grill_fuel) + if(grill_fuel <= 0) return else - grill_fuel -= 1 - if(prob(1)) + grill_fuel -= GRILL_FUELUSAGE_IDLE * delta_time + if(DT_PROB(0.5, delta_time)) var/datum/effect_system/smoke_spread/bad/smoke = new smoke.set_up(1, loc) smoke.start() if(grilled_item) - grill_time += 1 - grilled_item.reagents.add_reagent(/datum/reagent/consumable/char, 1) - grill_fuel -= 10 + grill_time += delta_time + grilled_item.reagents.add_reagent(/datum/reagent/consumable/char, 0.5 * delta_time) + grill_fuel -= GRILL_FUELUSAGE_ACTIVE * delta_time grilled_item.AddComponent(/datum/component/sizzle) /obj/machinery/grill/Exited(atom/movable/AM) @@ -123,19 +126,19 @@ return ..() /obj/machinery/grill/proc/finish_grill() - switch(grill_time) //no 0-9 to prevent spam - if(10 to 15) + switch(grill_time) //no 0-20 to prevent spam + if(20 to 30) grilled_item.name = "lightly-grilled [grilled_item.name]" grilled_item.desc = "[grilled_item.desc] It's been lightly grilled." - if(16 to 39) + if(30 to 80) grilled_item.name = "grilled [grilled_item.name]" grilled_item.desc = "[grilled_item.desc] It's been grilled." grilled_item.foodtype |= FRIED - if(40 to 50) + if(80 to 100) grilled_item.name = "heavily grilled [grilled_item.name]" grilled_item.desc = "[grilled_item.desc] It's been heavily grilled." grilled_item.foodtype |= FRIED - if(51 to INFINITY) //grill marks reach max alpha + if(100 to INFINITY) //grill marks reach max alpha grilled_item.name = "Powerfully Grilled [grilled_item.name]" grilled_item.desc = "A [grilled_item.name]. Reminds you of your wife, wait, no, it's prettier!" grilled_item.foodtype |= FRIED @@ -144,3 +147,6 @@ /obj/machinery/grill/unwrenched anchored = FALSE + +#undef GRILL_FUELUSAGE_IDLE +#undef GRILL_FUELUSAGE_ACTIVE diff --git a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm index 71325e7395b..cd89d727ac7 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm @@ -422,14 +422,14 @@ /obj/machinery/smartfridge/organ/RefreshParts() for(var/obj/item/stock_parts/matter_bin/B in component_parts) max_n_of_items = 20 * B.rating - repair_rate = max(0, STANDARD_ORGAN_HEALING * (B.rating - 1)) + repair_rate = max(0, STANDARD_ORGAN_HEALING * (B.rating - 1) * 0.5) -/obj/machinery/smartfridge/organ/process() +/obj/machinery/smartfridge/organ/process(delta_time) for(var/organ in contents) var/obj/item/organ/O = organ if(!istype(O)) return - O.applyOrganDamage(-repair_rate) + O.applyOrganDamage(-repair_rate * delta_time) /obj/machinery/smartfridge/organ/Exited(atom/movable/AM, atom/newLoc) . = ..() diff --git a/code/modules/food_and_drinks/pizzabox.dm b/code/modules/food_and_drinks/pizzabox.dm index 715187b7e98..d67de067ee1 100644 --- a/code/modules/food_and_drinks/pizzabox.dm +++ b/code/modules/food_and_drinks/pizzabox.dm @@ -25,11 +25,11 @@ var/obj/item/bombcore/miniature/pizza/bomb var/bomb_active = FALSE // If the bomb is counting down. var/bomb_defused = TRUE // If the bomb is inert. - var/bomb_timer = 1 // How long before blowing the bomb. - /// Min bomb timer allowed + var/bomb_timer = 1 // How long before blowing the bomb, in seconds. + /// Min bomb timer allowed in seconds var/bomb_timer_min = 1 - /// Max bomb timer allower - var/bomb_timer_max = 10 + /// Max bomb timer allower in seconds + var/bomb_timer_max = 20 /obj/item/pizzabox/Initialize() . = ..() @@ -131,10 +131,10 @@ if (isnull(bomb_timer)) return - bomb_timer = clamp(CEILING(bomb_timer / 2, 1), bomb_timer_min, bomb_timer_max) + bomb_timer = clamp(CEILING(bomb_timer, 1), bomb_timer_min, bomb_timer_max) bomb_defused = FALSE - log_bomber(user, "has trapped a", src, "with [bomb] set to [bomb_timer * 2] seconds") + log_bomber(user, "has trapped a", src, "with [bomb] set to [bomb_timer] seconds") bomb.adminlog = "The [bomb.name] in [src.name] that [key_name(user)] activated has detonated!" to_chat(user, "You trap [src] with [bomb].") @@ -213,10 +213,10 @@ to_chat(user, "That's not a pizza!") ..() -/obj/item/pizzabox/process() +/obj/item/pizzabox/process(delta_time) if(bomb_active && !bomb_defused && (bomb_timer > 0)) playsound(loc, 'sound/items/timer.ogg', 50, FALSE) - bomb_timer-- + bomb_timer -= delta_time if(bomb_active && !bomb_defused && (bomb_timer <= 0)) if(bomb in src) bomb.detonate() diff --git a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm index 824e1176937..58ea04cd164 100644 --- a/code/modules/holodeck/computer.dm +++ b/code/modules/holodeck/computer.dm @@ -134,10 +134,10 @@ obj_flags ^= EMAGGED say("Safeties restored. Restarting...") -/obj/machinery/computer/holodeck/process() - if(damaged && prob(10)) +/obj/machinery/computer/holodeck/process(delta_time) + if(damaged && DT_PROB(5, delta_time)) for(var/turf/T in linked) - if(prob(5)) + if(DT_PROB(2.5, delta_time)) do_sparks(2, 1, T) return diff --git a/code/modules/hydroponics/grown/chili.dm b/code/modules/hydroponics/grown/chili.dm index 3626b505353..ea4c21e8967 100644 --- a/code/modules/hydroponics/grown/chili.dm +++ b/code/modules/hydroponics/grown/chili.dm @@ -89,13 +89,13 @@ held_mob = loc START_PROCESSING(SSobj, src) -/obj/item/reagent_containers/food/snacks/grown/ghost_chili/process() +/obj/item/reagent_containers/food/snacks/grown/ghost_chili/process(delta_time) if(held_mob && loc == held_mob) if(held_mob.is_holding(src)) if(istype(held_mob) && held_mob.gloves) return - held_mob.adjust_bodytemperature(15 * TEMPERATURE_DAMAGE_COEFFICIENT) - if(prob(10)) + held_mob.adjust_bodytemperature(7.5 * TEMPERATURE_DAMAGE_COEFFICIENT * delta_time) + if(DT_PROB(5, delta_time)) to_chat(held_mob, "Your hand holding [src] burns!") else held_mob = null diff --git a/code/modules/hydroponics/grown/misc.dm b/code/modules/hydroponics/grown/misc.dm index bf6d8bdae8b..c0ecc238180 100644 --- a/code/modules/hydroponics/grown/misc.dm +++ b/code/modules/hydroponics/grown/misc.dm @@ -48,7 +48,7 @@ START_PROCESSING(SSobj, src) return ..() -/obj/item/seeds/starthistle/corpse_flower/process() +/obj/item/seeds/starthistle/corpse_flower/process(delta_time) var/obj/machinery/hydroponics/parent = loc if(parent.age < maturation) // Start a little before it blooms return @@ -59,7 +59,7 @@ var/datum/gas_mixture/stank = new ADD_GAS(/datum/gas/miasma, stank.gases) - stank.gases[/datum/gas/miasma][MOLES] = (yield + 6)*7*MIASMA_CORPSE_MOLES // this process is only being called about 2/7 as much as corpses so this is 12-32 times a corpses + stank.gases[/datum/gas/miasma][MOLES] = (yield + 6)*3.5*MIASMA_CORPSE_MOLES*delta_time // this process is only being called about 2/7 as much as corpses so this is 12-32 times a corpses stank.temperature = T20C // without this the room would eventually freeze and miasma mining would be easier T.assume_air(stank) T.air_update_turf() diff --git a/code/modules/hydroponics/grown/towercap.dm b/code/modules/hydroponics/grown/towercap.dm index 55fefef34e5..c0378a63293 100644 --- a/code/modules/hydroponics/grown/towercap.dm +++ b/code/modules/hydroponics/grown/towercap.dm @@ -254,41 +254,41 @@ if(burning & !grill) Burn() -/obj/structure/bonfire/proc/Burn() +/obj/structure/bonfire/proc/Burn(delta_time = 2) var/turf/current_location = get_turf(src) - current_location.hotspot_expose(1000,500,1) + current_location.hotspot_expose(1000, 250 * delta_time, 1) for(var/A in current_location) if(A == src) continue if(isobj(A)) var/obj/O = A - O.fire_act(1000, 500) + O.fire_act(1000, 250 * delta_time) else if(isliving(A)) var/mob/living/L = A - L.adjust_fire_stacks(fire_stack_strength) + L.adjust_fire_stacks(fire_stack_strength * 0.5 * delta_time) L.IgniteMob() -/obj/structure/bonfire/proc/Cook() +/obj/structure/bonfire/proc/Cook(delta_time = 2) var/turf/current_location = get_turf(src) for(var/A in current_location) if(A == src) continue else if(isliving(A)) //It's still a fire, idiot. var/mob/living/L = A - L.adjust_fire_stacks(fire_stack_strength) + L.adjust_fire_stacks(fire_stack_strength * 0.5 * delta_time) L.IgniteMob() - else if(istype(A, /obj/item) && prob(20)) + else if(istype(A, /obj/item) && DT_PROB(10, delta_time)) var/obj/item/O = A O.microwave_act() -/obj/structure/bonfire/process() +/obj/structure/bonfire/process(delta_time) if(!CheckOxygen()) extinguish() return if(!grill) - Burn() + Burn(delta_time) else - Cook() + Cook(delta_time) /obj/structure/bonfire/extinguish() if(burning) diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 731d86f7505..9d68a562da2 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -123,7 +123,7 @@ else return ..() -/obj/machinery/hydroponics/process() +/obj/machinery/hydroponics/process(delta_time) var/needs_update = 0 // Checks if the icon needs updating so we don't redraw empty trays every time if(myseed && (myseed.loc != src)) @@ -136,9 +136,9 @@ update_icon() else if(self_sustaining) - adjustWater(rand(1,2)) - adjustWeeds(-1) - adjustPests(-1) + adjustWater(rand(1,2) * delta_time * 0.5) + adjustWeeds(-0.5 * delta_time) + adjustPests(-0.5 * delta_time) if(world.time > (lastcycle + cycledelay)) lastcycle = world.time diff --git a/code/modules/mining/equipment/explorer_gear.dm b/code/modules/mining/equipment/explorer_gear.dm index c52470461e7..2a358e8dc0f 100644 --- a/code/modules/mining/equipment/explorer_gear.dm +++ b/code/modules/mining/equipment/explorer_gear.dm @@ -69,11 +69,11 @@ armor = list(MELEE = 70, BULLET = 40, LASER = 10, ENERGY = 20, BOMB = 50, BIO = 100, RAD = 100, FIRE = 100, ACID = 100) allowed = list(/obj/item/flashlight, /obj/item/tank/internals, /obj/item/resonator, /obj/item/mining_scanner, /obj/item/t_scanner/adv_mining_scanner, /obj/item/gun/energy/kinetic_accelerator, /obj/item/pickaxe) -/obj/item/clothing/suit/space/hostile_environment/process() +/obj/item/clothing/suit/space/hostile_environment/process(delta_time) . = ..() var/mob/living/carbon/C = loc - if(istype(C) && prob(2)) //cursed by bubblegum - if(prob(15)) + if(istype(C) && DT_PROB(1, delta_time)) //cursed by bubblegum + if(DT_PROB(7.5, delta_time)) new /datum/hallucination/oh_yeah(C) to_chat(C, "[pick("I AM IMMORTAL.","I SHALL TAKE BACK WHAT'S MINE.","I SEE YOU.","YOU CANNOT ESCAPE ME FOREVER.","DEATH CANNOT HOLD ME.")]") else diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index f73be735ba2..b957537b514 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -1,4 +1,5 @@ -#define SMELT_AMOUNT 10 +/// Smelt amount per second +#define SMELT_AMOUNT 5 /**********************Mineral processing unit console**************************/ @@ -194,13 +195,13 @@ if(istype(target, /obj/item/stack/ore)) process_ore(target) -/obj/machinery/mineral/processing_unit/process() +/obj/machinery/mineral/processing_unit/process(delta_time) if(on) if(selected_material) - smelt_ore() + smelt_ore(delta_time) else if(selected_alloy) - smelt_alloy() + smelt_alloy(delta_time) if(CONSOLE) @@ -208,11 +209,11 @@ else end_processing() -/obj/machinery/mineral/processing_unit/proc/smelt_ore() +/obj/machinery/mineral/processing_unit/proc/smelt_ore(delta_time = 2) var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) var/datum/material/mat = selected_material if(mat) - var/sheets_to_remove = (materials.materials[mat] >= (MINERAL_MATERIAL_AMOUNT * SMELT_AMOUNT) ) ? SMELT_AMOUNT : round(materials.materials[mat] / MINERAL_MATERIAL_AMOUNT) + var/sheets_to_remove = (materials.materials[mat] >= (MINERAL_MATERIAL_AMOUNT * SMELT_AMOUNT * delta_time) ) ? SMELT_AMOUNT * delta_time : round(materials.materials[mat] / MINERAL_MATERIAL_AMOUNT) if(!sheets_to_remove) on = FALSE else @@ -220,13 +221,13 @@ materials.retrieve_sheets(sheets_to_remove, mat, out) -/obj/machinery/mineral/processing_unit/proc/smelt_alloy() +/obj/machinery/mineral/processing_unit/proc/smelt_alloy(delta_time = 2) var/datum/design/alloy = stored_research.isDesignResearchedID(selected_alloy) //check if it's a valid design if(!alloy) on = FALSE return - var/amount = can_smelt(alloy) + var/amount = can_smelt(alloy, delta_time) if(!amount) on = FALSE @@ -237,11 +238,11 @@ generate_mineral(alloy.build_path) -/obj/machinery/mineral/processing_unit/proc/can_smelt(datum/design/D) +/obj/machinery/mineral/processing_unit/proc/can_smelt(datum/design/D, delta_time = 2) if(D.make_reagents.len) return FALSE - var/build_amount = SMELT_AMOUNT + var/build_amount = SMELT_AMOUNT * delta_time var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 539bfb7376d..01ea13603ca 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -74,7 +74,7 @@ var/emitterhealth = 20 var/emittermaxhealth = 20 - var/emitterregen = 0.25 + var/emitterregen = 0.125 var/emittercd = 50 var/emitteroverloadcd = 100 var/emittersemicd = FALSE @@ -312,8 +312,8 @@ set_health(maxHealth - getBruteLoss() - getFireLoss()) update_stat() -/mob/living/silicon/pai/process() - emitterhealth = clamp((emitterhealth + emitterregen), -50, emittermaxhealth) +/mob/living/silicon/pai/process(delta_time) + emitterhealth = clamp((emitterhealth + emitterregen * delta_time), -50, emittermaxhealth) /obj/item/paicard/attackby(obj/item/W, mob/user, params) if(pai && (istype(W, /obj/item/encryptionkey) || W.tool_behaviour == TOOL_SCREWDRIVER)) diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm index d01bdbfcf63..151e40a593e 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules.dm @@ -342,7 +342,7 @@ T.cell.give(S.e_cost * coeff) T.update_icon() else - T.charge_tick = 0 + T.charge_timer = 0 /obj/item/robot_module/peacekeeper name = "Peacekeeper" diff --git a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm index f96b894be1e..1e80957da9e 100644 --- a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm +++ b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm @@ -386,10 +386,10 @@ START_PROCESSING(SSobj, E) /obj/item/reagent_containers/food/snacks/egg/var/amount_grown = 0 -/obj/item/reagent_containers/food/snacks/egg/process() +/obj/item/reagent_containers/food/snacks/egg/process(delta_time) if(isturf(loc)) - amount_grown += rand(1,2) - if(amount_grown >= 100) + amount_grown += rand(1,2) * delta_time + if(amount_grown >= 200) visible_message("[src] hatches with a quiet cracking sound.") new /mob/living/simple_animal/chick(get_turf(src)) STOP_PROCESSING(SSobj, src) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm index f82217c109c..36ca8608bc9 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm @@ -176,11 +176,11 @@ While using this makes the system rely on OnFire, it still gives options for tim activator = null return ..() -/obj/structure/elite_tumor/process() +/obj/structure/elite_tumor/process(delta_time) if(isturf(loc)) for(var/mob/living/simple_animal/hostile/asteroid/elite/elitehere in loc) if(elitehere == mychild && activity == TUMOR_PASSIVE) - mychild.adjustHealth(-mychild.maxHealth*0.05) + mychild.adjustHealth(-mychild.maxHealth*0.025*delta_time) var/obj/effect/temp_visual/heal/H = new /obj/effect/temp_visual/heal(get_turf(mychild)) H.color = "#FF0000" diff --git a/code/modules/mob/living/simple_animal/hostile/netherworld.dm b/code/modules/mob/living/simple_animal/hostile/netherworld.dm index 6f370179463..a2a4ad00ccd 100644 --- a/code/modules/mob/living/simple_animal/hostile/netherworld.dm +++ b/code/modules/mob/living/simple_animal/hostile/netherworld.dm @@ -193,11 +193,11 @@ "Touching the portal, you are quickly pulled through into a world of unimaginable horror!") contents.Add(user) -/obj/structure/spawner/nether/process() +/obj/structure/spawner/nether/process(delta_time) for(var/mob/living/M in contents) if(M) playsound(src, 'sound/magic/demon_consume.ogg', 50, TRUE) - M.adjustBruteLoss(60) + M.adjustBruteLoss(60 * delta_time) new /obj/effect/gibspawner/generic(get_turf(M), M) if(M.stat == DEAD) var/mob/living/simple_animal/hostile/netherworld/blankbody/blank diff --git a/code/modules/mob/living/simple_animal/hostile/space_dragon.dm b/code/modules/mob/living/simple_animal/hostile/space_dragon.dm index 61fed648467..969d35e15d0 100644 --- a/code/modules/mob/living/simple_animal/hostile/space_dragon.dm +++ b/code/modules/mob/living/simple_animal/hostile/space_dragon.dm @@ -428,7 +428,7 @@ /// The amount of time the rift has charged for. var/time_charged = 0 /// The maximum charge the rift can have. It actually goes to max_charge + 1, as to prevent constantly retriggering the effects on full charge. - var/max_charge = 240 + var/max_charge = 480 /// How many carp spawns it has available. var/carp_stored = 0 /// A reference to the Space Dragon that created it. @@ -453,12 +453,12 @@ playsound(src, 'sound/vehicles/rocketlaunch.ogg', 100, TRUE) return ..() -/obj/structure/carp_rift/process() - time_charged = min(time_charged + 1, max_charge + 1) +/obj/structure/carp_rift/process(delta_time) + time_charged = min(time_charged + delta_time, max_charge + 1) update_check() for(var/mob/living/simple_animal/hostile/hostilehere in loc) if("carp" in hostilehere.faction) - hostilehere.adjustHealth(-10) + hostilehere.adjustHealth(-5 * delta_time) var/obj/effect/temp_visual/heal/H = new /obj/effect/temp_visual/heal(get_turf(hostilehere)) H.color = "#0000FF" if(time_charged < max_charge) @@ -470,8 +470,7 @@ icon_state = "carp_rift_carpspawn" light_color = LIGHT_COLOR_PURPLE else - var/spawncarp = rand(1,40) - if(spawncarp == 1) + if(DT_PROB(1.25, delta_time)) new /mob/living/simple_animal/hostile/carp(loc) /obj/structure/carp_rift/attack_ghost(mob/user) diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm index 5a5de49845c..611c961f8ac 100644 --- a/code/modules/modular_computers/computers/item/computer.dm +++ b/code/modules/modular_computers/computers/item/computer.dm @@ -219,7 +219,7 @@ to_chat(user, "You press the power button but \the [src] does not respond.") // Process currently calls handle_power(), may be expanded in future if more things are added. -/obj/item/modular_computer/process() +/obj/item/modular_computer/process(delta_time) if(!enabled) // The computer is turned off last_power_usage = 0 return @@ -238,7 +238,7 @@ if(active_program) if(active_program.program_state != PROGRAM_STATE_KILLED) - active_program.process_tick() + active_program.process_tick(delta_time) active_program.ntnet_status = get_ntnet_status() else active_program = null @@ -246,12 +246,12 @@ for(var/I in idle_threads) var/datum/computer_file/program/P = I if(P.program_state != PROGRAM_STATE_KILLED) - P.process_tick() + P.process_tick(delta_time) P.ntnet_status = get_ntnet_status() else idle_threads.Remove(P) - handle_power() // Handles all computer power interaction + handle_power(delta_time) // Handles all computer power interaction //check_update_ui_need() // Function used by NanoUI's to obtain data for header. All relevant entries begin with "PC_" diff --git a/code/modules/modular_computers/computers/item/computer_power.dm b/code/modules/modular_computers/computers/item/computer_power.dm index b5188f43d96..7eb7998fc1b 100644 --- a/code/modules/modular_computers/computers/item/computer_power.dm +++ b/code/modules/modular_computers/computers/item/computer_power.dm @@ -41,10 +41,10 @@ shutdown_computer(0) // Handles power-related things, such as battery interaction, recharging, shutdown when it's discharged -/obj/item/modular_computer/proc/handle_power() +/obj/item/modular_computer/proc/handle_power(delta_time) var/obj/item/computer_hardware/recharger/recharger = all_components[MC_CHARGE] if(recharger) - recharger.process() + recharger.process(delta_time) var/power_usage = screen_on ? base_active_power_usage : base_idle_power_usage diff --git a/code/modules/modular_computers/computers/machinery/modular_computer.dm b/code/modules/modular_computers/computers/machinery/modular_computer.dm index ab7f9451ec2..1e39308d23e 100644 --- a/code/modules/modular_computers/computers/machinery/modular_computer.dm +++ b/code/modules/modular_computers/computers/machinery/modular_computer.dm @@ -87,11 +87,11 @@ return ..() // Process currently calls handle_power(), may be expanded in future if more things are added. -/obj/machinery/modular_computer/process() +/obj/machinery/modular_computer/process(delta_time) if(cpu) // Keep names in sync. cpu.name = name - cpu.process() + cpu.process(delta_time) // Used in following function to reduce copypaste /obj/machinery/modular_computer/proc/power_failure(malfunction = 0) diff --git a/code/modules/modular_computers/file_system/program.dm b/code/modules/modular_computers/file_system/program.dm index d16d6f8a250..afdd9a3db47 100644 --- a/code/modules/modular_computers/file_system/program.dm +++ b/code/modules/modular_computers/file_system/program.dm @@ -77,7 +77,7 @@ return 0 // Called by Process() on device that runs us, once every tick. -/datum/computer_file/program/proc/process_tick() +/datum/computer_file/program/proc/process_tick(delta_time) return TRUE /** diff --git a/code/modules/ninja/suit/n_suit_verbs/energy_net_nets.dm b/code/modules/ninja/suit/n_suit_verbs/energy_net_nets.dm index c6bfe78d296..2e64535b12a 100644 --- a/code/modules/ninja/suit/n_suit_verbs/energy_net_nets.dm +++ b/code/modules/ninja/suit/n_suit_verbs/energy_net_nets.dm @@ -18,9 +18,9 @@ It is possible to destroy the net by the occupant or someone else. can_buckle = 1 buckle_lying = 0 buckle_prevents_pull = TRUE - var/mob/living/carbon/affecting//Who it is currently affecting, if anyone. - var/mob/living/carbon/master//Who shot web. Will let this person know if the net was successful or failed. - var/check = 15//30 seconds before teleportation. Could be extended I guess. + var/mob/living/carbon/affecting //Who it is currently affecting, if anyone. + var/mob/living/carbon/master //Who shot web. Will let this person know if the net was successful or failed. + var/check = 30 // seconds before teleportation. Could be extended I guess. var/success = FALSE @@ -39,13 +39,13 @@ It is possible to destroy the net by the occupant or someone else. to_chat(master, "ERROR: unable to initiate transport protocol. Procedure terminated.") return ..() -/obj/structure/energy_net/process() +/obj/structure/energy_net/process(delta_time) if(QDELETED(affecting)||affecting.loc!=loc) qdel(src)//Get rid of the net. return - if(check>0) - check-- + if(check > 0) + check -= delta_time return success = TRUE diff --git a/code/modules/ninja/suit/n_suit_verbs/ninja_adrenaline.dm b/code/modules/ninja/suit/n_suit_verbs/ninja_adrenaline.dm index 91c9a8fa14c..0a6f35a8cd7 100644 --- a/code/modules/ninja/suit/n_suit_verbs/ninja_adrenaline.dm +++ b/code/modules/ninja/suit/n_suit_verbs/ninja_adrenaline.dm @@ -16,7 +16,7 @@ H.say(pick("A CORNERED FOX IS MORE DANGEROUS THAN A JACKAL!","HURT ME MOOORRREEE!","IMPRESSIVE!"), forced = "ninjaboost") a_boost-- to_chat(H, "There are [a_boost] adrenaline boosts remaining.") - s_coold = 3 + s_coold = 6 addtimer(CALLBACK(src, .proc/ninjaboost_after), 70) /obj/item/clothing/suit/space/space_ninja/proc/ninjaboost_after() diff --git a/code/modules/ninja/suit/n_suit_verbs/ninja_empulse.dm b/code/modules/ninja/suit/n_suit_verbs/ninja_empulse.dm index ea96c1cdf61..3d77ac911cb 100644 --- a/code/modules/ninja/suit/n_suit_verbs/ninja_empulse.dm +++ b/code/modules/ninja/suit/n_suit_verbs/ninja_empulse.dm @@ -7,4 +7,4 @@ var/mob/living/carbon/human/H = affecting playsound(H.loc, 'sound/effects/empulse.ogg', 60, 2) empulse(H, 4, 6) //Procs sure are nice. Slightly weaker than wizard's disable tch. - s_coold = 2 + s_coold = 4 diff --git a/code/modules/ninja/suit/n_suit_verbs/ninja_smoke.dm b/code/modules/ninja/suit/n_suit_verbs/ninja_smoke.dm index 3c19162048c..2f4954928a3 100644 --- a/code/modules/ninja/suit/n_suit_verbs/ninja_smoke.dm +++ b/code/modules/ninja/suit/n_suit_verbs/ninja_smoke.dm @@ -11,4 +11,4 @@ playsound(H.loc, 'sound/effects/bamf.ogg', 50, 2) s_bombs-- to_chat(H, "There are [s_bombs] smoke bombs remaining.") - s_coold = 1 + s_coold = 2 diff --git a/code/modules/ninja/suit/suit.dm b/code/modules/ninja/suit/suit.dm index 26d8f6c924d..eca5fee785d 100644 --- a/code/modules/ninja/suit/suit.dm +++ b/code/modules/ninja/suit/suit.dm @@ -34,8 +34,8 @@ Contents: //Main function variables. var/s_initialized = 0//Suit starts off. var/s_coold = 0//If the suit is on cooldown. Can be used to attach different cooldowns to abilities. Ticks down every second based on suit ntick(). - var/s_cost = 5//Base energy cost each ntick. - var/s_acost = 25//Additional cost for additional powers active. + var/s_cost = 2.5//Base energy cost each ntick. + var/s_acost = 12.5//Additional cost for additional powers active. var/s_delay = 40//How fast the suit does certain things, lower is faster. Can be overridden in specific procs. Also determines adverse probability. var/a_transfer = 20//How much radium is used per adrenaline boost. var/a_maxamount = 7//Maximum number of adrenaline boosts. @@ -75,7 +75,7 @@ Contents: return // Space Suit temperature regulation and power usage -/obj/item/clothing/suit/space/space_ninja/process() +/obj/item/clothing/suit/space/space_ninja/process(delta_time) var/mob/living/carbon/human/user = src.loc if(!user || !ishuman(user) || !(user.wear_suit == src)) return @@ -85,11 +85,11 @@ Contents: if(!affecting) terminate() // Kills the suit and attached objects. else if(cell.charge > 0) - if(s_coold) - s_coold-- // Checks for ability s_cooldown first. - cell.charge -= s_cost // s_cost is the default energy cost each ntick, usually 5. + if(s_coold > 0) + s_coold -= delta_time // Checks for ability s_cooldown first. + cell.charge -= s_cost * delta_time // s_cost is the default energy cost each ntick, usually 5. if(stealth) // If stealth is active. - cell.charge -= s_acost + cell.charge -= s_acost * delta_time else cell.charge = 0 cancel_stealth() @@ -106,8 +106,8 @@ Contents: //Randomizes suit parameters. /obj/item/clothing/suit/space/space_ninja/proc/randomize_param() - s_cost = rand(1,20) - s_acost = rand(20,100) + s_cost = rand(1,10) + s_acost = rand(10,50) s_delay = rand(10,100) s_bombs = rand(5,20) a_boost = rand(1,7) diff --git a/code/modules/plumbing/plumbers/acclimator.dm b/code/modules/plumbing/plumbers/acclimator.dm index bd87ab009f7..6a8b6695377 100644 --- a/code/modules/plumbing/plumbers/acclimator.dm +++ b/code/modules/plumbing/plumbers/acclimator.dm @@ -16,7 +16,7 @@ ///I cant find a good name for this. Basically if target is 300, and this is 10, it will still target 300 but will start emptying itself at 290 and 310. var/allowed_temperature_difference = 1 ///cool/heat power - var/heater_coefficient = 0.1 + var/heater_coefficient = 0.05 ///Are we turned on or off? this is from the on and off button var/enabled = TRUE ///COOLING, HEATING or NEUTRAL. We track this for change, so we dont needlessly update our icon @@ -30,7 +30,7 @@ . = ..() AddComponent(/datum/component/plumbing/acclimator, bolt) -/obj/machinery/plumbing/acclimator/process() +/obj/machinery/plumbing/acclimator/process(delta_time) if(machine_stat & NOPOWER || !enabled || !reagents.total_volume || reagents.chem_temp == target_temperature) if(acclimate_state != NEUTRAL) acclimate_state = NEUTRAL @@ -51,7 +51,7 @@ if(reagents.chem_temp <= target_temperature && target_temperature - allowed_temperature_difference <= reagents.chem_temp) //heating here emptying = TRUE - reagents.adjust_thermal_energy((target_temperature - reagents.chem_temp) * heater_coefficient * SPECIFIC_HEAT_DEFAULT * reagents.total_volume) //keep constant with chem heater + reagents.adjust_thermal_energy((target_temperature - reagents.chem_temp) * heater_coefficient * delta_time * SPECIFIC_HEAT_DEFAULT * reagents.total_volume) //keep constant with chem heater reagents.handle_reactions() /obj/machinery/plumbing/acclimator/update_icon_state() diff --git a/code/modules/plumbing/plumbers/destroyer.dm b/code/modules/plumbing/plumbers/destroyer.dm index 8e08b609919..92747d6c59e 100644 --- a/code/modules/plumbing/plumbers/destroyer.dm +++ b/code/modules/plumbing/plumbers/destroyer.dm @@ -2,20 +2,20 @@ name = "chemical disposer" desc = "Breaks down chemicals and annihilates them." icon_state = "disposal" - ///we remove 10 reagents per second - var/disposal_rate = 10 + ///we remove 5 reagents per second + var/disposal_rate = 5 /obj/machinery/plumbing/disposer/Initialize(mapload, bolt) . = ..() AddComponent(/datum/component/plumbing/simple_demand, bolt) -/obj/machinery/plumbing/disposer/process() +/obj/machinery/plumbing/disposer/process(delta_time) if(machine_stat & NOPOWER) return if(reagents.total_volume) if(icon_state != initial(icon_state) + "_working") //threw it here instead of update icon since it only has two states icon_state = initial(icon_state) + "_working" - reagents.remove_any(disposal_rate) + reagents.remove_any(disposal_rate * delta_time) else if(icon_state != initial(icon_state)) icon_state = initial(icon_state) diff --git a/code/modules/plumbing/plumbers/pumps.dm b/code/modules/plumbing/plumbers/pumps.dm index 23e57e8a5d1..da6d3324d42 100644 --- a/code/modules/plumbing/plumbers/pumps.dm +++ b/code/modules/plumbing/plumbers/pumps.dm @@ -9,8 +9,8 @@ idle_power_usage = 10 active_power_usage = 1000 - ///units we pump per process (2 seconds) - var/pump_power = 2 + ///units we pump per second + var/pump_power = 1 ///set to true if the loop couldnt find a geyser in process, so it remembers and stops checking every loop until moved. more accurate name would be absolutely_no_geyser_under_me_so_dont_try var/geyserless = FALSE ///The geyser object @@ -30,7 +30,7 @@ update_icon() geyserless = FALSE //we switched state, so lets just set this back aswell -/obj/machinery/plumbing/liquid_pump/process() +/obj/machinery/plumbing/liquid_pump/process(delta_time) if(!anchored || panel_open || geyserless) return @@ -44,13 +44,13 @@ playsound(src, 'sound/machines/buzz-sigh.ogg', 50) return - pump() + pump(delta_time) ///pump up that sweet geyser nectar -/obj/machinery/plumbing/liquid_pump/proc/pump() +/obj/machinery/plumbing/liquid_pump/proc/pump(delta_time) if(!geyser || !geyser.reagents) return - geyser.reagents.trans_to(src, pump_power) + geyser.reagents.trans_to(src, pump_power * delta_time) /obj/machinery/plumbing/liquid_pump/update_icon_state() if(geyser) diff --git a/code/modules/plumbing/plumbers/synthesizer.dm b/code/modules/plumbing/plumbers/synthesizer.dm index b93bd532fe1..3cdd1b9e69b 100644 --- a/code/modules/plumbing/plumbers/synthesizer.dm +++ b/code/modules/plumbing/plumbers/synthesizer.dm @@ -46,12 +46,12 @@ . = ..() AddComponent(/datum/component/plumbing/simple_supply, bolt) -/obj/machinery/plumbing/synthesizer/process() +/obj/machinery/plumbing/synthesizer/process(delta_time) if(machine_stat & NOPOWER || !reagent_id || !amount) return - if(reagents.total_volume >= amount) //otherwise we get leftovers, and we need this to be precise + if(reagents.total_volume >= amount*delta_time*0.5) //otherwise we get leftovers, and we need this to be precise return - reagents.add_reagent(reagent_id, amount) + reagents.add_reagent(reagent_id, amount*delta_time*0.5) /obj/machinery/plumbing/synthesizer/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm index 4ad1ee6a277..f2af1196e57 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cell.dm @@ -49,9 +49,9 @@ STOP_PROCESSING(SSobj, src) . = ..() -/obj/item/stock_parts/cell/process() +/obj/item/stock_parts/cell/process(delta_time) if(self_recharge) - give(chargerate * 0.25) + give(chargerate * 0.125 * delta_time) else return PROCESS_KILL diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm index 369224af6dc..e1982e7cde3 100644 --- a/code/modules/power/singularity/collector.dm +++ b/code/modules/power/singularity/collector.dm @@ -20,7 +20,7 @@ var/stored_energy = 0 var/active = 0 var/locked = FALSE - var/drainratio = 1 + var/drainratio = 0.5 var/powerproduction_drain = 0.001 /obj/machinery/power/rad_collector/anchored/Initialize() @@ -37,7 +37,7 @@ /obj/machinery/power/rad_collector/should_have_node() return anchored -/obj/machinery/power/rad_collector/process() +/obj/machinery/power/rad_collector/process(delta_time) if(!loaded_tank) return if(!loaded_tank.air_contents.gases[/datum/gas/plasma]) @@ -45,7 +45,7 @@ playsound(src, 'sound/machines/ding.ogg', 50, TRUE) eject() else - var/gasdrained = min(powerproduction_drain*drainratio,loaded_tank.air_contents.gases[/datum/gas/plasma][MOLES]) + var/gasdrained = min(powerproduction_drain*drainratio*delta_time,loaded_tank.air_contents.gases[/datum/gas/plasma][MOLES]) loaded_tank.air_contents.gases[/datum/gas/plasma][MOLES] -= gasdrained loaded_tank.air_contents.assert_gas(/datum/gas/tritium) loaded_tank.air_contents.gases[/datum/gas/tritium][MOLES] += gasdrained diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index 3d0fe96f2a7..01442f1bf9e 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -175,7 +175,7 @@ if(. && !anchored) step(src, get_dir(M, src)) -/obj/machinery/power/emitter/process() +/obj/machinery/power/emitter/process(delta_time) if(machine_stat & (BROKEN)) return if(!welded || (!powernet && active_power_usage)) @@ -197,7 +197,7 @@ log_game("Emitter lost power in [AREACOORD(src)]") return if(charge <= 80) - charge += 5 + charge += 2.5 * delta_time if(!check_delay() || manual == TRUE) return FALSE fire_beam() diff --git a/code/modules/power/singularity/generator.dm b/code/modules/power/singularity/generator.dm index 2a191cff009..e54c48203e9 100644 --- a/code/modules/power/singularity/generator.dm +++ b/code/modules/power/singularity/generator.dm @@ -23,7 +23,7 @@ else return ..() -/obj/machinery/the_singularitygen/process() +/obj/machinery/the_singularitygen/process(delta_time) if(energy > 0) if(energy >= 200) var/turf/T = get_turf(src) @@ -32,4 +32,4 @@ transfer_fingerprints_to(S) qdel(src) else - energy -= 1 + energy -= delta_time * 0.5 diff --git a/code/modules/projectiles/guns/ballistic/laser_gatling.dm b/code/modules/projectiles/guns/ballistic/laser_gatling.dm index e383c692da1..99fb725fea3 100644 --- a/code/modules/projectiles/guns/ballistic/laser_gatling.dm +++ b/code/modules/projectiles/guns/ballistic/laser_gatling.dm @@ -15,7 +15,7 @@ var/armed = FALSE //whether the gun is attached, FALSE is attached, TRUE is the gun is wielded. var/overheat = 0 var/overheat_max = 40 - var/heat_diffusion = 1 + var/heat_diffusion = 0.5 /obj/item/minigunpack/Initialize() . = ..() @@ -26,8 +26,8 @@ STOP_PROCESSING(SSobj, src) return ..() -/obj/item/minigunpack/process() - overheat = max(0, overheat - heat_diffusion) +/obj/item/minigunpack/process(delta_time) + overheat = max(0, overheat - heat_diffusion * delta_time) //ATTACK HAND IGNORING PARENT RETURN VALUE /obj/item/minigunpack/attack_hand(mob/living/carbon/user) diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index b33fa80cea8..a9f92eeb6ad 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -15,8 +15,8 @@ ammo_x_offset = 2 var/shaded_charge = FALSE //if this gun uses a stateful charge bar for more detail var/selfcharge = 0 - var/charge_tick = 0 - var/charge_delay = 4 + var/charge_timer = 0 + var/charge_delay = 8 var/use_cyborg_cell = FALSE //whether the gun's cell drains the cyborg user's cell to recharge var/dead_cell = FALSE //set to true so the gun is given an empty cell @@ -71,12 +71,12 @@ update_icon() return ..() -/obj/item/gun/energy/process() +/obj/item/gun/energy/process(delta_time) if(selfcharge && cell && cell.percent() < 100) - charge_tick++ - if(charge_tick < charge_delay) + charge_timer += delta_time + if(charge_timer < charge_delay) return - charge_tick = 0 + charge_timer = 0 cell.give(100) if(!chambered) //if empty chamber we try to charge a new shot recharge_newshot(TRUE) diff --git a/code/modules/projectiles/guns/energy/energy_gun.dm b/code/modules/projectiles/guns/energy/energy_gun.dm index 543ec78abbe..e4c90cf88de 100644 --- a/code/modules/projectiles/guns/energy/energy_gun.dm +++ b/code/modules/projectiles/guns/energy/energy_gun.dm @@ -93,7 +93,7 @@ desc = "An energy gun with an experimental miniaturized nuclear reactor that automatically charges the internal power cell." icon_state = "nucgun" inhand_icon_state = "nucgun" - charge_delay = 5 + charge_delay = 10 pin = null can_charge = FALSE ammo_x_offset = 1 @@ -103,9 +103,9 @@ var/fail_tick = 0 var/fail_chance = 0 -/obj/item/gun/energy/e_gun/nuclear/process() +/obj/item/gun/energy/e_gun/nuclear/process(delta_time) if(fail_tick > 0) - fail_tick-- + fail_tick -= delta_time * 0.5 ..() /obj/item/gun/energy/e_gun/nuclear/shoot_live_shot(mob/living/user, pointblank = 0, atom/pbtarget = null, message = 1) diff --git a/code/modules/projectiles/guns/magic.dm b/code/modules/projectiles/guns/magic.dm index 2eea0e18402..896876c118e 100644 --- a/code/modules/projectiles/guns/magic.dm +++ b/code/modules/projectiles/guns/magic.dm @@ -12,8 +12,8 @@ var/checks_antimagic = TRUE var/max_charges = 6 var/charges = 0 - var/recharge_rate = 4 - var/charge_tick = 0 + var/recharge_rate = 8 + var/charge_timer = 0 var/can_charge = TRUE var/ammo_type var/no_den_usage @@ -62,14 +62,14 @@ return ..() -/obj/item/gun/magic/process() +/obj/item/gun/magic/process(delta_time) if (charges >= max_charges) - charge_tick = 0 + charge_timer = 0 return - charge_tick++ - if(charge_tick < recharge_rate) + charge_timer += delta_time + if(charge_timer < recharge_rate) return 0 - charge_tick = 0 + charge_timer = 0 charges++ if(charges == 1) recharge_newshot() diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index 17020a5e591..095c25ad6cd 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -117,14 +117,14 @@ begin_processing() -/obj/machinery/chem_dispenser/process() - if (recharge_counter >= 4) +/obj/machinery/chem_dispenser/process(delta_time) + if (recharge_counter >= 8) var/usedpower = cell.give(recharge_amount) if(usedpower) use_power(250*recharge_amount) recharge_counter = 0 return - recharge_counter++ + recharge_counter += delta_time /obj/machinery/chem_dispenser/proc/display_beaker() var/mutable_appearance/b_o = beaker_overlay || mutable_appearance(icon, "disp_beaker") diff --git a/code/modules/reagents/chemistry/machinery/chem_heater.dm b/code/modules/reagents/chemistry/machinery/chem_heater.dm index 1fe8af349df..2351374765e 100644 --- a/code/modules/reagents/chemistry/machinery/chem_heater.dm +++ b/code/modules/reagents/chemistry/machinery/chem_heater.dm @@ -10,7 +10,7 @@ var/obj/item/reagent_containers/beaker = null var/target_temperature = 300 - var/heater_coefficient = 0.1 + var/heater_coefficient = 0.05 var/on = FALSE /obj/machinery/chem_heater/Destroy() @@ -56,14 +56,14 @@ if(in_range(user, src) || isobserver(user)) . += "The status display reads: Heating reagents at [heater_coefficient*1000]% speed." -/obj/machinery/chem_heater/process() +/obj/machinery/chem_heater/process(delta_time) ..() if(machine_stat & NOPOWER) return if(on) if(beaker && beaker.reagents.total_volume) //keep constant with the chemical acclimator please - beaker.reagents.adjust_thermal_energy((target_temperature - beaker.reagents.chem_temp) * heater_coefficient * SPECIFIC_HEAT_DEFAULT * beaker.reagents.total_volume) + beaker.reagents.adjust_thermal_energy((target_temperature - beaker.reagents.chem_temp) * heater_coefficient * delta_time * SPECIFIC_HEAT_DEFAULT * beaker.reagents.total_volume) beaker.reagents.handle_reactions() /obj/machinery/chem_heater/attackby(obj/item/I, mob/user, params) diff --git a/code/modules/reagents/reagent_containers/borghydro.dm b/code/modules/reagents/reagent_containers/borghydro.dm index e9a8db98b44..26c8e3fccb6 100644 --- a/code/modules/reagents/reagent_containers/borghydro.dm +++ b/code/modules/reagents/reagent_containers/borghydro.dm @@ -22,8 +22,8 @@ Borg Hypospray possible_transfer_amounts = list() var/mode = 1 var/charge_cost = 50 - var/charge_tick = 0 - var/recharge_time = 5 //Time it takes for shots to recharge (in seconds) + var/charge_timer = 0 + var/recharge_time = 10 //Time it takes for shots to recharge (in seconds) var/bypass_protection = 0 //If the hypospray can go through armor or thick material var/list/datum/reagents/reagent_list = list() @@ -48,11 +48,11 @@ Borg Hypospray return ..() -/obj/item/reagent_containers/borghypo/process() //Every [recharge_time] seconds, recharge some reagents for the cyborg - charge_tick++ - if(charge_tick >= recharge_time) +/obj/item/reagent_containers/borghypo/process(delta_time) //Every [recharge_time] seconds, recharge some reagents for the cyborg + charge_timer += delta_time + if(charge_timer >= recharge_time) regenerate_reagents() - charge_tick = 0 + charge_timer = 0 //update_icon() return 1 diff --git a/code/modules/reagents/reagent_containers/maunamug.dm b/code/modules/reagents/reagent_containers/maunamug.dm index 6e3ad20eb69..690a1f0cd65 100644 --- a/code/modules/reagents/reagent_containers/maunamug.dm +++ b/code/modules/reagents/reagent_containers/maunamug.dm @@ -24,16 +24,16 @@ if(open) . += "The battery case is open." -/obj/item/reagent_containers/glass/maunamug/process() +/obj/item/reagent_containers/glass/maunamug/process(delta_time) ..() if(on && (!cell || cell.charge <= 0)) //Check if we ran out of power change_power_status(FALSE) return FALSE - cell.use(10) //Basic cell goes for like 200 seconds, bluespace for 8000 + cell.use(5 * delta_time) //Basic cell goes for like 200 seconds, bluespace for 8000 if(!reagents.total_volume) return FALSE var/max_temp = min(500 + (500 * (0.2 * cell.rating)), 1000) // 373 to 1000 - reagents.adjust_thermal_energy(0.8 * cell.maxcharge * reagents.total_volume, max_temp = max_temp) // 4 kelvin every tick on a basic cell. 160k on bluespace + reagents.adjust_thermal_energy(0.4 * cell.maxcharge * reagents.total_volume * delta_time, max_temp = max_temp) // 4 kelvin every tick on a basic cell. 160k on bluespace reagents.handle_reactions() update_icon() if(reagents.chem_temp >= max_temp) diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm index 794ea5d6db6..5870dbefff9 100644 --- a/code/modules/recycling/disposal/bin.dm +++ b/code/modules/recycling/disposal/bin.dm @@ -382,7 +382,7 @@ //timed process //charge the gas reservoir and perform flush if ready -/obj/machinery/disposal/bin/process() +/obj/machinery/disposal/bin/process(delta_time) if(machine_stat & BROKEN) //nothing can happen if broken return @@ -415,7 +415,7 @@ var/pressure_delta = (SEND_PRESSURE*1.01) - air_contents.return_pressure() if(env.temperature > 0) - var/transfer_moles = 0.1 * pressure_delta*air_contents.volume/(env.temperature * R_IDEAL_GAS_EQUATION) + var/transfer_moles = 0.05 * delta_time * pressure_delta*air_contents.volume/(env.temperature * R_IDEAL_GAS_EQUATION) //Actually transfer the gas var/datum/gas_mixture/removed = env.remove(transfer_moles) diff --git a/code/modules/research/xenobiology/crossbreeding/_weapons.dm b/code/modules/research/xenobiology/crossbreeding/_weapons.dm index e67a36b326c..b67624cdeb1 100644 --- a/code/modules/research/xenobiology/crossbreeding/_weapons.dm +++ b/code/modules/research/xenobiology/crossbreeding/_weapons.dm @@ -97,11 +97,11 @@ Slimecrossing Weapons . = ..() ADD_TRAIT(src, TRAIT_NODROP, HAND_REPLACEMENT_TRAIT) -/obj/item/gun/magic/bloodchill/process() - charge_tick++ - if(charge_tick < recharge_rate || charges >= max_charges) +/obj/item/gun/magic/bloodchill/process(delta_time) + charge_timer += delta_time + if(charge_timer < recharge_rate || charges >= max_charges) return FALSE - charge_tick = 0 + charge_timer = 0 var/mob/living/M = loc if(istype(M) && M.blood_volume >= 20) charges++ diff --git a/code/modules/research/xenobiology/crossbreeding/recurring.dm b/code/modules/research/xenobiology/crossbreeding/recurring.dm index 4a094744f7f..a526d330763 100644 --- a/code/modules/research/xenobiology/crossbreeding/recurring.dm +++ b/code/modules/research/xenobiology/crossbreeding/recurring.dm @@ -11,7 +11,7 @@ Recurring extracts: var/extract_type var/obj/item/slime_extract/extract var/cooldown = 0 - var/max_cooldown = 5 //In sets of 2 seconds. + var/max_cooldown = 10 // In seconds /obj/item/slimecross/recurring/Initialize() . = ..() @@ -26,9 +26,9 @@ Recurring extracts: src.forceMove(extract) START_PROCESSING(SSobj,src) -/obj/item/slimecross/recurring/process() +/obj/item/slimecross/recurring/process(delta_time) if(cooldown > 0) - cooldown-- + cooldown -= delta_time else if(extract.Uses < 10 && extract.Uses > 0) extract.Uses++ cooldown = max_cooldown @@ -61,17 +61,17 @@ Recurring extracts: /obj/item/slimecross/recurring/metal extract_type = /obj/item/slime_extract/metal colour = "metal" - max_cooldown = 10 + max_cooldown = 20 /obj/item/slimecross/recurring/yellow extract_type = /obj/item/slime_extract/yellow colour = "yellow" - max_cooldown = 10 + max_cooldown = 20 /obj/item/slimecross/recurring/darkpurple extract_type = /obj/item/slime_extract/darkpurple colour = "dark purple" - max_cooldown = 10 + max_cooldown = 20 /obj/item/slimecross/recurring/darkblue extract_type = /obj/item/slime_extract/darkblue @@ -88,7 +88,7 @@ Recurring extracts: /obj/item/slimecross/recurring/sepia extract_type = /obj/item/slime_extract/sepia colour = "sepia" - max_cooldown = 18 //No infinite timestop for you! + max_cooldown = 36 //No infinite timestop for you! /obj/item/slimecross/recurring/cerulean extract_type = /obj/item/slime_extract/cerulean @@ -113,7 +113,7 @@ Recurring extracts: /obj/item/slimecross/recurring/gold extract_type = /obj/item/slime_extract/gold colour = "gold" - max_cooldown = 15 + max_cooldown = 30 /obj/item/slimecross/recurring/oil extract_type = /obj/item/slime_extract/oil @@ -130,9 +130,9 @@ Recurring extracts: /obj/item/slimecross/recurring/adamantine extract_type = /obj/item/slime_extract/adamantine colour = "adamantine" - max_cooldown = 10 + max_cooldown = 20 /obj/item/slimecross/recurring/rainbow extract_type = /obj/item/slime_extract/rainbow colour = "rainbow" - max_cooldown = 20 //It's pretty powerful. + max_cooldown = 40 //It's pretty powerful. diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index 636f6fc3274..781675858cc 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -119,7 +119,7 @@ log_shuttle("[key_name(user)] has authorized early shuttle launch in [COORD(src)]") // Now check if we're on our way . = TRUE - process() + process(SSMACHINES_DT) /obj/machinery/computer/emergency_shuttle/proc/clear_recent_action(mob/user) acted_recently -= user @@ -175,7 +175,7 @@ authorized += ID - process() + process(SSMACHINES_DT) /obj/machinery/computer/emergency_shuttle/Destroy() // Our fake IDs that the emag generated are just there for colour diff --git a/code/modules/spells/spell.dm b/code/modules/spells/spell.dm index 2880d3cd9df..dd06bc386a2 100644 --- a/code/modules/spells/spell.dm +++ b/code/modules/spells/spell.dm @@ -103,8 +103,8 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th var/charge_type = "recharge" //can be recharge or charges, see charge_max and charge_counter descriptions; can also be based on the holder's vars now, use "holder_var" for that - var/charge_max = 100 //recharge time in deciseconds if charge_type = "recharge" or starting charges if charge_type = "charges" - var/charge_counter = 0 //can only cast spells if it equals recharge, ++ each decisecond if charge_type = "recharge" or -- each cast if charge_type = "charges" + var/charge_max = 10 //recharge time in seconds if charge_type = "recharge" or starting charges if charge_type = "charges" + var/charge_counter = 0 //can only cast spells if it equals recharge, ++ each second if charge_type = "recharge" or -- each cast if charge_type = "charges" var/still_recharging_msg = "The spell is still recharging." var/recharging = TRUE @@ -298,9 +298,9 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th /obj/effect/proc_holder/spell/proc/start_recharge() recharging = TRUE -/obj/effect/proc_holder/spell/process() +/obj/effect/proc_holder/spell/process(delta_time) if(recharging && charge_type == "recharge" && (charge_counter < charge_max)) - charge_counter += 2 //processes 5 times per second instead of 10. + charge_counter += delta_time if(charge_counter >= charge_max) action.UpdateButtonIcon() charge_counter = charge_max diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm index cadd8e2d982..895309b0523 100644 --- a/code/modules/surgery/organs/organ_internal.dm +++ b/code/modules/surgery/organs/organ_internal.dm @@ -79,13 +79,13 @@ /obj/item/organ/proc/on_find(mob/living/finder) return -/obj/item/organ/process() - on_death() //Kinda hate doing it like this, but I really don't want to call process directly. +/obj/item/organ/process(delta_time) + on_death(delta_time) //Kinda hate doing it like this, but I really don't want to call process directly. -/obj/item/organ/proc/on_death() //runs decay when outside of a person +/obj/item/organ/proc/on_death(delta_time = 2) //runs decay when outside of a person if(organ_flags & (ORGAN_SYNTHETIC | ORGAN_FROZEN)) return - applyOrganDamage(maxHealth * decay_factor) + applyOrganDamage(maxHealth * decay_factor * 0.5 * delta_time) /obj/item/organ/proc/on_life() //repair organ damage if the organ is not failing if(organ_flags & ORGAN_FAILING) diff --git a/code/modules/tgui/tgui.dm b/code/modules/tgui/tgui.dm index 9393b9641fe..c971f34d88a 100644 --- a/code/modules/tgui/tgui.dm +++ b/code/modules/tgui/tgui.dm @@ -237,7 +237,7 @@ * Run an update cycle for this UI. Called internally by SStgui * every second or so. */ -/datum/tgui/process(force = FALSE) +/datum/tgui/process(delta_time, force = FALSE) if(closing) return var/datum/host = src_object.ui_host(user) diff --git a/code/modules/vehicles/atv.dm b/code/modules/vehicles/atv.dm index aa6d066dfba..b7884933ab9 100644 --- a/code/modules/vehicles/atv.dm +++ b/code/modules/vehicles/atv.dm @@ -79,10 +79,10 @@ START_PROCESSING(SSobj, src) return ..() -/obj/vehicle/ridden/atv/process() +/obj/vehicle/ridden/atv/process(delta_time) if(obj_integrity >= integrity_failure * max_integrity) return PROCESS_KILL - if(prob(20)) + if(DT_PROB(10, delta_time)) return var/datum/effect_system/smoke_spread/smoke = new smoke.set_up(0, src) diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm index 7be1eccf148..34afe73e8d2 100644 --- a/code/modules/vehicles/mecha/_mecha.dm +++ b/code/modules/vehicles/mecha/_mecha.dm @@ -371,23 +371,23 @@ break //in case user is holding two guns //processing internal damage, temperature, air regulation, alert updates, lights power use. -/obj/vehicle/sealed/mecha/process() +/obj/vehicle/sealed/mecha/process(delta_time) var/internal_temp_regulation = 1 if(internal_damage) if(internal_damage & MECHA_INT_FIRE) - if(!(internal_damage & MECHA_INT_TEMP_CONTROL) && prob(5)) + if(!(internal_damage & MECHA_INT_TEMP_CONTROL) && DT_PROB(2.5, delta_time)) clearInternalDamage(MECHA_INT_FIRE) if(internal_tank) var/datum/gas_mixture/int_tank_air = internal_tank.return_air() if(int_tank_air.return_pressure() > internal_tank.maximum_pressure && !(internal_damage & MECHA_INT_TANK_BREACH)) setInternalDamage(MECHA_INT_TANK_BREACH) if(int_tank_air && int_tank_air.return_volume() > 0) //heat the air_contents - int_tank_air.temperature = min(6000+T0C, int_tank_air.temperature+rand(10,15)) + int_tank_air.temperature = min(6000+T0C, int_tank_air.temperature+rand(5,7.5)*delta_time) if(cabin_air && cabin_air.return_volume()>0) - cabin_air.temperature = min(6000+T0C, cabin_air.return_temperature()+rand(10,15)) + cabin_air.temperature = min(6000+T0C, cabin_air.return_temperature()+rand(5,7.5)*delta_time) if(cabin_air.return_temperature() > max_temperature/2) - take_damage(4/round(max_temperature/cabin_air.return_temperature(),0.1), BURN, 0, 0) + take_damage(delta_time*2/round(max_temperature/cabin_air.return_temperature(),0.1), BURN, 0, 0) if(internal_damage & MECHA_INT_TEMP_CONTROL) internal_temp_regulation = 0 @@ -395,7 +395,7 @@ if(internal_damage & MECHA_INT_TANK_BREACH) //remove some air from internal tank if(internal_tank) var/datum/gas_mixture/int_tank_air = internal_tank.return_air() - var/datum/gas_mixture/leaked_gas = int_tank_air.remove_ratio(0.1) + var/datum/gas_mixture/leaked_gas = int_tank_air.remove_ratio(DT_PROB_RATE(0.05, delta_time)) if(loc) loc.assume_air(leaked_gas) air_update_turf() @@ -405,13 +405,13 @@ if(internal_damage & MECHA_INT_SHORT_CIRCUIT) if(get_charge()) spark_system.start() - cell.charge -= min(20,cell.charge) - cell.maxcharge -= min(20,cell.maxcharge) + cell.charge -= min(10 * delta_time, cell.charge) + cell.maxcharge -= min(10 * delta_time, cell.maxcharge) if(internal_temp_regulation) if(cabin_air && cabin_air.return_volume() > 0) var/delta = cabin_air.temperature - T20C - cabin_air.temperature -= max(-10, min(10, round(delta/4,0.1))) + cabin_air.temperature -= clamp(round(delta / 8, 0.1), -5, 5) * delta_time if(internal_tank) var/datum/gas_mixture/tank_air = internal_tank.return_air() diff --git a/code/modules/vehicles/mecha/equipment/tools/medical_tools.dm b/code/modules/vehicles/mecha/equipment/tools/medical_tools.dm index dab190aa83b..e914c4bea9b 100644 --- a/code/modules/vehicles/mecha/equipment/tools/medical_tools.dm +++ b/code/modules/vehicles/mecha/equipment/tools/medical_tools.dm @@ -219,7 +219,7 @@ /obj/item/mecha_parts/mecha_equipment/medical/sleeper/container_resist_act(mob/living/user) go_out() -/obj/item/mecha_parts/mecha_equipment/medical/sleeper/process() +/obj/item/mecha_parts/mecha_equipment/medical/sleeper/process(delta_time) if(..()) return if(!chassis.has_charge(energy_drain)) @@ -231,12 +231,12 @@ if(!M) return if(M.health > 0) - M.adjustOxyLoss(-1) - M.AdjustStun(-80) - M.AdjustKnockdown(-80) - M.AdjustParalyzed(-80) - M.AdjustImmobilized(-80) - M.AdjustUnconscious(-80) + M.adjustOxyLoss(-0.5 * delta_time) + M.AdjustStun(-40 * delta_time) + M.AdjustKnockdown(-40 * delta_time) + M.AdjustParalyzed(-40 * delta_time) + M.AdjustImmobilized(-40 * delta_time) + M.AdjustUnconscious(-40 * delta_time) if(M.reagents.get_reagent_amount(/datum/reagent/medicine/epinephrine) < 5) M.reagents.add_reagent(/datum/reagent/medicine/epinephrine, 5) chassis.use_power(energy_drain) @@ -258,7 +258,7 @@ var/list/processed_reagents var/max_syringes = 10 var/max_volume = 75 //max reagent volume - var/synth_speed = 5 //[num] reagent units per cycle + var/synth_speed = 2.5 //[num] reagent units per second energy_drain = 10 var/mode = 0 //0 - fire syringe, 1 - analyze reagents. range = MECHA_MELEE|MECHA_RANGED @@ -507,7 +507,7 @@ update_equip_info() -/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/process() +/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/process(delta_time) if(..()) return if(!processed_reagents.len || reagents.total_volume >= reagents.maximum_volume || !chassis.has_charge(energy_drain)) @@ -515,7 +515,7 @@ log_message("Reagent processing stopped.", LOG_MECHA) STOP_PROCESSING(SSobj, src) return - var/amount = synth_speed / processed_reagents.len + var/amount = delta_time * synth_speed / processed_reagents.len for(var/reagent in processed_reagents) reagents.add_reagent(reagent,amount) chassis.use_power(energy_drain) @@ -545,7 +545,7 @@ /obj/item/mecha_parts/mecha_equipment/medical/mechmedbeam/process() if(..()) return - medigun.process() + medigun.process(SSOBJ_DT) /obj/item/mecha_parts/mecha_equipment/medical/mechmedbeam/action(mob/source, atom/movable/target, params) medigun.process_fire(target, loc) diff --git a/code/modules/vehicles/mecha/equipment/tools/other_tools.dm b/code/modules/vehicles/mecha/equipment/tools/other_tools.dm index af1af168047..40bf6c804c8 100644 --- a/code/modules/vehicles/mecha/equipment/tools/other_tools.dm +++ b/code/modules/vehicles/mecha/equipment/tools/other_tools.dm @@ -196,7 +196,9 @@ icon_state = "repair_droid" energy_drain = 50 range = 0 - var/health_boost = 1 + + /// Repaired health per second + var/health_boost = 0.5 var/icon/droid_overlay var/list/repairable_damage = list(MECHA_INT_TEMP_CONTROL,MECHA_INT_TANK_BREACH) selectable = 0 @@ -239,15 +241,15 @@ send_byjax(chassis.occupants,"exosuit.browser", "[REF(src)]", get_equip_info()) -/obj/item/mecha_parts/mecha_equipment/repair_droid/process() +/obj/item/mecha_parts/mecha_equipment/repair_droid/process(delta_time) if(!chassis) STOP_PROCESSING(SSobj, src) return - var/h_boost = health_boost + var/h_boost = health_boost * delta_time var/repaired = 0 if(chassis.internal_damage & MECHA_INT_SHORT_CIRCUIT) h_boost *= -2 - else if(chassis.internal_damage && prob(15)) + else if(chassis.internal_damage && DT_PROB(8, delta_time)) for(var/int_dam_flag in repairable_damage) if(chassis.internal_damage & int_dam_flag) chassis.clearInternalDamage(int_dam_flag) @@ -323,7 +325,7 @@ return "*  [src.name] - [equip_ready?"A":"Dea"]ctivate" -/obj/item/mecha_parts/mecha_equipment/tesla_energy_relay/process() +/obj/item/mecha_parts/mecha_equipment/tesla_energy_relay/process(delta_time) if(!chassis || chassis.internal_damage & MECHA_INT_SHORT_CIRCUIT) STOP_PROCESSING(SSobj, src) return @@ -341,7 +343,7 @@ pow_chan = c break if(pow_chan) - var/delta = min(20, chassis.cell.maxcharge-cur_charge) + var/delta = min(10 * delta_time, chassis.cell.maxcharge-cur_charge) chassis.give_power(delta) A.use_power(delta*coeff, pow_chan) @@ -359,9 +361,12 @@ var/coeff = 100 var/obj/item/stack/sheet/fuel var/max_fuel = 150000 - var/fuel_per_cycle_idle = 25 - var/fuel_per_cycle_active = 200 - var/power_per_cycle = 20 + /// Fuel used per second while idle, not generating + var/fuelrate_idle = 12.5 + /// Fuel used per second while actively generating + var/fuelrate_active = 100 + /// Energy recharged per second + var/rechargerate = 10 /obj/item/mecha_parts/mecha_equipment/generator/Initialize() . = ..() @@ -418,7 +423,7 @@ /obj/item/mecha_parts/mecha_equipment/generator/attackby(weapon,mob/user, params) load_fuel(weapon) -/obj/item/mecha_parts/mecha_equipment/generator/process() +/obj/item/mecha_parts/mecha_equipment/generator/process(delta_time) if(!chassis) STOP_PROCESSING(SSobj, src) return @@ -432,11 +437,11 @@ log_message("Deactivated.", LOG_MECHA) STOP_PROCESSING(SSobj, src) return - var/use_fuel = fuel_per_cycle_idle + var/use_fuel = fuelrate_idle if(cur_charge < chassis.cell.maxcharge) - use_fuel = fuel_per_cycle_active - chassis.give_power(power_per_cycle) - fuel.amount -= min(use_fuel/MINERAL_MATERIAL_AMOUNT,fuel.amount) + use_fuel = fuelrate_active + chassis.give_power(rechargerate * delta_time) + fuel.amount -= min(delta_time * use_fuel / MINERAL_MATERIAL_AMOUNT, fuel.amount) update_equip_info() return TRUE @@ -446,17 +451,17 @@ desc = "An exosuit module that generates power using uranium as fuel. Pollutes the environment." icon_state = "tesla" max_fuel = 50000 - fuel_per_cycle_idle = 10 - fuel_per_cycle_active = 30 - power_per_cycle = 50 - var/rad_per_cycle = 30 + fuelrate_idle = 5 + fuelrate_active = 15 + rechargerate = 25 + var/radrate = 15 /obj/item/mecha_parts/mecha_equipment/generator/nuclear/generator_init() fuel = new /obj/item/stack/sheet/mineral/uranium(src, 0) -/obj/item/mecha_parts/mecha_equipment/generator/nuclear/process() +/obj/item/mecha_parts/mecha_equipment/generator/nuclear/process(delta_time) if(..()) - radiation_pulse(get_turf(src), rad_per_cycle) + radiation_pulse(get_turf(src), radrate * delta_time) /////////////////////////////////////////// THRUSTERS ///////////////////////////////////////////// diff --git a/code/modules/vehicles/mecha/mech_bay.dm b/code/modules/vehicles/mecha/mech_bay.dm index 8648de53fb8..3a4c4eca47a 100644 --- a/code/modules/vehicles/mecha/mech_bay.dm +++ b/code/modules/vehicles/mecha/mech_bay.dm @@ -21,7 +21,7 @@ circuit = /obj/item/circuitboard/machine/mech_recharger var/obj/vehicle/sealed/mecha/recharging_mech var/obj/machinery/computer/mech_bay_power_console/recharge_console - var/max_charge = 50 + var/recharge_power = 25 var/on = FALSE var/turf/recharging_turf = null @@ -42,14 +42,14 @@ var/MC for(var/obj/item/stock_parts/capacitor/C in component_parts) MC += C.rating - max_charge = MC * 25 + recharge_power = MC * 12.5 /obj/machinery/mech_bay_recharge_port/examine(mob/user) . = ..() if(in_range(user, src) || isobserver(user)) - . += "The status display reads: Base recharge rate at [max_charge]J per cycle." + . += "The status display reads: Recharge power [siunit(recharge_power, "W", 1)]." -/obj/machinery/mech_bay_recharge_port/process() +/obj/machinery/mech_bay_recharge_port/process(delta_time) if(machine_stat & NOPOWER || !recharge_console) return if(!recharging_mech) @@ -58,7 +58,7 @@ recharge_console.update_icon() if(recharging_mech && recharging_mech.cell) if(recharging_mech.cell.charge < recharging_mech.cell.maxcharge) - var/delta = min(max_charge, recharging_mech.cell.maxcharge - recharging_mech.cell.charge) + var/delta = min(recharge_power * delta_time, recharging_mech.cell.maxcharge - recharging_mech.cell.charge) recharging_mech.give_power(delta) use_power(delta*150) else diff --git a/code/modules/vehicles/secway.dm b/code/modules/vehicles/secway.dm index 42c11c1f4f9..3bf42c25988 100644 --- a/code/modules/vehicles/secway.dm +++ b/code/modules/vehicles/secway.dm @@ -25,10 +25,10 @@ START_PROCESSING(SSobj, src) return ..() -/obj/vehicle/ridden/secway/process() +/obj/vehicle/ridden/secway/process(delta_time) if(obj_integrity >= integrity_failure * max_integrity) return PROCESS_KILL - if(prob(20)) + if(DT_PROB(10, delta_time)) return var/datum/effect_system/smoke_spread/smoke = new smoke.set_up(0, src) diff --git a/code/modules/vending/_vending.dm b/code/modules/vending/_vending.dm index 91ba5605d34..3e69ab9d29f 100644 --- a/code/modules/vending/_vending.dm +++ b/code/modules/vending/_vending.dm @@ -122,8 +122,8 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C var/seconds_electrified = MACHINE_NOT_ELECTRIFIED ///When this is TRUE, we fire items at customers! We're broken! var/shoot_inventory = 0 - ///How likely this is to happen (prob 100) - var/shoot_inventory_chance = 2 + ///How likely this is to happen (prob 100) per second + var/shoot_inventory_chance = 1 //Stop spouting those godawful pitches! var/shut_up = 0 ///can we access the hidden inventory? @@ -871,7 +871,7 @@ GLOBAL_LIST_EMPTY(vending_products) SSblackbox.record_feedback("nested tally", "vending_machine_usage", 1, list("[type]", "[R.product_path]")) vend_ready = TRUE -/obj/machinery/vending/process() +/obj/machinery/vending/process(delta_time) if(machine_stat & (BROKEN|NOPOWER)) return PROCESS_KILL if(!active) @@ -881,12 +881,12 @@ GLOBAL_LIST_EMPTY(vending_products) seconds_electrified-- //Pitch to the people! Really sell it! - if(last_slogan + slogan_delay <= world.time && slogan_list.len > 0 && !shut_up && prob(5)) + if(last_slogan + slogan_delay <= world.time && slogan_list.len > 0 && !shut_up && DT_PROB(2.5, delta_time)) var/slogan = pick(slogan_list) speak(slogan) last_slogan = world.time - if(shoot_inventory && prob(shoot_inventory_chance)) + if(shoot_inventory && DT_PROB(shoot_inventory_chance, delta_time)) throw_item() /** * Speak the given message verbally diff --git a/code/modules/zombie/organs.dm b/code/modules/zombie/organs.dm index 1a418fa2fbe..237fa61995e 100644 --- a/code/modules/zombie/organs.dm +++ b/code/modules/zombie/organs.dm @@ -40,7 +40,7 @@ web of pus and viscera, bound tightly around the brain like some \ biological harness.") -/obj/item/organ/zombie_infection/process() +/obj/item/organ/zombie_infection/process(delta_time) if(!owner) return if(!(src in owner.internal_organs)) @@ -48,8 +48,8 @@ if(owner.mob_biotypes & MOB_MINERAL)//does not process in inorganic things return if (causes_damage && !iszombie(owner) && owner.stat != DEAD) - owner.adjustToxLoss(1) - if (prob(10)) + owner.adjustToxLoss(0.5 * delta_time) + if(DT_PROB(5, delta_time)) to_chat(owner, "You feel sick...") if(timer_id) return