[MIRROR] Fixes space drift, renames has_gravity() (#9154)

Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com>
Co-authored-by: CHOMPStation2 <chompsation2@gmail.com>
Co-authored-by: Kashargul <KashL@t-online.de>
This commit is contained in:
CHOMPStation2
2024-10-04 15:30:54 -07:00
committed by GitHub
parent 18e8928f96
commit f1949d0bd5
26 changed files with 50 additions and 50 deletions

View File

@@ -128,7 +128,7 @@
#define COMSIG_ATOM_DIR_CHANGE "atom_dir_change"
///from base of atom/handle_atom_del(): (atom/deleted)
#define COMSIG_ATOM_CONTENTS_DEL "atom_contents_del"
///from base of atom/has_gravity(): (turf/location, list/forced_gravities)
///from base of atom/get_gravity(): (turf/location, list/forced_gravities)
#define COMSIG_ATOM_HAS_GRAVITY "atom_has_gravity"
///from proc/get_rad_contents(): ()
#define COMSIG_ATOM_RAD_PROBE "atom_rad_probe"
@@ -219,7 +219,7 @@
///from base of turf/ChangeTurf(): (path, list/new_baseturfs, flags, list/transferring_comps)
#define COMSIG_TURF_CHANGE "turf_change"
///from base of atom/has_gravity(): (atom/asker, list/forced_gravities)
///from base of atom/get_gravity(): (atom/asker, list/forced_gravities)
#define COMSIG_TURF_HAS_GRAVITY "turf_has_gravity"
///from base of turf/multiz_turf_del(): (turf/source, direction)
#define COMSIG_TURF_MULTIZ_DEL "turf_multiz_del"

View File

@@ -122,7 +122,7 @@ SUBSYSTEM_DEF(throwing)
//calculate how many tiles to move, making up for any missed ticks.
var/tilestomove = CEILING(min(((((world.time+world.tick_lag) - start_time + delayed_time) * speed) - (dist_travelled ? dist_travelled : -1)), speed*MAX_TICKS_TO_MAKE_UP) * (world.tick_lag * SSthrowing.wait), 1)
while (tilestomove-- > 0)
if ((dist_travelled >= maxrange || AM.loc == target_turf) && (A && A.has_gravity()))
if ((dist_travelled >= maxrange || AM.loc == target_turf) && (A && A.get_gravity()))
finalize()
return

View File

@@ -119,7 +119,7 @@
ridden.unbuckle_mob(M)
/datum/riding/proc/Process_Spacemove(direction)
if(ridden.has_gravity())
if(ridden.get_gravity())
return TRUE
return FALSE

View File

@@ -37,7 +37,7 @@
var/static_environ = 0
var/music = null
var/has_gravity = 1
var/has_gravity = 1 // Don't check this var directly; use get_gravity() instead
var/secret_name = FALSE // This tells certain things that display areas' names that they shouldn't display this area's name.
var/obj/machinery/power/apc/apc = null
var/no_air = null
@@ -382,7 +382,7 @@ var/list/mob/living/forced_ambiance_list = new
if(!L.lastarea)
L.lastarea = src
var/area/oldarea = L.lastarea
if((oldarea.has_gravity == 0) && (has_gravity == 1) && (L.m_intent == "run")) // Being ready when you change areas gives you a chance to avoid falling all together.
if((oldarea.get_gravity() == 0) && (get_gravity() == 1) && (L.m_intent == "run")) // Being ready when you change areas gives you a chance to avoid falling all together.
thunk(L)
L.update_floating( L.Check_Dense_Object() )
@@ -427,10 +427,10 @@ var/list/mob/living/forced_ambiance_list = new
src.has_gravity = gravitystate
for(var/mob/M in src)
if(has_gravity)
if(get_gravity())
thunk(M)
M.update_floating( M.Check_Dense_Object() )
M.update_gravity(has_gravity)
M.update_gravity(get_gravity())
/area/proc/thunk(mob)
if(istype(get_turf(mob), /turf/space)) // Can't fall onto nothing.
@@ -471,17 +471,17 @@ var/list/mob/living/forced_ambiance_list = new
for(var/obj/machinery/door/blast/temp_blast in src)
temp_blast.open()
/area/has_gravity()
/area/get_gravity()
return has_gravity
/area/space/has_gravity()
/area/space/get_gravity()
return 0
/proc/has_gravity(atom/AT, turf/T)
/proc/get_gravity(atom/AT, turf/T)
if(!T)
T = get_turf(AT)
var/area/A = get_area(T)
if(A && A.has_gravity())
if(A && A.get_gravity())
return 1
return 0

View File

@@ -571,13 +571,13 @@
/atom/proc/InsertedContents()
return contents
/atom/proc/has_gravity(turf/T)
/atom/proc/get_gravity(turf/T)
if(!T || !isturf(T))
T = get_turf(src)
if(istype(T, /turf/space)) // Turf never has gravity
return FALSE
var/area/A = get_area(T)
if(A && A.has_gravity())
if(A && A.get_gravity())
return TRUE
return FALSE

View File

@@ -167,7 +167,7 @@
return (stabilization_enabled && has_charge(step_energy_drain))
/obj/mecha/combat/fighter/proc/consider_gravity(var/moved = FALSE)
var/gravity = has_gravity()
var/gravity = get_gravity()
if(gravity && ground_capable && occupant)
start_hover()
else if((!gravity && ground_capable) || !occupant)

View File

@@ -136,7 +136,7 @@
W.set_color()
W.set_up(my_target)
if((istype(usr.loc, /turf/space)) || (usr.lastarea.has_gravity == 0))
if((istype(usr.loc, /turf/space)) || (usr.lastarea.get_gravity() == 0))
user.inertia_dir = get_dir(target, user)
step(user, user.inertia_dir)
else

View File

@@ -160,7 +160,7 @@
/turf/MouseDrop_T(atom/movable/O as mob|obj, mob/user as mob)
var/turf/T = get_turf(user)
var/area/A = T.loc
if((istype(A) && !(A.has_gravity)) || (istype(T,/turf/space)))
if((istype(A) && !(A.get_gravity())) || (istype(T,/turf/space)))
return
if(istype(O, /obj/screen))
return
@@ -315,7 +315,7 @@
// Called when turf is hit by a thrown object
/turf/hitby(atom/movable/AM as mob|obj, var/speed)
if(density)
if(!has_gravity(AM)) //Checked a different codebase for reference. Turns out it's only supposed to happen in no-gravity
if(!get_gravity(AM)) //Checked a different codebase for reference. Turns out it's only supposed to happen in no-gravity
spawn(2)
step(AM, turn(AM.last_move, 180)) //This makes it float away after hitting a wall in 0G
if(isliving(AM))

View File

@@ -941,7 +941,7 @@
if(wearer.transforming || !wearer.canmove)
return
if((istype(wearer.loc, /turf/space)) || (wearer.lastarea.has_gravity == 0))
if((istype(wearer.loc, /turf/space)) || (wearer.lastarea.get_gravity() == 0))
if(!wearer.Process_Spacemove(0))
return 0

View File

@@ -112,7 +112,7 @@
data["safetyDisabled"] = safety_disabled
data["emagged"] = emagged
data["gravity"] = FALSE
if(linkedholodeck.has_gravity)
if(linkedholodeck.get_gravity())
data["gravity"] = TRUE
return data
@@ -264,7 +264,7 @@
else
loadProgram(powerdown_program, 0)
if(!linkedholodeck.has_gravity)
if(!linkedholodeck.get_gravity())
linkedholodeck.gravitychange(1)
active = 0
@@ -371,7 +371,7 @@
active = 1
update_use_power(USE_POWER_IDLE)
if(A.has_gravity)
if(A.get_gravity())
A.gravitychange(0)
else
A.gravitychange(1)
@@ -380,7 +380,7 @@
//Turn it back to the regular non-holographic room
loadProgram(powerdown_program, 0)
if(!linkedholodeck.has_gravity)
if(!linkedholodeck.get_gravity())
linkedholodeck.gravitychange(1)
active = 0

View File

@@ -78,7 +78,7 @@
data["supportedPrograms"] = program_list
data["currentProgram"] = current_program
data["immersion"] = immersion
if(my_area?.has_gravity)
if(my_area?.get_gravity())
data["gravity"] = 1
else
data["gravity"] = 0
@@ -147,7 +147,7 @@
last_gravity_change = world.time
if(A.has_gravity)
if(A.get_gravity())
A.gravitychange(0)
else
A.gravitychange(1)

View File

@@ -94,7 +94,7 @@ note dizziness decrements automatically in the mob's Life() proc.
var/turf/turf = get_turf(src)
if(!istype(turf,/turf/space))
var/area/A = turf.loc
if(istype(A) && A.has_gravity)
if(istype(A) && A.get_gravity())
make_floating(0)
return
else if (Check_Shoegrip())

View File

@@ -1766,7 +1766,7 @@
// Drag damage is handled in a parent
/mob/living/carbon/human/dragged(var/mob/living/dragger, var/oldloc)
var/area/A = get_area(src)
if(lying && !buckled && A.has_gravity() && prob(getBruteLoss() * 200 / maxHealth))
if(lying && !buckled && A.get_gravity() && prob(getBruteLoss() * 200 / maxHealth))
var/bloodtrail = 1
if(species?.flags & NO_BLOOD)
bloodtrail = 0

View File

@@ -279,7 +279,7 @@
if(m_intent == "run" && step_count++ % 2 != 0)
check_vorefootstep(m_intent, T) //CHOMPstation edit: sloshing reagent belly walk system
*/
if(shoes && loc == T && has_gravity(loc) && !flying)
if(shoes && loc == T && get_gravity(loc) && !flying)
if(SEND_SIGNAL(shoes, COMSIG_SHOES_STEP_ACTION, m_intent)) //CHOMPEdit - Shoe step comsig
return
/*
@@ -302,7 +302,7 @@
if(buckled || lying || throwing)
return // people flying, lying down or sitting do not step
if(!has_gravity(src) && prob(75))
if(!get_gravity(src) && prob(75))
return // Far less likely to make noise in no gravity
playsound(T, S, volume, FALSE)

View File

@@ -25,7 +25,7 @@
return // no feet = no slosh? Might prevent some entities from sloshing around
if(buckled || lying || throwing)
return // people flying, lying down or sitting do not slosh
if(!has_gravity(src) && prob(75))
if(!get_gravity(src) && prob(75))
return // Far less likely to make noise in no gravity
playsound(T, S, volume, FALSE, preference = /datum/client_preference/digestion_noises)
return

View File

@@ -64,7 +64,7 @@
//stuff in the stomach
//handle_stomach() //VOREStation Code
update_gravity(mob_has_gravity())
update_gravity(mob_get_gravity())
update_pulling()

View File

@@ -1211,7 +1211,7 @@
src.visible_message(span_warning("[src] has thrown [item]."))
if((isspace(src.loc)) || (src.lastarea?.has_gravity == 0))
if((isspace(src.loc)) || (src.lastarea?.get_gravity() == 0))
src.inertia_dir = get_dir(target, src)
step(src, inertia_dir)
item.throw_at(target, throw_range, item.throw_speed, src)
@@ -1244,7 +1244,7 @@
//actually throw it!
src.visible_message(span_warning("[src] has thrown [item]."))
if((isspace(src.loc)) || (src.lastarea?.has_gravity == 0))
if((isspace(src.loc)) || (src.lastarea?.get_gravity() == 0))
src.inertia_dir = get_dir(target, src)
step(src, inertia_dir)

View File

@@ -273,7 +273,7 @@ default behaviour is:
/mob/living/proc/dragged(var/mob/living/dragger, var/oldloc)
var/area/A = get_area(src)
if(lying && !buckled && pull_damage() && A.has_gravity() && (prob(getBruteLoss() * 200 / maxHealth)))
if(lying && !buckled && pull_damage() && A.get_gravity() && (prob(getBruteLoss() * 200 / maxHealth)))
adjustBruteLoss(2)
visible_message(span_danger("\The [src]'s [isSynthetic() ? "state" : "wounds"] worsen terribly from being dragged!"))
@@ -312,7 +312,7 @@ default behaviour is:
if(!isturf(loc))
return
else if(lastarea?.has_gravity == 0)
else if(lastarea?.get_gravity() == 0)
inertial_drift()
//VOREStation Edit Start
else if(flying)

View File

@@ -216,7 +216,7 @@
return result
// Can't control ourselves when drifting
if((isspace(loc) || my_mob.lastarea?.has_gravity == 0) && isturf(loc))
if((isspace(loc) || my_mob.lastarea?.get_gravity() == 0) && isturf(loc))
if(!my_mob.Process_Spacemove(0))
return 0
@@ -498,7 +498,7 @@
if(istype(turf,/turf/simulated/floor)) // Floors don't count if they don't have gravity
var/area/A = turf.loc
if(istype(A) && A.has_gravity == 0)
if(istype(A) && A.get_gravity() == 0)
if(shoegrip == null)
shoegrip = Check_Shoegrip() //Shoegrip is only ever checked when a zero-gravity floor is encountered to reduce load
if(!shoegrip)
@@ -539,8 +539,8 @@
return(prob_slip)
*/// CHOMPedit end.
/mob/proc/mob_has_gravity(turf/T)
return has_gravity(src, T)
/mob/proc/mob_get_gravity(turf/T)
return get_gravity(src, T)
/mob/proc/update_gravity()
return

View File

@@ -68,7 +68,7 @@
var/area/area = get_area(src)
if(area.has_gravity() && !can_overcome_gravity())
if(area.get_gravity() && !can_overcome_gravity())
if(direction == UP)
var/obj/structure/lattice/lattice = locate() in destination.contents
var/obj/structure/catwalk/catwalk = locate() in destination.contents
@@ -278,7 +278,7 @@
// No gravity in space, apparently.
var/area/area = get_area(src)
if(!area.has_gravity())
if(!area.get_gravity())
return
if(throwing)

View File

@@ -393,7 +393,7 @@ GLOBAL_LIST_EMPTY(gravity_generators)
for(var/mob/M as anything in player_list)
if(!(M.z in levels))
continue
M.update_gravity(M.mob_has_gravity())
M.update_gravity(M.mob_get_gravity())
shake_camera(M, 15, 1)
M.playsound_local(src, null, 50, 1, 0.5, S = alert_sound)

View File

@@ -295,9 +295,9 @@
var/new_grav = 1
if(destination.flags & SLANDMARK_FLAG_ZERO_G)
var/area/new_area = get_area(destination)
new_grav = new_area.has_gravity
new_grav = new_area.get_gravity()
for(var/area/our_area in shuttle_area)
if(our_area.has_gravity != new_grav)
if(our_area.get_gravity() != new_grav)
our_area.gravitychange(new_grav)
// TODO - Old code used to throw stuff out of the way instead of squashing. Should we?

View File

@@ -120,9 +120,9 @@
if(I.item_flags & ABSTRACT)
return
//Annoyingly, our flight code doesn't set the movement_type, nor do we have a define for it. So I'm not adding it yet.
//if(arrived.movement_type & (FLYING|FLOATING) || !arrived.has_gravity())
//if(arrived.movement_type & (FLYING|FLOATING) || !arrived.get_gravity())
*/
if(!arrived.has_gravity())
if(!arrived.get_gravity())
return
if(ismob(arrived) && !arrived.density) // Prevents 10 overlapping mice from making an unholy sound while moving
return

View File

@@ -93,7 +93,7 @@
if(steps % 2)
return
if(steps != 0 && !has_gravity(source)) // don't need to step as often when you hop around
if(steps != 0 && !get_gravity(source)) // don't need to step as often when you hop around
return
. = list(

View File

@@ -86,7 +86,7 @@
if(source.buckled || source.lying || source.throwing || source.is_incorporeal())
return
if(!has_gravity(source) && prob(75))
if(!get_gravity(source) && prob(75))
return
playsound(source.loc, S, volume, FALSE, preference = /datum/preference/toggle/digestion_noises)

View File

@@ -24,7 +24,7 @@
if(buckled || lying || throwing)
return // people flying, lying down or sitting do not slosh
if(!has_gravity(src) && prob(75))
if(!get_gravity(src) && prob(75))
return // Far less likely to make noise in no gravity
playsound(T, S, volume, FALSE, preference = /datum/client_preference/digestion_noises)
return