Porting updates related to material datums. (#12317)
* Porting updates related to material datums. * art_type * oh oh
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
|
||||
#define BAD_ART 12.5
|
||||
#define GOOD_ART 25
|
||||
#define GREAT_ART 50
|
||||
|
||||
/datum/element/art
|
||||
element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH
|
||||
id_arg_index = 2
|
||||
var/impressiveness = 0
|
||||
|
||||
/datum/element/art/Attach(datum/target, impress)
|
||||
. = ..()
|
||||
if(. == ELEMENT_INCOMPATIBLE || !isatom(target) || isarea(target))
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
impressiveness = impress
|
||||
if(isobj(target))
|
||||
RegisterSignal(target, COMSIG_PARENT_EXAMINE, .proc/on_obj_examine)
|
||||
if(isstructure(target))
|
||||
RegisterSignal(target, COMSIG_ATOM_ATTACK_HAND, .proc/on_attack_hand)
|
||||
if(isitem(target))
|
||||
RegisterSignal(target, COMSIG_ITEM_ATTACK_SELF, .proc/apply_moodlet)
|
||||
else
|
||||
RegisterSignal(target, COMSIG_PARENT_EXAMINE, .proc/on_other_examine)
|
||||
|
||||
/datum/element/art/Detach(datum/target)
|
||||
UnregisterSignal(target, list(COMSIG_PARENT_EXAMINE, COMSIG_ATOM_ATTACK_HAND, COMSIG_ITEM_ATTACK_SELF))
|
||||
return ..()
|
||||
|
||||
/datum/element/art/proc/apply_moodlet(atom/source, mob/M, impress)
|
||||
M.visible_message("<span class='notice'>[M] stops and looks intently at [source].</span>", \
|
||||
"<span class='notice'>You stop to take in [source].</span>")
|
||||
switch(impress)
|
||||
if (0 to BAD_ART)
|
||||
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "artbad", /datum/mood_event/artbad)
|
||||
if (BAD_ART to GOOD_ART)
|
||||
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "artok", /datum/mood_event/artok)
|
||||
if (GOOD_ART to GREAT_ART)
|
||||
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "artgood", /datum/mood_event/artgood)
|
||||
if(GREAT_ART to INFINITY)
|
||||
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "artgreat", /datum/mood_event/artgreat)
|
||||
|
||||
/datum/element/art/proc/on_other_examine(atom/source, mob/M)
|
||||
apply_moodlet(source, M, impressiveness)
|
||||
|
||||
/datum/element/art/proc/on_obj_examine(atom/source, mob/M)
|
||||
var/obj/O = source
|
||||
apply_moodlet(source, M, impressiveness *(O.obj_integrity/O.max_integrity))
|
||||
|
||||
/datum/element/art/proc/on_attack_hand(atom/source, mob/M)
|
||||
to_chat(M, "<span class='notice'>You start examining [source]...</span>")
|
||||
if(!do_after(M, 20, target = source))
|
||||
return
|
||||
on_obj_examine(source, M)
|
||||
|
||||
/datum/element/art/rev
|
||||
|
||||
/datum/element/art/rev/apply_moodlet(atom/source, mob/M, impress)
|
||||
M.visible_message("<span class='notice'>[M] stops to inspect [source].</span>", \
|
||||
"<span class='notice'>You take in [source], inspecting the fine craftsmanship of the proletariat.</span>")
|
||||
|
||||
if(M.mind && M.mind.has_antag_datum(/datum/antagonist/rev))
|
||||
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "artgreat", /datum/mood_event/artgreat)
|
||||
else
|
||||
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "artbad", /datum/mood_event/artbad)
|
||||
@@ -0,0 +1,34 @@
|
||||
/datum/element/beauty
|
||||
element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH
|
||||
id_arg_index = 2
|
||||
var/beauty = 0
|
||||
|
||||
/datum/element/beauty/Attach(datum/target, beautyamount)
|
||||
. = ..()
|
||||
if(. == ELEMENT_INCOMPATIBLE || !isatom(target) || isarea(target))
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
beauty = beautyamount
|
||||
RegisterSignal(target, COMSIG_ENTER_AREA, .proc/enter_area)
|
||||
RegisterSignal(target, COMSIG_EXIT_AREA, .proc/exit_area)
|
||||
var/area/A = get_area(target)
|
||||
if(A)
|
||||
enter_area(null, A)
|
||||
|
||||
/datum/element/beauty/Detach(datum/target)
|
||||
UnregisterSignal(target, list(COMSIG_ENTER_AREA, COMSIG_EXIT_AREA))
|
||||
var/area/A = get_area(target)
|
||||
if(A)
|
||||
exit_area(null, A)
|
||||
return ..()
|
||||
|
||||
/datum/element/beauty/proc/enter_area(datum/source, area/A)
|
||||
if(A.outdoors)
|
||||
return
|
||||
A.totalbeauty += beauty
|
||||
A.update_beauty()
|
||||
|
||||
/datum/element/beauty/proc/exit_area(datum/source, area/A)
|
||||
if(A.outdoors)
|
||||
return
|
||||
A.totalbeauty -= beauty
|
||||
A.update_beauty()
|
||||
Reference in New Issue
Block a user