mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-31 09:00:25 +01:00
Refactored slipping code a little.
Moved human Check_Shoegrip() override to human_movement. Parent is in mob_movement, makes sense to keep them in line imo. Renamed Process_Spaceslipping to slip_chance because it doesn't do any kind of processing. And I hate naming of these procs. Refactored human slip_chance override to use parent proc instead of doing same checks all over again. Removed update_gravity (and its only call in life()) and mob_has_gravity(). First one was called precisely once and did /nothing/. Mob-level proc just returns and it is never overriden anywhere. Second one is just a call for has_gravity, meaningless and used only once in that removed line. Refactored Check_Dense_Object (god I hate these names) to be less, for lack fo better word, retarded. Instead of weird var for keeping number of dense objects (that is never used, check only used as binary true/false), it now just returns value when it finds a suitabl object. Used trange and orange instead of oview to avoid fuckery in non-lit places.
This commit is contained in:
@@ -1365,10 +1365,6 @@
|
||||
if(update_hud)
|
||||
handle_regular_hud_updates()
|
||||
|
||||
/mob/living/carbon/human/Check_Shoegrip()
|
||||
if(shoes && (shoes.item_flags & NOSLIP) && istype(shoes, /obj/item/clothing/shoes/magboots)) //magboots + dense_object = no floating
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/mob/living/carbon/human/can_stand_overridden()
|
||||
if(wearing_rig && wearing_rig.ai_can_move_suit(check_for_ai = 1))
|
||||
|
||||
@@ -87,18 +87,9 @@
|
||||
return 0
|
||||
|
||||
|
||||
/mob/living/carbon/human/Process_Spaceslipping(var/prob_slip = 5)
|
||||
//If knocked out we might just hit it and stop. This makes it possible to get dead bodies and such.
|
||||
|
||||
if(species.flags & NO_SLIP)
|
||||
return
|
||||
|
||||
if(stat)
|
||||
prob_slip = 0 // Changing this to zero to make it line up with the comment, and also, make more sense.
|
||||
|
||||
//Do we have magboots or such on if so no slip
|
||||
if(istype(shoes, /obj/item/clothing/shoes/magboots) && (shoes.item_flags & NOSLIP))
|
||||
prob_slip = 0
|
||||
/mob/living/carbon/human/slip_chance(var/prob_slip = 5)
|
||||
if(!..())
|
||||
return 0
|
||||
|
||||
//Check hands and mod slip
|
||||
if(!l_hand) prob_slip -= 2
|
||||
@@ -106,5 +97,11 @@
|
||||
if (!r_hand) prob_slip -= 2
|
||||
else if(r_hand.w_class <= 2) prob_slip -= 1
|
||||
|
||||
prob_slip = round(prob_slip)
|
||||
return(prob_slip)
|
||||
return prob_slip
|
||||
|
||||
/mob/living/carbon/human/Check_Shoegrip()
|
||||
if(species.flags & NO_SLIP)
|
||||
return 1
|
||||
if(shoes && (shoes.item_flags & NOSLIP) && istype(shoes, /obj/item/clothing/shoes/magboots)) //magboots + dense_object = no floating
|
||||
return 1
|
||||
return 0
|
||||
@@ -38,8 +38,6 @@
|
||||
//stuff in the stomach
|
||||
handle_stomach()
|
||||
|
||||
update_gravity(mob_has_gravity())
|
||||
|
||||
update_pulling()
|
||||
|
||||
for(var/obj/item/weapon/grab/G in src)
|
||||
|
||||
@@ -248,7 +248,7 @@ var/list/mob_hat_cache = list()
|
||||
..()
|
||||
|
||||
//DRONE MOVEMENT.
|
||||
/mob/living/silicon/robot/drone/Process_Spaceslipping(var/prob_slip)
|
||||
/mob/living/silicon/robot/drone/slip_chance(var/prob_slip)
|
||||
return 0
|
||||
|
||||
//CONSOLE PROCS
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/mob/living/silicon/robot/Process_Spaceslipping(var/prob_slip)
|
||||
/mob/living/silicon/robot/slip_chance(var/prob_slip)
|
||||
if(module && module.no_slip)
|
||||
return 0
|
||||
..(prob_slip)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
return
|
||||
|
||||
/mob/proc/setMoveCooldown(var/timeout)
|
||||
if(client)
|
||||
if(client)
|
||||
client.move_delay = max(world.time + timeout, client.move_delay)
|
||||
|
||||
/client/North()
|
||||
@@ -450,15 +450,15 @@
|
||||
if(!Check_Dense_Object()) //Nothing to push off of so end here
|
||||
update_floating(0)
|
||||
return 0
|
||||
|
||||
update_floating(1)
|
||||
|
||||
update_floating(1)
|
||||
|
||||
if(restrained()) //Check to see if we can do things
|
||||
return 0
|
||||
|
||||
//Check to see if we slipped
|
||||
if(prob(Process_Spaceslipping(5)) && !buckled)
|
||||
src << "\blue <B>You slipped!</B>"
|
||||
if(prob(slip_chance(5)) && !buckled)
|
||||
src << "<span class='warning'>You slipped!</span>"
|
||||
src.inertia_dir = src.last_move
|
||||
step(src, src.inertia_dir)
|
||||
return 0
|
||||
@@ -468,52 +468,30 @@
|
||||
|
||||
/mob/proc/Check_Dense_Object() //checks for anything to push off in the vicinity. also handles magboots on gravity-less floors tiles
|
||||
|
||||
var/dense_object = 0
|
||||
var/shoegrip
|
||||
var/shoegrip = Check_Shoegrip()
|
||||
|
||||
for(var/turf/turf in oview(1,src))
|
||||
if(istype(turf,/turf/space))
|
||||
continue
|
||||
for(var/turf/simulated/T in trange(1,src)) //we only care for non-space turfs
|
||||
if(T.density) //walls work
|
||||
return 1
|
||||
else
|
||||
var/area/A = T.loc
|
||||
if(A.has_gravity || shoegrip)
|
||||
return 1
|
||||
|
||||
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(shoegrip == null)
|
||||
shoegrip = Check_Shoegrip() //Shoegrip is only ever checked when a zero-gravity floor is encountered to reduce load
|
||||
if(!shoegrip)
|
||||
continue
|
||||
for(var/obj/O in orange(1, src))
|
||||
if(istype(O, /obj/structure/lattice))
|
||||
return 1
|
||||
if(O && O.density && O.anchored)
|
||||
return 1
|
||||
|
||||
dense_object++
|
||||
break
|
||||
|
||||
if(!dense_object && (locate(/obj/structure/lattice) in oview(1, src)))
|
||||
dense_object++
|
||||
|
||||
//Lastly attempt to locate any dense objects we could push off of
|
||||
//TODO: If we implement objects drifing in space this needs to really push them
|
||||
//Due to a few issues only anchored and dense objects will now work.
|
||||
if(!dense_object)
|
||||
for(var/obj/O in oview(1, src))
|
||||
if((O) && (O.density) && (O.anchored))
|
||||
dense_object++
|
||||
break
|
||||
|
||||
return dense_object
|
||||
return 0
|
||||
|
||||
/mob/proc/Check_Shoegrip()
|
||||
return 0
|
||||
|
||||
/mob/proc/Process_Spaceslipping(var/prob_slip = 5)
|
||||
//Setup slipage
|
||||
//If knocked out we might just hit it and stop. This makes it possible to get dead bodies and such.
|
||||
/mob/proc/slip_chance(var/prob_slip = 5)
|
||||
if(stat)
|
||||
prob_slip = 0 // Changing this to zero to make it line up with the comment.
|
||||
|
||||
prob_slip = round(prob_slip)
|
||||
return(prob_slip)
|
||||
|
||||
/mob/proc/mob_has_gravity(turf/T)
|
||||
return has_gravity(src, T)
|
||||
|
||||
/mob/proc/update_gravity()
|
||||
return
|
||||
return 0
|
||||
if(Check_Shoegrip())
|
||||
return 0
|
||||
return prob_slip
|
||||
Reference in New Issue
Block a user