mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-08-24 21:56:55 +01:00
Implementing movement system flags, fixing simplemob movement delays.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
name = "observer"
|
||||
desc = "This shouldn't appear"
|
||||
density = 0
|
||||
move_intents = list(/decl/move_intent/no_delay)
|
||||
|
||||
/mob/observer/dead
|
||||
name = "ghost"
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
|
||||
has_huds = TRUE // We do show AI status huds for buildmode players
|
||||
|
||||
move_intents = list(
|
||||
/decl/move_intent/animal_run,
|
||||
/decl/move_intent/animal_walk
|
||||
)
|
||||
|
||||
var/tt_desc = null //Tooltip description
|
||||
|
||||
//Settings for played mobs
|
||||
@@ -225,17 +230,17 @@
|
||||
return ..()
|
||||
*/
|
||||
/mob/living/simple_mob/movement_delay()
|
||||
. = movement_cooldown
|
||||
|
||||
if(force_max_speed)
|
||||
return -3
|
||||
|
||||
. = 0
|
||||
for(var/datum/modifier/M in modifiers)
|
||||
if(!isnull(M.haste) && M.haste == TRUE)
|
||||
return -3
|
||||
if(!isnull(M.slowdown))
|
||||
. += M.slowdown
|
||||
|
||||
. += ..() + movement_cooldown
|
||||
// Turf related slowdown
|
||||
var/turf/T = get_turf(src)
|
||||
if(T && T.get_movement_cost() && !hovering) // Flying mobs ignore turf-based slowdown. Aquatic mobs ignore water slowdown, and can gain bonus speed in it.
|
||||
@@ -252,8 +257,6 @@
|
||||
if(IS_WALKING(src))
|
||||
. *= 1.5
|
||||
|
||||
. += config.animal_delay
|
||||
|
||||
. += ..()
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
zone_sel = null
|
||||
|
||||
/mob/Initialize()
|
||||
move_intent = GET_DECL(/decl/move_intent/run) // Sets the initial move_intent.
|
||||
move_intent = GET_DECL(move_intents[1]) // Sets the initial move_intent.
|
||||
mob_list += src
|
||||
if(stat == DEAD)
|
||||
dead_mob_list += src
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
if(prob(1))
|
||||
owner.custom_pain("Your abdomen feels like it's tearing itself apart!",1)
|
||||
if(!IS_WALKING(owner))
|
||||
owner.set_move_intent(/decl/move_intent/walk)
|
||||
owner.set_move_intent(owner.get_movement_intent_with_flag(MOVEMENT_INTENT_WALKING))
|
||||
|
||||
/obj/item/organ/internal/intestine/xeno
|
||||
color = "#555555"
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
if(prob(1))
|
||||
owner.custom_pain("You feel extremely tired, like you can't move!",1)
|
||||
if(!IS_WALKING(owner))
|
||||
owner.set_move_intent(/decl/move_intent/walk)
|
||||
owner.set_move_intent(owner.get_movement_intent_with_flag(MOVEMENT_INTENT_WALKING))
|
||||
|
||||
/obj/item/organ/internal/kidneys/grey
|
||||
icon_state = "kidneys_grey"
|
||||
|
||||
@@ -58,13 +58,18 @@
|
||||
trigger_aiming(TARGET_CAN_MOVE)
|
||||
|
||||
/mob/living/proc/set_move_intent(decl/move_intent/intent)
|
||||
if(move_intent.type == intent)
|
||||
return
|
||||
|
||||
var/new_intent = GET_DECL(intent)
|
||||
if(isnull(new_intent))
|
||||
return
|
||||
if(move_intent != new_intent)
|
||||
move_intent = new_intent
|
||||
if(hud_used?.move_intent)
|
||||
hud_used.move_intent.icon_state = move_intent.hud_icon_state
|
||||
|
||||
move_intent = new_intent
|
||||
if(hud_used?.move_intent)
|
||||
hud_used.move_intent.icon_state = move_intent.hud_icon_state
|
||||
/mob/living/proc/get_movement_intent_with_flag(var/flag_to_check = MOVEMENT_INTENT_WALKING)
|
||||
if(!flag_to_check || !length(move_intents))
|
||||
return
|
||||
for(var/move_intent_type in move_intents)
|
||||
var/decl/move_intent/check_intent = GET_DECL(move_intent_type)
|
||||
if(check_intent.flags & flag_to_check)
|
||||
return move_intent_type
|
||||
|
||||
Reference in New Issue
Block a user