mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-13 16:13:19 +01:00
Adds alert to direction locking, minor refactor (#23445)
* Adds alert to direction locking, minor refactor * use return
This commit is contained in:
@@ -1034,7 +1034,7 @@
|
||||
if(S)
|
||||
. += S.slowdown_value
|
||||
if(forced_look)
|
||||
. += 3
|
||||
. += DIRECTION_LOCK_SLOWDOWN
|
||||
if(ignorewalk)
|
||||
. += GLOB.configuration.movement.base_run_speed
|
||||
else
|
||||
@@ -1167,3 +1167,40 @@
|
||||
C.take_organ_damage(damage)
|
||||
C.KnockDown(3 SECONDS)
|
||||
C.visible_message("<span class='danger'>[C] crashes into [src], knocking them both over!</span>", "<span class='userdanger'>You violently crash into [src]!</span>")
|
||||
|
||||
/**
|
||||
* Sets the mob's direction lock towards a given atom.
|
||||
*
|
||||
* Arguments:
|
||||
* * a - The atom to face towards.
|
||||
* * track - If TRUE, updates our direction relative to the atom when moving.
|
||||
*/
|
||||
/mob/living/proc/set_forced_look(atom/A, track = FALSE)
|
||||
forced_look = track ? A.UID() : get_cardinal_dir(src, A)
|
||||
to_chat(src, "<span class='userdanger'>You are now facing [track ? A : dir2text(forced_look)]. To cancel this, shift-middleclick yourself.</span>")
|
||||
throw_alert("direction_lock", /obj/screen/alert/direction_lock)
|
||||
|
||||
/**
|
||||
* Clears the mob's direction lock if enabled.
|
||||
*
|
||||
* Arguments:
|
||||
* * quiet - Whether to display a chat message.
|
||||
*/
|
||||
/mob/living/proc/clear_forced_look(quiet = FALSE)
|
||||
if(!forced_look)
|
||||
return
|
||||
forced_look = null
|
||||
if(!quiet)
|
||||
to_chat(src, "<span class='notice'>Cancelled direction lock.</span>")
|
||||
clear_alert("direction_lock")
|
||||
|
||||
/mob/living/setDir(new_dir)
|
||||
if(forced_look)
|
||||
if(isnum(forced_look))
|
||||
dir = forced_look
|
||||
else
|
||||
var/atom/A = locateUID(forced_look)
|
||||
if(istype(A))
|
||||
dir = get_cardinal_dir(src, A)
|
||||
return
|
||||
return ..()
|
||||
|
||||
@@ -88,6 +88,9 @@
|
||||
/// the type of holder that will be created when a mob gets scooped up
|
||||
var/holder_type
|
||||
|
||||
/// This can either be a numerical direction or a soft object reference (UID). It makes the mob always face towards the selected thing.
|
||||
var/forced_look = null
|
||||
|
||||
var/datum/language/default_language
|
||||
|
||||
var/datum/middleClickOverride/middleClickOverride = null
|
||||
|
||||
@@ -75,15 +75,18 @@
|
||||
handle_status_effects() //all special effects, stunned, weakened, jitteryness, hallucination, sleeping, etc
|
||||
|
||||
if(stat != DEAD)
|
||||
if(forced_look && !isnum(forced_look))
|
||||
var/atom/A = locateUID(forced_look)
|
||||
if(istype(A))
|
||||
var/view = client ? client.maxview() : world.view
|
||||
if(get_dist(src, A) > view || !(src in viewers(view, A)))
|
||||
clear_forced_look(TRUE)
|
||||
to_chat(src, "<span class='notice'>Your direction target has left your view, you are no longer facing anything.</span>")
|
||||
else
|
||||
clear_forced_look(TRUE)
|
||||
to_chat(src, "<span class='notice'>Your direction target has left your view, you are no longer facing anything.</span>")
|
||||
// Make sure it didn't get cleared
|
||||
if(forced_look)
|
||||
if(!isnum(forced_look))
|
||||
var/atom/A = locateUID(forced_look)
|
||||
if(istype(A))
|
||||
var/view = client ? client.maxview() : world.view
|
||||
if(get_dist(src, A) > view || !(src in viewers(view, A)))
|
||||
forced_look = null
|
||||
to_chat(src, "<span class='notice'>Your direction target has left your view, you are no longer facing anything.</span>")
|
||||
return
|
||||
setDir()
|
||||
|
||||
if(machine)
|
||||
|
||||
@@ -364,7 +364,7 @@
|
||||
/mob/living/simple_animal/movement_delay()
|
||||
. = speed
|
||||
if(forced_look)
|
||||
. += 3
|
||||
. += DIRECTION_LOCK_SLOWDOWN
|
||||
. += GLOB.configuration.movement.animal_delay
|
||||
|
||||
/mob/living/simple_animal/Stat()
|
||||
|
||||
@@ -601,17 +601,6 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
|
||||
client.screen = list()
|
||||
hud_used.show_hud(hud_used.hud_version)
|
||||
|
||||
/mob/setDir(new_dir)
|
||||
if(forced_look)
|
||||
if(isnum(forced_look))
|
||||
dir = forced_look
|
||||
else
|
||||
var/atom/A = locateUID(forced_look)
|
||||
if(istype(A))
|
||||
dir = get_cardinal_dir(src, A)
|
||||
return
|
||||
. = ..()
|
||||
|
||||
/mob/proc/show_inv(mob/user)
|
||||
user.set_machine(src)
|
||||
var/dat = {"<table>
|
||||
|
||||
@@ -201,7 +201,6 @@
|
||||
|
||||
var/list/tkgrabbed_objects = list() // Assoc list of items to TK grabs
|
||||
|
||||
var/forced_look = null // This can either be a numerical direction or a soft object reference (UID). It makes the mob always face towards the selected thing.
|
||||
var/registered_z
|
||||
|
||||
var/obj/effect/proc_holder/ranged_ability //Any ranged ability the mob has, as a click override
|
||||
|
||||
Reference in New Issue
Block a user