mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-27 14:07:51 +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:
co-authored by
PollardTheDragon
parent
97d72d6e22
commit
435637e257
@@ -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>"
|
||||
|
||||
Reference in New Issue
Block a user