Merge pull request #10264 from RavingManiac/dev-freeze

Refactors floating and magboot checks. Fixes #10256
This commit is contained in:
mwerezak
2015-08-05 23:05:34 -04:00
4 changed files with 45 additions and 33 deletions

View File

@@ -227,7 +227,7 @@ var/list/mob/living/forced_ambiance_list = new
var/area/oldarea = L.lastarea var/area/oldarea = L.lastarea
if((oldarea.has_gravity == 0) && (newarea.has_gravity == 1) && (L.m_intent == "run")) // Being ready when you change areas gives you a chance to avoid falling all together. if((oldarea.has_gravity == 0) && (newarea.has_gravity == 1) && (L.m_intent == "run")) // Being ready when you change areas gives you a chance to avoid falling all together.
thunk(L) thunk(L)
L.make_floating(0) L.update_floating( L.Check_Dense_Object() )
L.lastarea = newarea L.lastarea = newarea
play_ambience(L) play_ambience(L)
@@ -260,21 +260,10 @@ var/list/mob/living/forced_ambiance_list = new
/area/proc/gravitychange(var/gravitystate = 0, var/area/A) /area/proc/gravitychange(var/gravitystate = 0, var/area/A)
A.has_gravity = gravitystate A.has_gravity = gravitystate
if(gravitystate) for(var/mob/M in A)
for(var/mob/living/carbon/human/M in A) if(has_gravity)
thunk(M) thunk(M)
for(var/mob/M1 in A) M.update_floating( M.Check_Dense_Object() )
M1.make_floating(0)
else
for(var/mob/M in A)
if(M.Check_Dense_Object() && istype(src,/mob/living/carbon/human/))
var/mob/living/carbon/human/H = src
if(istype(H.shoes, /obj/item/clothing/shoes/magboots) && (H.shoes.flags & NOSLIP)) //magboots + dense_object = no floaty effect
H.make_floating(0)
else
H.make_floating(1)
else
M.make_floating(1)
/area/proc/thunk(mob) /area/proc/thunk(mob)
if(istype(get_turf(mob), /turf/space)) // Can't fall onto nothing. if(istype(get_turf(mob), /turf/space)) // Can't fall onto nothing.

View File

@@ -77,10 +77,36 @@ note dizziness decrements automatically in the mob's Life() proc.
pixel_y = old_y pixel_y = old_y
//handles up-down floaty effect in space //handles up-down floaty effect in space and zero-gravity
/mob/var/is_floating = 0 /mob/var/is_floating = 0
/mob/var/floatiness = 0 /mob/var/floatiness = 0
/mob/proc/update_floating(var/dense_object=0)
if(anchored||buckled)
make_floating(0)
return
var/turf/turf = get_turf(src)
if(!istype(turf,/turf/space))
var/area/A = turf.loc
if(istype(A) && A.has_gravity)
make_floating(0)
return
else if (Check_Shoegrip())
make_floating(0)
return
else
make_floating(1)
return
if(dense_object && Check_Shoegrip())
make_floating(0)
return
make_floating(1)
return
/mob/proc/make_floating(var/n) /mob/proc/make_floating(var/n)
floatiness = n floatiness = n

View File

@@ -1361,3 +1361,8 @@
..() ..()
if(update_hud) if(update_hud)
handle_regular_hud_updates() handle_regular_hud_updates()
/mob/living/carbon/human/Check_Shoegrip()
if(istype(shoes, /obj/item/clothing/shoes/magboots) && (shoes.flags & NOSLIP)) //magboots + dense_object = no floating
return 1
return 0

View File

@@ -449,17 +449,10 @@
/mob/proc/Process_Spacemove(var/check_drift = 0) /mob/proc/Process_Spacemove(var/check_drift = 0)
if(!Check_Dense_Object()) //Nothing to push off of so end here if(!Check_Dense_Object()) //Nothing to push off of so end here
make_floating(1) update_floating(0)
return 0 return 0
if(istype(src,/mob/living/carbon/human/)) update_floating(1)
var/mob/living/carbon/human/H = src
if(istype(H.shoes, /obj/item/clothing/shoes/magboots) && (H.shoes.flags & NOSLIP)) //magboots + dense_object = no floaty effect
make_floating(0)
else
make_floating(1)
else
make_floating(1)
if(restrained()) //Check to see if we can do things if(restrained()) //Check to see if we can do things
return 0 return 0
@@ -477,6 +470,8 @@
/mob/proc/Check_Dense_Object() //checks for anything to push off in the vicinity. also handles magboots on gravity-less floors tiles /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/dense_object = 0
var/shoegrip
for(var/turf/turf in oview(1,src)) for(var/turf/turf in oview(1,src))
if(istype(turf,/turf/space)) if(istype(turf,/turf/space))
continue continue
@@ -484,14 +479,9 @@
if(istype(turf,/turf/simulated/floor)) // Floors don't count if they don't have gravity if(istype(turf,/turf/simulated/floor)) // Floors don't count if they don't have gravity
var/area/A = turf.loc var/area/A = turf.loc
if(istype(A) && A.has_gravity == 0) if(istype(A) && A.has_gravity == 0)
var/can_walk = 0 if(shoegrip == null)
shoegrip = Check_Shoegrip() //Shoegrip is only ever checked when a zero-gravity floor is encountered to reduce load
if(ishuman(src)) // Only humans can wear magboots, so we give them a chance to. if(!shoegrip)
var/mob/living/carbon/human/H = src
if(istype(H.shoes, /obj/item/clothing/shoes/magboots) && (H.shoes.flags & NOSLIP))
can_walk = 1
if(!can_walk)
continue continue
dense_object++ dense_object++
@@ -511,6 +501,8 @@
return dense_object return dense_object
/mob/proc/Check_Shoegrip()
return 0
/mob/proc/Process_Spaceslipping(var/prob_slip = 5) /mob/proc/Process_Spaceslipping(var/prob_slip = 5)
//Setup slipage //Setup slipage