From 20d9adaccda929de5598a184c49879a94b97548d Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Wed, 23 Oct 2019 20:43:05 +0200
Subject: [PATCH] Floaty floating.
---
code/__DEFINES/flags.dm | 1 +
code/datums/components/chasm.dm | 2 +-
code/game/atoms_movable.dm | 9 ++++-----
code/modules/mob/living/carbon/carbon_movement.dm | 2 +-
code/modules/mob/living/carbon/human/human.dm | 2 +-
code/modules/mob/living/carbon/human/species.dm | 2 +-
code/modules/mob/living/carbon/update_icons.dm | 2 +-
code/modules/mob/living/life.dm | 2 +-
code/modules/mob/living/living.dm | 10 +++++-----
code/modules/mob/living/living_defense.dm | 2 +-
code/modules/mob/mob_movespeed.dm | 1 +
code/modules/surgery/bodyparts/helpers.dm | 2 +-
modular_citadel/code/datums/status_effects/chems.dm | 4 ++--
13 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm
index d9b30bf0e3..9e8a4f71c2 100644
--- a/code/__DEFINES/flags.dm
+++ b/code/__DEFINES/flags.dm
@@ -58,6 +58,7 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define GROUND (1<<0)
#define FLYING (1<<1)
#define VENTCRAWLING (1<<2)
+#define FLOATING (1<<3)
//Fire and Acid stuff, for resistance_flags
#define LAVA_PROOF (1<<0)
diff --git a/code/datums/components/chasm.dm b/code/datums/components/chasm.dm
index 013334bc27..bc185994f6 100644
--- a/code/datums/components/chasm.dm
+++ b/code/datums/components/chasm.dm
@@ -65,7 +65,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))
diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm
index 146a1cc140..cc80e030cf 100644
--- a/code/game/atoms_movable.dm
+++ b/code/game/atoms_movable.dm
@@ -27,7 +27,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
@@ -687,14 +686,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)
diff --git a/code/modules/mob/living/carbon/carbon_movement.dm b/code/modules/mob/living/carbon/carbon_movement.dm
index 8e6c888c40..155b0fc7de 100644
--- a/code/modules/mob/living/carbon/carbon_movement.dm
+++ b/code/modules/mob/living/carbon/carbon_movement.dm
@@ -36,7 +36,7 @@
/mob/living/carbon/Move(NewLoc, direct)
. = ..()
- if(. && mob_has_gravity()) //floating is easy
+ if(. && (movement_type & FLOATING)) //floating is easy
if(HAS_TRAIT(src, TRAIT_NOHUNGER))
nutrition = NUTRITION_LEVEL_FED - 1 //just less than feeling vigorous
else if(nutrition && stat != DEAD)
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index 02e6043462..ec4f073fc8 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -945,7 +945,7 @@
return FALSE
/mob/living/carbon/human/proc/clear_shove_slowdown()
- remove_movespeed_modifier(SHOVE_SLOWDOWN_ID)
+ remove_movespeed_modifier(MOVESPEED_ID_SHOVE)
var/active_item = get_active_held_item()
if(is_type_in_typecache(active_item, GLOB.shove_disarming_types))
visible_message("[src.name] regains their grip on \the [active_item]!", "You regain your grip on \the [active_item]", null, COMBAT_MESSAGE_RANGE)
diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm
index a9312f47fe..5474838765 100644
--- a/code/modules/mob/living/carbon/human/species.dm
+++ b/code/modules/mob/living/carbon/human/species.dm
@@ -1389,7 +1389,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
if (H.m_intent == MOVE_INTENT_WALK && HAS_TRAIT(H, TRAIT_SPEEDY_STEP))
. -= 1.5
- if(!H.has_trait(TRAIT_IGNORESLOWDOWN) && gravity)
+ if(!HAS_TRAIT(H, TRAIT_IGNORESLOWDOWN) && gravity)
if(H.wear_suit)
. += H.wear_suit.slowdown
if(H.shoes)
diff --git a/code/modules/mob/living/carbon/update_icons.dm b/code/modules/mob/living/carbon/update_icons.dm
index cdae073af8..44e91949b2 100644
--- a/code/modules/mob/living/carbon/update_icons.dm
+++ b/code/modules/mob/living/carbon/update_icons.dm
@@ -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 = 0 // 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
diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm
index 201e5fea24..2bf17bc265 100644
--- a/code/modules/mob/living/life.dm
+++ b/code/modules/mob/living/life.dm
@@ -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)
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index 812733ebe2..6e7676a46a 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -716,14 +716,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)
@@ -795,7 +795,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
diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm
index 9d04f288cd..93e64fd4cc 100644
--- a/code/modules/mob/living/living_defense.dm
+++ b/code/modules/mob/living/living_defense.dm
@@ -422,4 +422,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.
diff --git a/code/modules/mob/mob_movespeed.dm b/code/modules/mob/mob_movespeed.dm
index 9b24f72c80..a0be8ff7cb 100644
--- a/code/modules/mob/mob_movespeed.dm
+++ b/code/modules/mob/mob_movespeed.dm
@@ -67,6 +67,7 @@
if(!(data[MOVESPEED_DATA_INDEX_MOVETYPE] & movement_type)) // We don't affect any of these move types, skip
continue
if(data[MOVESPEED_DATA_INDEX_BL_MOVETYPE] & movement_type) // There's a movetype here that disables this modifier, skip
+ continue
var/conflict = data[MOVESPEED_DATA_INDEX_CONFLICT]
var/amt = data[MOVESPEED_DATA_INDEX_MULTIPLICATIVE_SLOWDOWN]
if(conflict)
diff --git a/code/modules/surgery/bodyparts/helpers.dm b/code/modules/surgery/bodyparts/helpers.dm
index a2e8017956..1b8f2c25f6 100644
--- a/code/modules/surgery/bodyparts/helpers.dm
+++ b/code/modules/surgery/bodyparts/helpers.dm
@@ -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
diff --git a/modular_citadel/code/datums/status_effects/chems.dm b/modular_citadel/code/datums/status_effects/chems.dm
index 3cc65106a4..9b37f7291d 100644
--- a/modular_citadel/code/datums/status_effects/chems.dm
+++ b/modular_citadel/code/datums/status_effects/chems.dm
@@ -500,7 +500,7 @@
cooldown += 1 //Cooldown doesn't process till status is done
else if(status == "charge")
- L.add_movespeed_modifier(MOVESPEED_ID_MKULTRA, update=TRUE, priority=100, multiplicative_slowdown=-2, blacklisted_movetypes=(FLYING|FLOATING))
+ owner.add_movespeed_modifier(MOVESPEED_ID_MKULTRA, update=TRUE, priority=100, multiplicative_slowdown=-2, blacklisted_movetypes=(FLYING|FLOATING))
status = "charged"
if(master.client?.prefs.lewdchem)
to_chat(owner, "Your [enthrallGender]'s order fills you with a burst of speed!")
@@ -510,7 +510,7 @@
else if (status == "charged")
if (statusStrength < 0)
status = null
- L.remove_movespeed_modifier(MOVESPEED_ID_MKULTRA)
+ owner.remove_movespeed_modifier(MOVESPEED_ID_MKULTRA)
owner.Knockdown(50)
to_chat(owner, "Your body gives out as the adrenaline in your system runs out.")
else