From 2840eac6725c113dcbe7d298c2ff51d45e9256de Mon Sep 17 00:00:00 2001 From: Batrachophreno Date: Wed, 30 Jul 2025 06:16:22 -0400 Subject: [PATCH] Grav Gen fix, zero-g inertial drift fix (throwing works again) (#21074) Weird ephemeral behavior. Previous debugging of this never got anywhere because for some reason, the gravgen var/list localareas would not populate. Changing method suddenly made zero-g work perfectly: momentum is back, throwing objects to move in the opposite direction works, etc. Definitely one for test merge since I'm not sure WHY its working perfectly again in local tests with this change. --- code/game/turfs/turf.dm | 5 +- code/modules/power/gravitygenerator.dm | 9 ++-- html/changelogs/Batrachophreno-Gravity.yml | 58 ++++++++++++++++++++++ 3 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 html/changelogs/Batrachophreno-Gravity.yml diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 1dfe263a74e..6e508d9c96a 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -484,11 +484,12 @@ ..() /turf/proc/inertial_drift(atom/movable/A as mob|obj) - if(!(A.last_move)) return + if(!(A.last_move)) + return if((istype(A, /mob/) && src.x > 2 && src.x < (world.maxx - 1) && src.y > 2 && src.y < (world.maxy-1))) var/mob/M = A if(M.Allow_Spacemove(1)) - M.inertia_dir = 0 + M.inertia_dir = 0 return spawn(5) if((M && !(M.anchored) && !(M.pulledby) && (M.loc == src))) diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm index 3bea8335cf3..112647a5e20 100644 --- a/code/modules/power/gravitygenerator.dm +++ b/code/modules/power/gravitygenerator.dm @@ -381,9 +381,9 @@ set_state(0) else if(charging_state == POWER_UP) - charge_count += 2 + charge_count += rand(1,5) else if(charging_state == POWER_DOWN) - charge_count -= 2 + charge_count -= rand(1,5) if(charge_count % 4 == 0 && prob(75)) // Let them know it is charging/discharging. playsound(src.loc, 'sound/effects/EMPulse.ogg', 100, 1) @@ -418,8 +418,7 @@ current_overlay = overlay_state /obj/machinery/gravity_generator/main/proc/pulse_radiation(var/amount = 20) - for(var/mob/living/L in view(7, src)) - L.apply_damage(amount, DAMAGE_RADIATION, damage_flags = DAMAGE_FLAG_DISPERSED) + SSradiation.radiate(src, amount) // Shake everyone on the z level to let them know that gravity was enagaged/disenagaged. /obj/machinery/gravity_generator/main/proc/shake_everyone() @@ -463,7 +462,7 @@ linked.gravity_generator = src /obj/machinery/gravity_generator/main/proc/updateareas() - for(var/area/A in get_sorted_areas()) + for(var/area/A in GLOB.the_station_areas) if(!(get_area_type(A) == AREA_STATION)) continue localareas += A diff --git a/html/changelogs/Batrachophreno-Gravity.yml b/html/changelogs/Batrachophreno-Gravity.yml new file mode 100644 index 00000000000..627045ab7d3 --- /dev/null +++ b/html/changelogs/Batrachophreno-Gravity.yml @@ -0,0 +1,58 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: Batrachophrenoboocosmomachia + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Fixed inconsistent behavior with gravity generator turning on/shutting off, as well as associated inertial behaviors (throwing objects in zero g, etc.)"