mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 02:54:41 +01:00
Adds alert to direction locking, minor refactor (#23445)
* Adds alert to direction locking, minor refactor * use return
This commit is contained in:
@@ -199,6 +199,8 @@
|
||||
#define INVISIBILITY_ABSTRACT 101
|
||||
#define UNHEALING_EAR_DAMAGE 100
|
||||
|
||||
#define DIRECTION_LOCK_SLOWDOWN 3
|
||||
|
||||
//Human sub-species
|
||||
#define isabductor(A) (is_species(A, /datum/species/abductor))
|
||||
#define isgolem(A) (is_species(A, /datum/species/golem))
|
||||
|
||||
@@ -252,11 +252,9 @@
|
||||
return
|
||||
var/face_dir = get_cardinal_dir(src, A)
|
||||
if(!face_dir || forced_look == face_dir || A == src)
|
||||
forced_look = null
|
||||
to_chat(src, "<span class='notice'>Cancelled direction lock.</span>")
|
||||
clear_forced_look()
|
||||
return
|
||||
forced_look = face_dir
|
||||
to_chat(src, "<span class='userdanger'>You are now facing [dir2text(forced_look)]. To cancel this, shift-middleclick yourself.</span>")
|
||||
set_forced_look(A, FALSE)
|
||||
|
||||
/*
|
||||
Middle shift-control-click
|
||||
@@ -266,13 +264,13 @@
|
||||
return
|
||||
|
||||
/mob/living/MiddleShiftControlClickOn(atom/A)
|
||||
if(incapacitated())
|
||||
return
|
||||
var/face_uid = A.UID()
|
||||
if(forced_look == face_uid || A == src)
|
||||
forced_look = null
|
||||
to_chat(src, "<span class='notice'>Cancelled direction lock.</span>")
|
||||
clear_forced_look()
|
||||
return
|
||||
forced_look = face_uid
|
||||
to_chat(src, "<span class='userdanger'>You are now facing [A]. To cancel this, shift-middleclick yourself.</span>")
|
||||
set_forced_look(A, TRUE)
|
||||
|
||||
// In case of use break glass
|
||||
/*
|
||||
|
||||
@@ -337,6 +337,16 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
|
||||
var/mob/living/L = usr
|
||||
return L.resist()
|
||||
|
||||
/obj/screen/alert/direction_lock
|
||||
name = "Direction Lock"
|
||||
desc = "You are facing only one direction, slowing your movement down. Click here to stop the direction lock."
|
||||
icon_state = "direction_lock"
|
||||
|
||||
/obj/screen/alert/direction_lock/Click()
|
||||
if(isliving(usr))
|
||||
var/mob/living/L = usr
|
||||
return L.clear_forced_look()
|
||||
|
||||
//Constructs
|
||||
/obj/screen/alert/holy_fire
|
||||
name = "Holy Fire"
|
||||
|
||||
@@ -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
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 70 KiB |
Reference in New Issue
Block a user