mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-18 02:24:11 +01:00
All Secondary Goals use labels (#29776)
* All Secondary Goals use labels * Fixes. * Fixes. * Update code/__DEFINES/dcs/basetype_signals.dm Co-authored-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> Signed-off-by: Charlie Nolan <funnyman3595@gmail.com> --------- Signed-off-by: Charlie Nolan <funnyman3595@gmail.com> Co-authored-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
This proc will fire after the parent is hit by a hand labeler which is trying to apply another label.
|
||||
Since the parent already has a label, it will remove the old one from the parent's name, and apply the new one.
|
||||
*/
|
||||
/datum/component/label/InheritComponent(datum/component/label/new_comp , i_am_original, _label_name)
|
||||
/datum/component/label/InheritComponent(datum/component/label/new_comp, i_am_original, _label_name)
|
||||
remove_label()
|
||||
if(new_comp)
|
||||
label_name = new_comp.label_name
|
||||
@@ -79,25 +79,38 @@
|
||||
|
||||
/// A verson of the label component specific to labelling goal items.
|
||||
/datum/component/label/goal
|
||||
var/owner = "Anyone"
|
||||
var/person
|
||||
var/department
|
||||
|
||||
/datum/component/label/goal/Initialize(_label_name)
|
||||
if(istype(parent, /obj/item))
|
||||
// Can only be attached to things that won't go in a crate.
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
return ..()
|
||||
/datum/component/label/goal/Initialize(who, where, from_cc=FALSE)
|
||||
person = who
|
||||
department = where
|
||||
update_owner_and_label_name(from_cc)
|
||||
return ..(label_name)
|
||||
|
||||
/datum/component/label/goal/proc/update_owner_and_label_name(from_cc)
|
||||
if(person)
|
||||
owner = person
|
||||
if(department)
|
||||
owner += " in [department]"
|
||||
|
||||
if(from_cc)
|
||||
label_name = owner
|
||||
else
|
||||
label_name = "Secondary Goal"
|
||||
|
||||
/**
|
||||
This proc will fire after the parent is hit by a hand labeler which is trying to apply another goal label.
|
||||
Since the parent already has a goal label, it will remove the old one from the parent's name, and apply the new one.
|
||||
*/
|
||||
/datum/component/label/goal/InheritComponent(datum/component/label/new_comp, i_am_original, who, where, from_cc=FALSE)
|
||||
remove_label()
|
||||
person = who
|
||||
department = where
|
||||
update_owner_and_label_name(from_cc)
|
||||
apply_label()
|
||||
|
||||
/// Adds detailed information to the examine text.
|
||||
/datum/component/label/goal/on_examine(datum/source, mob/user, list/examine_list)
|
||||
examine_list += "<span class='notice'>It has a label on it, marking it as part of a secondary goal for [label_name]. Use a hand labeler to remove it.</span>"
|
||||
|
||||
/// Applies a static label to the parent's name.
|
||||
/// We do this instead of using label_name so it's easier to identify goal objects at a glance.
|
||||
/datum/component/label/goal/apply_label()
|
||||
var/atom/owner = parent
|
||||
owner.name += " (Secondary Goal)"
|
||||
|
||||
/// Removes the label from the parent's name
|
||||
/datum/component/label/goal/remove_label()
|
||||
var/atom/owner = parent
|
||||
owner.name = replacetext(owner.name, "(Secondary Goal)", "") // Remove the label text from the parent's name, wherever it's located.
|
||||
owner.name = trim(owner.name) // Shave off any white space from the beginning or end of the parent's name.
|
||||
examine_list += "<span class='notice'>It has a label on it, marking it as part of a secondary goal for [owner]. Use a hand labeler to remove it.</span>"
|
||||
|
||||
@@ -226,6 +226,8 @@
|
||||
var/original_layer
|
||||
/// A copy of the shelved object's original appearance flags, to restore after removing from the shelf.
|
||||
var/original_appearance_flags
|
||||
/// Are we currently being moved by a shuttle? Prevents us from falling off the shelf in transport.
|
||||
var/shuttle_moving = FALSE
|
||||
|
||||
/datum/component/shelved/Initialize(atom/shelf)
|
||||
if(!isobj(parent))
|
||||
@@ -241,6 +243,7 @@
|
||||
. = ..()
|
||||
RegisterSignal(parent, COMSIG_ITEM_PICKUP, PROC_REF(on_item_pickup))
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(on_movable_moved))
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_ON_SHUTTLE_MOVE, PROC_REF(on_movable_shuttle_moved))
|
||||
var/obj/shelf = locateUID(shelf_uid)
|
||||
if(shelf)
|
||||
RegisterSignal(shelf, COMSIG_MOVABLE_SHOVE_IMPACT, PROC_REF(on_movable_shove_impact))
|
||||
@@ -255,10 +258,18 @@
|
||||
SIGNAL_HANDLER // COMSIG_ITEM_PICKUP
|
||||
qdel(src)
|
||||
|
||||
/datum/component/shelved/proc/on_movable_shuttle_moved()
|
||||
SIGNAL_HANDLER // COMSIG_MOVABLE_ON_SHUTTLE_MOVE,
|
||||
shuttle_moving = TRUE
|
||||
|
||||
/// Generic handler for if anything moves us off our original shelf position, such as atmos pressure.
|
||||
/datum/component/shelved/proc/on_movable_moved()
|
||||
SIGNAL_HANDLER // COMSIG_MOVABLE_MOVED
|
||||
qdel(src)
|
||||
if(shuttle_moving)
|
||||
// Ignore this movement, since we should be moving with the shelf.
|
||||
shuttle_moving = FALSE
|
||||
else
|
||||
qdel(src)
|
||||
|
||||
/datum/component/shelved/UnregisterFromParent()
|
||||
. = ..()
|
||||
|
||||
Reference in New Issue
Block a user