mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
[MIRROR] Beauty is now an element. Fixing an issue with enter/exit area comsigs. (#3639)
* Beauty is now an element. Fixing an issue with enter/exit area comsigs. (#57147) Co-authored-by: Ghommie <425422238+Ghommie@ users.noreply.github.com> * Beauty is now an element. Fixing an issue with enter/exit area comsigs. Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com> Co-authored-by: Ghommie <425422238+Ghommie@ users.noreply.github.com>
This commit is contained in:
co-authored by
Ghommie
Ghom
parent
a9abe3423d
commit
1f665ef7f7
@@ -1,57 +0,0 @@
|
||||
/**
|
||||
* Beauty component, makes the indoor area the parent is in prettier or uglier depending on the beauty var.
|
||||
* Clean and well decorated areas lead to positive moodlets for passerbies, while shabbier, dirtier ones
|
||||
* lead to negative moodlets exclusive to characters with the snob quirk.
|
||||
*
|
||||
* Keep in mind AddComponent is used for BOTH adding and removing beauty value here,
|
||||
* so please don't use qdel/RemoveComponent unless necessary.
|
||||
*/
|
||||
/datum/component/beauty
|
||||
var/beauty = 0
|
||||
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
|
||||
|
||||
/datum/component/beauty/Initialize(beautyamount)
|
||||
if(!isatom(parent) || isarea(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
beauty = beautyamount
|
||||
|
||||
if(ismovable(parent))
|
||||
RegisterSignal(parent, COMSIG_ENTER_AREA, .proc/enter_area)
|
||||
RegisterSignal(parent, COMSIG_EXIT_AREA, .proc/exit_area)
|
||||
|
||||
var/area/A = get_area(parent)
|
||||
if(A)
|
||||
enter_area(null, A)
|
||||
|
||||
/datum/component/beauty/proc/enter_area(datum/source, area/A)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(A.outdoors)
|
||||
return
|
||||
A.totalbeauty += beauty
|
||||
A.update_beauty()
|
||||
|
||||
/datum/component/beauty/proc/exit_area(datum/source, area/A)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(A.outdoors)
|
||||
return
|
||||
A.totalbeauty -= beauty
|
||||
A.update_beauty()
|
||||
|
||||
/datum/component/beauty/InheritComponent(datum/component/beauty/new_comp , i_am_original, beautyamount)
|
||||
if((beauty + beautyamount) == 0)
|
||||
qdel(src)
|
||||
return
|
||||
beauty += beautyamount
|
||||
var/area/A = get_area(parent)
|
||||
if(A && !A.outdoors)
|
||||
A.totalbeauty += beautyamount
|
||||
A.update_beauty()
|
||||
|
||||
/datum/component/beauty/Destroy()
|
||||
. = ..()
|
||||
var/area/A = get_area(parent)
|
||||
if(A)
|
||||
exit_area(null, A)
|
||||
@@ -73,12 +73,12 @@
|
||||
|
||||
/datum/fantasy_affix/beautiful/apply(datum/component/fantasy/comp, newName)
|
||||
var/obj/item/master = comp.parent
|
||||
master.AddComponent(/datum/component/beauty, max(comp.quality, 1) * 250)
|
||||
master.AddElement(/datum/element/beauty, max(comp.quality, 1) * 250)
|
||||
return "[pick("aesthetic", "beautiful", "gorgeous", "pretty")] [newName]"
|
||||
|
||||
/datum/fantasy_affix/beautiful/remove(datum/component/fantasy/comp)
|
||||
var/obj/item/master = comp.parent
|
||||
master.AddComponent(/datum/component/beauty, -max(comp.quality, 1) * 250)
|
||||
master.RemoveElement(/datum/element/beauty, max(comp.quality, 1) * 250)
|
||||
|
||||
/datum/fantasy_affix/ugly
|
||||
placement = AFFIX_PREFIX
|
||||
@@ -86,9 +86,9 @@
|
||||
|
||||
/datum/fantasy_affix/ugly/apply(datum/component/fantasy/comp, newName)
|
||||
var/obj/item/master = comp.parent
|
||||
master.AddComponent(/datum/component/beauty, min(comp.quality, -1) * 250)
|
||||
master.AddElement(/datum/element/beauty, min(comp.quality, -1) * 250)
|
||||
return "[pick("fugly", "ugly", "grotesque", "hideous")] [newName]"
|
||||
|
||||
/datum/fantasy_affix/ugly/remove(datum/component/fantasy/comp)
|
||||
var/obj/item/master = comp.parent
|
||||
master.AddComponent(/datum/component/beauty, -min(comp.quality, -1) * 250)
|
||||
master.AddElement(/datum/element/beauty, min(comp.quality, -1) * 250)
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
RegisterSignal(parent, COMSIG_VOID_MASK_ACT, .proc/direct_sanity_drain)
|
||||
|
||||
var/mob/living/owner = parent
|
||||
owner.become_area_sensitive(MOOD_COMPONENT_TRAIT)
|
||||
if(owner.hud_used)
|
||||
modify_hud()
|
||||
var/datum/hud/hud = owner.hud_used
|
||||
@@ -36,6 +37,7 @@
|
||||
|
||||
/datum/component/mood/Destroy()
|
||||
STOP_PROCESSING(SSmood, src)
|
||||
REMOVE_TRAIT(parent, TRAIT_AREA_SENSITIVE, MOOD_COMPONENT_TRAIT)
|
||||
unmodify_hud()
|
||||
return ..()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user