some hints
This commit is contained in:
@@ -44,6 +44,7 @@ GLOBAL_LIST_EMPTY(GPS_list)
|
||||
RegisterSignal(parent, COMSIG_ATOM_EMP_ACT, .proc/on_emp_act)
|
||||
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/on_examine)
|
||||
RegisterSignal(parent, COMSIG_CLICK_ALT, .proc/on_AltClick)
|
||||
RegisterSignal(parent, COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, .proc/on_requesting_context_from_item)
|
||||
|
||||
///Called on COMSIG_ITEM_ATTACK_SELF
|
||||
/datum/component/gps/item/proc/interact(datum/source, mob/user)
|
||||
@@ -54,6 +55,17 @@ GLOBAL_LIST_EMPTY(GPS_list)
|
||||
/datum/component/gps/item/proc/on_examine(datum/source, mob/user, list/examine_list)
|
||||
examine_list += "<span class='notice'>Alt-click to switch it [tracking ? "off":"on"].</span>"
|
||||
|
||||
/datum/component/gps/item/proc/on_requesting_context_from_item(
|
||||
obj/source,
|
||||
list/context,
|
||||
obj/item/held_item,
|
||||
mob/living/user,
|
||||
)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
LAZYSET(context[SCREENTIP_CONTEXT_ALT_LMB], INTENT_ANY, tracking ? "Turn off" : "Turn on")
|
||||
return CONTEXTUAL_SCREENTIP_SET
|
||||
|
||||
///Called on COMSIG_ATOM_EMP_ACT
|
||||
/datum/component/gps/item/proc/on_emp_act(datum/source, severity)
|
||||
emped = TRUE
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/ExamineMessage)
|
||||
if(rotation_flags & ROTATION_WRENCH)
|
||||
RegisterSignal(parent, COMSIG_PARENT_ATTACKBY, .proc/WrenchRot)
|
||||
RegisterSignal(parent, COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, .proc/on_requesting_context_from_item)
|
||||
|
||||
/datum/component/simple_rotation/proc/add_verbs()
|
||||
if(rotation_flags & ROTATION_VERBS)
|
||||
@@ -63,7 +64,7 @@
|
||||
AM.verbs -= /atom/movable/proc/simple_rotate_counterclockwise
|
||||
|
||||
/datum/component/simple_rotation/proc/remove_signals()
|
||||
UnregisterSignal(parent, list(COMSIG_CLICK_ALT, COMSIG_PARENT_EXAMINE, COMSIG_PARENT_ATTACKBY))
|
||||
UnregisterSignal(parent, list(COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, COMSIG_CLICK_ALT, COMSIG_PARENT_EXAMINE, COMSIG_PARENT_ATTACKBY))
|
||||
|
||||
/datum/component/simple_rotation/RegisterWithParent()
|
||||
add_verbs()
|
||||
@@ -157,6 +158,21 @@
|
||||
/datum/component/simple_rotation/proc/default_after_rotation(mob/user, rotation_type)
|
||||
to_chat(user,"<span class='notice'>You [rotation_type == ROTATION_FLIP ? "flip" : "rotate"] [parent].</span>")
|
||||
|
||||
/datum/component/simple_rotation/proc/on_requesting_context_from_item(
|
||||
obj/source,
|
||||
list/context,
|
||||
obj/item/held_item,
|
||||
mob/living/user,
|
||||
)
|
||||
var/rotation = (rotation_flags & ROTATION_FLIP) ? "Flip" : "Rotate [rotation_flags & ROTATION_CLOCKWISE ? "clockwise" : "counter-clockwise"]"
|
||||
|
||||
if(rotation_flags & ROTATION_ALTCLICK)
|
||||
LAZYSET(context[SCREENTIP_CONTEXT_ALT_LMB], INTENT_ANY, rotation)
|
||||
. = CONTEXTUAL_SCREENTIP_SET
|
||||
if(held_item?.tool_behaviour == TOOL_WRENCH && (rotation_flags & ROTATION_WRENCH))
|
||||
LAZYSET(context[SCREENTIP_CONTEXT_LMB], INTENT_ANY, rotation)
|
||||
. = CONTEXTUAL_SCREENTIP_SET
|
||||
|
||||
/atom/movable/proc/simple_rotate_clockwise()
|
||||
set name = "Rotate Clockwise"
|
||||
set category = "Object"
|
||||
|
||||
@@ -23,18 +23,30 @@
|
||||
src.proctype = proctype
|
||||
src.escape_on_find = escape_on_find
|
||||
|
||||
RegisterSignal(target, COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, .proc/on_requesting_context_from_item)
|
||||
RegisterSignal(target, COMSIG_CLICK_ALT, .proc/mob_try_pickup)
|
||||
RegisterSignal(target, COMSIG_PARENT_EXAMINE, .proc/on_examine)
|
||||
|
||||
/datum/element/mob_holder/Detach(datum/source, force)
|
||||
. = ..()
|
||||
UnregisterSignal(source, COMSIG_CLICK_ALT)
|
||||
UnregisterSignal(source, COMSIG_PARENT_EXAMINE)
|
||||
UnregisterSignal(source, list(COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, COMSIG_CLICK_ALT, COMSIG_PARENT_EXAMINE))
|
||||
|
||||
/datum/element/mob_holder/proc/on_examine(mob/living/source, mob/user, list/examine_list)
|
||||
if(ishuman(user) && !istype(source.loc, /obj/item/clothing/head/mob_holder))
|
||||
examine_list += "<span class='notice'>Looks like [source.p_they(TRUE)] can be picked up with <b>Alt+Click</b>!</span>"
|
||||
|
||||
/datum/element/mob_holder/proc/on_requesting_context_from_item(
|
||||
obj/source,
|
||||
list/context,
|
||||
obj/item/held_item,
|
||||
mob/living/user,
|
||||
)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(ishuman(user))
|
||||
LAZYSET(context[SCREENTIP_CONTEXT_ALT_LMB], INTENT_ANY, "Pick up")
|
||||
return CONTEXTUAL_SCREENTIP_SET
|
||||
|
||||
/datum/element/mob_holder/proc/mob_try_pickup(mob/living/source, mob/user)
|
||||
if(!ishuman(user) || !user.Adjacent(source) || user.incapacitated())
|
||||
return FALSE
|
||||
|
||||
Reference in New Issue
Block a user