mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
Refactors gravity checking (#4591)
Removes a lot of duplicated or redundant code from areas when checking gravity.
This commit is contained in:
@@ -237,7 +237,7 @@
|
||||
loadProgram(current_map.holodeck_programs["turnoff"], 0)
|
||||
|
||||
if(!linkedholodeck.has_gravity)
|
||||
linkedholodeck.gravitychange(1,linkedholodeck)
|
||||
linkedholodeck.gravitychange(TRUE)
|
||||
|
||||
active = 0
|
||||
use_power = 1
|
||||
@@ -333,17 +333,17 @@
|
||||
active = 1
|
||||
use_power = 1
|
||||
|
||||
if(A.has_gravity)
|
||||
A.gravitychange(0,A)
|
||||
if(A.has_gravity())
|
||||
A.gravitychange(FALSE)
|
||||
else
|
||||
A.gravitychange(1,A)
|
||||
A.gravitychange(TRUE)
|
||||
|
||||
/obj/machinery/computer/HolodeckControl/proc/emergencyShutdown()
|
||||
//Turn it back to the regular non-holographic room
|
||||
loadProgram(current_map.holodeck_programs["turnoff"], 0)
|
||||
|
||||
if(!linkedholodeck.has_gravity)
|
||||
linkedholodeck.gravitychange(1,linkedholodeck)
|
||||
linkedholodeck.gravitychange(TRUE)
|
||||
|
||||
active = 0
|
||||
use_power = 1
|
||||
|
||||
@@ -90,7 +90,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.has_gravity())
|
||||
make_floating(0)
|
||||
return
|
||||
else if (Check_Shoegrip())
|
||||
|
||||
@@ -327,7 +327,7 @@ var/list/slot_equipment_priority = list( \
|
||||
|
||||
if(!src.lastarea)
|
||||
src.lastarea = get_area(src.loc)
|
||||
if((istype(src.loc, /turf/space)) || (src.lastarea.has_gravity == 0))
|
||||
if((istype(src.loc, /turf/space)) || (src.lastarea.has_gravity() == 0))
|
||||
src.inertia_dir = get_dir(target, src)
|
||||
step(src, inertia_dir)
|
||||
|
||||
|
||||
@@ -576,7 +576,7 @@ default behaviour is:
|
||||
|
||||
if(!istype(M.loc, /turf/space))
|
||||
var/area/A = get_area(M)
|
||||
if(A.has_gravity)
|
||||
if(A.has_gravity())
|
||||
//this is the gay blood on floor shit -- Added back -- Skie
|
||||
if (M.lying && (prob(M.getBruteLoss() / 6)))
|
||||
var/turf/location = M.loc
|
||||
|
||||
@@ -436,7 +436,7 @@
|
||||
|
||||
if(!lastarea)
|
||||
lastarea = get_area(loc)
|
||||
if(!lastarea.has_gravity)
|
||||
if(!lastarea.has_gravity())
|
||||
return 0
|
||||
|
||||
return 1
|
||||
@@ -451,7 +451,7 @@
|
||||
return 1
|
||||
else
|
||||
var/area/A = T.loc
|
||||
if(A.has_gravity || shoegrip)
|
||||
if(A.has_gravity() || shoegrip)
|
||||
return 1
|
||||
|
||||
for(var/obj/O in orange(1, src))
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
// If we want to move up,but the current area has gravity. Invoke CanAvoidGravity()
|
||||
// to check if this move is possible.
|
||||
if(direction == UP && area.has_gravity && !CanAvoidGravity())
|
||||
if(direction == UP && area.has_gravity() && !CanAvoidGravity())
|
||||
to_chat(src, "<span class='warning'>Gravity stops you from moving upward.</span>")
|
||||
return FALSE
|
||||
|
||||
@@ -314,7 +314,7 @@
|
||||
/atom/movable/proc/fall_impact(levels_fallen, stopped_early = FALSE)
|
||||
// No gravity, stop falling into spess!
|
||||
var/area/area = get_area(src)
|
||||
if (istype(loc, /turf/space) || (area && !area.has_gravity))
|
||||
if (istype(loc, /turf/space) || (area && !area.has_gravity()))
|
||||
return FALSE
|
||||
|
||||
visible_message("\The [src] falls and lands on \the [loc]!", "You hear a thud!")
|
||||
@@ -325,7 +325,7 @@
|
||||
/mob/living/fall_impact(levels_fallen, stopped_early = FALSE)
|
||||
// No gravity, stop falling into spess!
|
||||
var/area/area = get_area(src)
|
||||
if (istype(loc, /turf/space) || (area && !area.has_gravity))
|
||||
if (istype(loc, /turf/space) || (area && !area.has_gravity()))
|
||||
return FALSE
|
||||
|
||||
visible_message("\The [src] falls and lands on \the [loc]!",
|
||||
@@ -354,7 +354,7 @@
|
||||
/mob/living/carbon/human/fall_impact(levels_fallen, stopped_early = FALSE)
|
||||
// No gravity, stop falling into spess!
|
||||
var/area/area = get_area(src)
|
||||
if (istype(loc, /turf/space) || (area && !area.has_gravity))
|
||||
if (istype(loc, /turf/space) || (area && !area.has_gravity()))
|
||||
return FALSE
|
||||
|
||||
var/obj/item/weapon/rig/rig = get_rig()
|
||||
@@ -503,7 +503,7 @@
|
||||
/atom/movable/proc/fall_collateral(levels_fallen, stopped_early = FALSE)
|
||||
// No gravity, stop falling into spess!
|
||||
var/area/area = get_area(src)
|
||||
if (istype(loc, /turf/space) || (area && !area.has_gravity))
|
||||
if (istype(loc, /turf/space) || (area && !area.has_gravity()))
|
||||
return null
|
||||
|
||||
var/list/fall_specs = fall_get_specs(levels_fallen)
|
||||
|
||||
@@ -341,13 +341,13 @@
|
||||
var/alert = 0
|
||||
var/area/area = get_area(src)
|
||||
if(new_state) // If we turned on
|
||||
if(gravity_in_level() == 0)
|
||||
if(!area.has_gravity())
|
||||
alert = 1
|
||||
gravity_is_on = 1
|
||||
investigate_log("was brought online and is now producing gravity for this level.", "gravity")
|
||||
message_admins("The gravity generator was brought online. (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>[area.name]</a>)")
|
||||
else
|
||||
if(gravity_in_level() == 1)
|
||||
if(area.has_gravity())
|
||||
alert = 1
|
||||
gravity_is_on = 0
|
||||
investigate_log("was brought offline and there is now no gravity for this level.", "gravity")
|
||||
@@ -423,14 +423,6 @@
|
||||
shake_camera(M, 5, 1)
|
||||
M.playsound_local(our_turf, 'sound/effects/alert.ogg', 100, 1, 0.5)
|
||||
|
||||
/obj/machinery/gravity_generator/main/proc/gravity_in_level()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!T)
|
||||
return 0
|
||||
if(SSmachinery.gravity_generators)
|
||||
return length(SSmachinery.gravity_generators)
|
||||
return 0
|
||||
|
||||
/obj/machinery/gravity_generator/main/proc/update_list()
|
||||
var/turf/T = get_turf(src.loc)
|
||||
if(T)
|
||||
@@ -439,18 +431,11 @@
|
||||
|
||||
if(on)
|
||||
for(var/area/A in localareas)
|
||||
A.has_gravity = 1
|
||||
if(round_start)
|
||||
A.gravitychange(A.has_gravity,A,1)
|
||||
else
|
||||
A.gravitychange(A.has_gravity,A)
|
||||
if(round_start == 1)
|
||||
round_start = 0
|
||||
A.gravitychange(TRUE)
|
||||
SSmachinery.gravity_generators += src
|
||||
else
|
||||
for(var/area/A in localareas)
|
||||
A.has_gravity = 0
|
||||
A.gravitychange(A.has_gravity,A)
|
||||
A.gravitychange(FALSE)
|
||||
SSmachinery.gravity_generators -= src
|
||||
|
||||
/obj/machinery/gravity_generator/main/Initialize()
|
||||
|
||||
@@ -175,9 +175,8 @@
|
||||
/obj/item/projectile/energy/gravitydisabler/on_impact(atom/target)
|
||||
. = ..()
|
||||
var/area/A = get_area(target)
|
||||
if(A && A.has_gravity == 1)
|
||||
A.has_gravity = 0
|
||||
A.gravitychange(A.has_gravity,A)
|
||||
if(A && A.has_gravity())
|
||||
A.gravitychange(FALSE)
|
||||
addtimer(CALLBACK(src, .proc/turnongravity), 150)
|
||||
|
||||
if(istype(target, /obj/machinery/gravity_generator/main))
|
||||
@@ -185,8 +184,7 @@
|
||||
T.eshutoff()
|
||||
|
||||
/obj/item/projectile/energy/gravitydisabler/proc/turnongravity(var/area/A)
|
||||
A.has_gravity = 1
|
||||
A.gravitychange(A.has_gravity,A)
|
||||
A.gravitychange(TRUE)
|
||||
|
||||
/obj/item/projectile/energy/bee
|
||||
name = "bees"
|
||||
|
||||
Reference in New Issue
Block a user