Merge pull request #41261 from ninjanomnom/floating-movetype

Makes floating a movetype instead of a movable var
This commit is contained in:
oranges
2018-11-04 14:54:30 +13:00
committed by yogstation13-bot
parent 3825fe10d1
commit 8628212755
10 changed files with 21 additions and 19 deletions

View File

@@ -50,9 +50,10 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
//Movement Types
#define GROUND (1<<0)
#define FLYING (1<<1)
#define VENTCRAWLING (1<<2)
#define GROUND (1<<0)
#define FLYING (1<<1)
#define VENTCRAWLING (1<<2)
#define FLOATING (1<<3)
// Flags for reagents
#define REAGENT_NOREACT (1<<0)

View File

@@ -66,7 +66,7 @@
return FALSE
if(!isliving(AM) && !isobj(AM))
return FALSE
if(is_type_in_typecache(AM, forbidden_types) || AM.throwing || AM.floating)
if(is_type_in_typecache(AM, forbidden_types) || AM.throwing || (AM.movement_type & FLOATING))
return FALSE
//Flies right over the chasm
if(ismob(AM))

View File

@@ -29,7 +29,6 @@
glide_size = 8
appearance_flags = TILE_BOUND|PIXEL_SCALE
var/datum/forced_movement/force_moving = null //handled soley by forced_movement.dm
var/floating = FALSE
var/movement_type = GROUND //Incase you have multiple types, you automatically use the most useful one. IE: Skating on ice, flippers on water, flying over chasm/space, etc.
var/atom/movable/pulling
var/grab_state = 0
@@ -709,14 +708,14 @@
/atom/movable/proc/float(on)
if(throwing)
return
if(on && !floating)
if(on && !(movement_type & FLOATING))
animate(src, pixel_y = pixel_y + 2, time = 10, loop = -1)
sleep(10)
animate(src, pixel_y = pixel_y - 2, time = 10, loop = -1)
floating = TRUE
else if (!on && floating)
setMovetype(movement_type | FLOATING)
else if (!on && (movement_type & FLOATING))
animate(src, pixel_y = initial(pixel_y), time = 10)
floating = FALSE
setMovetype(movement_type & ~FLOATING)
/* Language procs */
/atom/movable/proc/get_language_holder(shadow=TRUE)

View File

@@ -34,7 +34,7 @@
/mob/living/carbon/Move(NewLoc, direct)
. = ..()
if(. && mob_has_gravity()) //floating is easy
if(. && (movement_type & FLOATING)) //floating is easy
if(has_trait(TRAIT_NOHUNGER))
nutrition = NUTRITION_LEVEL_FED - 1 //just less than feeling vigorous
else if(nutrition && stat != DEAD)

View File

@@ -23,7 +23,7 @@
if(changed)
animate(src, transform = ntransform, time = 2, pixel_y = final_pixel_y, dir = final_dir, easing = EASE_IN|EASE_OUT)
floating = FALSE // If we were without gravity, the bouncing animation got stopped, so we make sure we restart it in next life().
setMovetype(movement_type & ~FLOATING) // If we were without gravity, the bouncing animation got stopped, so we make sure we restart it in next life().
/mob/living/carbon
var/list/overlays_standing[TOTAL_LAYERS]

View File

@@ -4,7 +4,7 @@
if(digitalinvis)
handle_diginvis() //AI becomes unable to see mob
if((movement_type & FLYING) && !floating) //TODO: Better floating
if((movement_type & FLYING) && !(movement_type & FLOATING)) //TODO: Better floating
float(on = TRUE)
if (client)

View File

@@ -675,14 +675,14 @@
var/fixed = 0
if(anchored || (buckled && buckled.anchored))
fixed = 1
if(on && !floating && !fixed)
if(on && !(movement_type & FLOATING) && !fixed)
animate(src, pixel_y = pixel_y + 2, time = 10, loop = -1)
sleep(10)
animate(src, pixel_y = pixel_y - 2, time = 10, loop = -1)
floating = TRUE
else if(((!on || fixed) && floating))
setMovetype(movement_type | FLOATING)
else if(((!on || fixed) && (movement_type & FLOATING)))
animate(src, pixel_y = get_standard_pixel_y_offset(lying), time = 10)
floating = FALSE
setMovetype(movement_type & ~FLOATING)
// The src mob is trying to strip an item from someone
// Override if a certain type of mob should be behave differently when stripping items (can't, for example)
@@ -750,7 +750,7 @@
var/final_pixel_y = get_standard_pixel_y_offset(lying)
animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff , time = 2, loop = 6)
animate(pixel_x = final_pixel_x , pixel_y = final_pixel_y , time = 2)
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure to restart it in next life().
setMovetype(movement_type & ~FLOATING) // If we were without gravity, the bouncing animation got stopped, so we make sure to restart it in next life().
/mob/living/proc/get_temperature(datum/gas_mixture/environment)
var/loc_temp = environment ? environment.temperature : T0C

View File

@@ -398,4 +398,4 @@
if(!used_item)
used_item = get_active_held_item()
..()
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement.
setMovetype(movement_type & ~FLOATING) // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement.

View File

@@ -1,7 +1,9 @@
/*Current movespeed modification list format: list(id = list(
priority,
flags,
legacy slowdown/speedup amount,
movetype_flags
))
*/

View File

@@ -95,7 +95,7 @@
return TRUE
/mob/living/carbon/human/get_leg_ignore()
if((movement_type & FLYING) || floating)
if(movement_type & FLYING|FLOATING)
return TRUE
return FALSE