[MIRROR] [READY] Several fixes/changes to mood, longterm mood effects, beauty component (#5992)

* [READY] Several fixes/changes to mood, longterm mood effects, beauty component (#36344)

cl Floyd / Qustinnus
del: Removes short-term effects of mood
add; Adds long-term effects of mood by implementing sanity which goes up with good mood, down with bad mood, but takes time to change. Your sanity can be seen as your average mood in the recent past. All effects of moods are now covered by this system
add: Beauty component, currently only attached to cleanables, but you could attach it to any atom/movable and make them pretty/ugly, affecting mood of anyone in the room.
refactor: Removes the original way of adding mood events, uses signals properly instead.
fix: Cleanables "giving" area's free beauty during initialization
fix: Fixes some events not clearing properly
/cl

Fixes #36444

From now on mood no longer affects you directly, instead it decides whether your sanity goes up or down, when your sanity gets too low you will get the effects of what mood did before.

This means getting hit with bad moods due to being attacked while not mean you are doomed anymore, and you get a large timeframe to get away and just fix your mood later.

I also added the beauty component, you could add this to any object and it would either make a room prettier or uglier, comparable to DF or Rimworld. You could add traits to make certain people ugly, for example.

* [READY] Several fixes/changes to mood, longterm mood effects, beauty component
This commit is contained in:
CitadelStationBot
2018-03-19 21:33:18 -05:00
committed by Poojawa
parent 088f3fda5d
commit dad2d44ea2
64 changed files with 394 additions and 345 deletions
+20 -11
View File
@@ -31,8 +31,9 @@
var/outdoors = FALSE //For space, the asteroid, lavaland, etc. Used with blueprints to determine if we are adding a new area (vs editing a station room)
var/beauty = 0 //To see how clean/dirty this area is, only works with indoors areas.
var/areasize = 0 //Size of the area in tiles, only calculated for indoors areas.
var/totalbeauty = 0 //All beauty in this area combined, only includes indoor area.
var/beauty = 0 // Beauty average per open turf in the area
var/areasize = 0 //Size of the area in open turfs, only calculated for indoors areas.
var/power_equip = TRUE
var/power_light = TRUE
@@ -136,6 +137,7 @@ GLOBAL_LIST_EMPTY(teleportlocs)
if(contents.len)
var/list/areas_in_z = SSmapping.areas_in_z
var/z
update_areasize()
for(var/i in 1 to contents.len)
var/atom/thing = contents[i]
if(!thing)
@@ -148,12 +150,12 @@ GLOBAL_LIST_EMPTY(teleportlocs)
if(!areas_in_z["[z]"])
areas_in_z["[z]"] = list()
areas_in_z["[z]"] += src
update_area_size()
return INITIALIZE_HINT_LATELOAD
/area/LateInitialize()
power_change() // all machines set to current power level, also updates icon
update_beauty()
/area/Destroy()
STOP_PROCESSING(SSobj, src)
@@ -476,12 +478,14 @@ GLOBAL_LIST_EMPTY(teleportlocs)
used_environ += amount
/area/Entered(A)
/area/Entered(atom/movable/M)
set waitfor = FALSE
if(!isliving(A))
SendSignal(COMSIG_AREA_ENTERED, M)
M.SendSignal(COMSIG_ENTER_AREA, src) //The atom that enters the area
if(!isliving(M))
return
var/mob/living/L = A
var/mob/living/L = M
if(!L.ckey)
return
@@ -501,9 +505,9 @@ GLOBAL_LIST_EMPTY(teleportlocs)
L.client.played = TRUE
addtimer(CALLBACK(L.client, /client/proc/ResetAmbiencePlayed), 600)
GET_COMPONENT_FROM(mood, /datum/component/mood, L)
if(mood)
mood.update_beauty(src)
/area/Exited(atom/movable/M)
SendSignal(COMSIG_AREA_EXITED, M)
M.SendSignal(COMSIG_EXIT_AREA, src) //The atom that exits the area
/client/proc/ResetAmbiencePlayed()
played = FALSE
@@ -532,11 +536,16 @@ GLOBAL_LIST_EMPTY(teleportlocs)
blob_allowed = FALSE
addSorted()
/area/proc/update_area_size()
/area/proc/update_beauty()
if(!areasize)
return FALSE
beauty = totalbeauty / areasize
/area/proc/update_areasize()
if(outdoors)
return FALSE
areasize = 0
for(var/turf/T in src.contents)
for(var/turf/open/T in contents)
areasize++
/area/AllowDrop()
+9 -11
View File
@@ -70,9 +70,7 @@
Reset()
/obj/machinery/computer/arcade/proc/prizevend(mob/user)
GET_COMPONENT_FROM(mood, /datum/component/mood, user)
if(mood)
mood.add_event("arcade", /datum/mood_event/arcade)
user.SendSignal(COMSIG_ADD_MOOD_EVENT, "arcade", /datum/mood_event/arcade)
if(prob(0.0001)) //1 in a million
new /obj/item/gun/energy/pulse/prize(src)
SSmedals.UnlockMedal(MEDAL_PULSE, usr.client)
@@ -175,7 +173,7 @@
sleep(10)
enemy_hp -= attackamt
arcade_action()
arcade_action(usr)
else if (href_list["heal"])
blocked = TRUE
@@ -191,7 +189,7 @@
player_hp += healamt
blocked = TRUE
updateUsrDialog()
arcade_action()
arcade_action(usr)
else if (href_list["charge"])
blocked = TRUE
@@ -204,7 +202,7 @@
updateUsrDialog()
sleep(10)
arcade_action()
arcade_action(usr)
if (href_list["close"])
usr.unset_machine()
@@ -227,7 +225,7 @@
updateUsrDialog()
return
/obj/machinery/computer/arcade/battle/proc/arcade_action()
/obj/machinery/computer/arcade/battle/proc/arcade_action(mob/user)
if ((enemy_mp <= 0) || (enemy_hp <= 0))
if(!gameover)
gameover = TRUE
@@ -242,7 +240,7 @@
Reset()
obj_flags &= ~EMAGGED
else
prizevend(usr)
prizevend(user)
SSblackbox.record_feedback("nested tally", "arcade_results", 1, list("win", (obj_flags & EMAGGED ? "emagged":"normal")))
@@ -484,7 +482,7 @@
if (href_list["continue"]) //Continue your travels
if(gameStatus == ORION_STATUS_NORMAL && !event && turns != 7)
if(turns >= ORION_TRAIL_WINTURN)
win()
win(usr)
else
food -= (alive+lings_aboard)*2
fuel -= 5
@@ -1028,7 +1026,7 @@
return removed
/obj/machinery/computer/arcade/orion_trail/proc/win()
/obj/machinery/computer/arcade/orion_trail/proc/win(mob/user)
gameStatus = ORION_STATUS_START
say("Congratulations, you made it to Orion!")
if(obj_flags & EMAGGED)
@@ -1036,7 +1034,7 @@
message_admins("[key_name_admin(usr)] made it to Orion on an emagged machine and got an explosive toy ship.")
log_game("[key_name(usr)] made it to Orion on an emagged machine and got an explosive toy ship.")
else
prizevend(usr)
prizevend(user)
obj_flags &= ~EMAGGED
name = "The Orion Trail"
desc = "Learn how our ancestors got to Orion, and have fun in the process!"
+1
View File
@@ -60,6 +60,7 @@
/obj/structure/sign/poster/Initialize()
. = ..()
addtimer(CALLBACK(src, /datum.proc/AddComponent, /datum/component/beauty, 75), 0)
if(random_basetype)
randomise(random_basetype)
if(!ruined)
+9 -16
View File
@@ -4,17 +4,17 @@
var/list/random_icon_states = list()
var/blood_state = "" //I'm sorry but cleanable/blood code is ass, and so is blood_DNA
var/bloodiness = 0 //0-100, amount of blood in this decal, used for making footprints and affecting the alpha of bloody footprints
var/beauty = 0
var/mergeable_decal = TRUE //when two of these are on a same tile or do we need to merge them into just one?
var/beauty
/obj/effect/decal/cleanable/Initialize(mapload, list/datum/disease/diseases)
. = ..()
if (random_icon_states && length(src.random_icon_states) > 0)
src.icon_state = pick(src.random_icon_states)
if (random_icon_states && length(random_icon_states) > 0)
icon_state = pick(random_icon_states)
create_reagents(300)
if(src.loc && isturf(src.loc))
for(var/obj/effect/decal/cleanable/C in src.loc)
if(C != src && C.type == src.type && !QDELETED(C))
if(loc && isturf(loc))
for(var/obj/effect/decal/cleanable/C in loc)
if(C != src && C.type == type && !QDELETED(C))
if (replace_decal(C))
return INITIALIZE_HINT_QDEL
@@ -26,10 +26,9 @@
if(LAZYLEN(diseases_to_add))
AddComponent(/datum/component/infective, diseases_to_add)
/obj/effect/decal/cleanable/LateInitialize()
if(src.loc && isturf(src.loc))
var/area/A = get_area(src)
A.beauty += beauty / max(1, A.areasize) //Ensures that the effects scale with room size
/obj/effect/decal/cleanable/ComponentInitialize()
. = ..()
addtimer(CALLBACK(src, /datum.proc/AddComponent, /datum/component/beauty, beauty), 0) //inb4 i get yelled at for using the beauty var on cleanable instead of calling this proc on every subtype which would be pedantic and actually run worse.
/obj/effect/decal/cleanable/proc/replace_decal(obj/effect/decal/cleanable/C) // Returns true if we should give up in favor of the pre-existing decal
if(mergeable_decal)
@@ -97,9 +96,3 @@
return bloodiness
else
return 0
/obj/effect/decal/cleanable/Destroy()
. = ..()
if(src.loc && isturf(src.loc))
var/area/A = get_area(src)
A.beauty -= beauty / max(1, A.areasize)
@@ -8,7 +8,7 @@
random_icon_states = list("xfloor1", "xfloor2", "xfloor3", "xfloor4", "xfloor5", "xfloor6", "xfloor7")
bloodiness = MAX_SHOE_BLOODINESS
blood_state = BLOOD_STATE_XENO
beauty = -200
beauty = -250
/obj/effect/decal/cleanable/xenoblood/Initialize()
. = ..()
@@ -6,7 +6,7 @@
random_icon_states = list("floor1", "floor2", "floor3", "floor4", "floor5", "floor6", "floor7")
blood_state = BLOOD_STATE_HUMAN
bloodiness = MAX_SHOE_BLOODINESS
beauty = -200
beauty = -250
/obj/effect/decal/cleanable/blood/replace_decal(obj/effect/decal/cleanable/blood/C)
C.add_blood_DNA(return_blood_DNA())
@@ -3,7 +3,7 @@
desc = "Someone should clean that up."
icon = 'icons/obj/objects.dmi'
icon_state = "shards"
beauty = -150
beauty = -300
/obj/effect/decal/cleanable/ash
name = "ashes"
@@ -11,7 +11,7 @@
icon = 'icons/obj/objects.dmi'
icon_state = "ash"
mergeable_decal = FALSE
beauty = -150
beauty = -300
/obj/effect/decal/cleanable/ash/Initialize()
. = ..()
@@ -26,7 +26,7 @@
/obj/effect/decal/cleanable/ash/large
name = "large pile of ashes"
icon_state = "big_ash"
beauty = -150
beauty = -300
/obj/effect/decal/cleanable/ash/large/Initialize()
. = ..()
@@ -37,7 +37,7 @@
desc = "Back to sand."
icon = 'icons/obj/shards.dmi'
icon_state = "tiny"
beauty = -20
beauty = -125
/obj/effect/decal/cleanable/glass/Initialize()
. = ..()
@@ -51,7 +51,7 @@
desc = "Someone should clean that up."
icon_state = "dirt"
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
beauty = -150
beauty = -300
/obj/effect/decal/cleanable/flour
name = "flour"
@@ -64,7 +64,7 @@
desc = "Jeez. I hope that's not for lunch."
light_color = LIGHT_COLOR_GREEN
icon_state = "greenglow"
beauty = -100
beauty = -200
/obj/effect/decal/cleanable/greenglow/Initialize(mapload)
. = ..()
@@ -80,7 +80,7 @@
layer = WALL_OBJ_LAYER
icon_state = "cobweb1"
resistance_flags = FLAMMABLE
beauty = -150
beauty = -300
/obj/effect/decal/cleanable/cobweb/cobweb2
icon_state = "cobweb2"
@@ -92,12 +92,12 @@
icon = 'icons/effects/effects.dmi'
icon_state = "molten"
mergeable_decal = FALSE
beauty = -250
beauty = -300
/obj/effect/decal/cleanable/molten_object/large
name = "big gooey grey mass"
icon_state = "big_molten"
beauty = -200
beauty = -450
//Vomit (sorry)
/obj/effect/decal/cleanable/vomit
@@ -106,7 +106,7 @@
icon = 'icons/effects/blood.dmi'
icon_state = "vomit_1"
random_icon_states = list("vomit_1", "vomit_2", "vomit_3", "vomit_4")
beauty = -400
beauty = -600
/obj/effect/decal/cleanable/vomit/attack_hand(mob/user)
if(ishuman(user))
@@ -161,7 +161,7 @@
gender = NEUTER
icon = 'icons/effects/tomatodecal.dmi'
random_icon_states = list("smashed_pie")
beauty = -125
beauty = -200
/obj/effect/decal/cleanable/chem_pile
name = "chemical pile"
@@ -169,7 +169,7 @@
gender = NEUTER
icon = 'icons/obj/objects.dmi'
icon_state = "ash"
beauty = -125
beauty = -200
/obj/effect/decal/cleanable/shreds
name = "shreds"
@@ -177,7 +177,7 @@
icon_state = "shreds"
gender = PLURAL
mergeable_decal = FALSE
beauty = -125
beauty = -200
/obj/effect/decal/cleanable/shreds/ex_act(severity, target)
if(severity == 1) //so shreds created during an explosion aren't deleted by the explosion.
@@ -47,7 +47,7 @@
random_icon_states = list("floor1", "floor2", "floor3", "floor4", "floor5", "floor6", "floor7")
blood_state = BLOOD_STATE_OIL
bloodiness = MAX_SHOE_BLOODINESS
beauty = -125
beauty = -150
/obj/effect/decal/cleanable/oil/Initialize()
. = ..()
+1 -3
View File
@@ -537,9 +537,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
else
M.take_bodypart_damage(7)
GET_COMPONENT_FROM(mood, /datum/component/mood, M)
if(mood)
mood.add_event("eye_stab", /datum/mood_event/eye_stab)
M.SendSignal(COMSIG_ADD_MOOD_EVENT, "eye_stab", /datum/mood_event/eye_stab)
add_logs(user, M, "attacked", "[src.name]", "(INTENT: [uppertext(user.a_intent)])")
+1 -1
View File
@@ -191,7 +191,7 @@
FD.CalculateAffectingAreas()
to_chat(usr, "<span class='notice'>You rename the '[prevname]' to '[str]'.</span>")
log_game("[key_name(usr)] has renamed [prevname] to [str]")
A.update_area_size()
A.update_areasize()
interact()
return 1
+1 -3
View File
@@ -549,9 +549,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
var/hitzone = user.held_index_to_dir(user.active_hand_index) == "r" ? BODY_ZONE_PRECISE_R_HAND : BODY_ZONE_PRECISE_L_HAND
user.apply_damage(5, BURN, hitzone)
user.visible_message("<span class='warning'>After a few attempts, [user] manages to light [src] - however, [user.p_they()] burn their finger in the process.</span>", "<span class='warning'>You burn yourself while lighting the lighter!</span>")
GET_COMPONENT_FROM(mood, /datum/component/mood, user)
if(mood)
mood.add_event("burnt_thumb", /datum/mood_event/burnt_thumb)
user.SendSignal(COMSIG_ADD_MOOD_EVENT, "burnt_thumb", /datum/mood_event/burnt_thumb)
else
set_lit(FALSE)
+1 -3
View File
@@ -117,9 +117,7 @@
AddComponent(/datum/component/squeak, list('sound/items/bikehorn.ogg'=1), 50)
/obj/item/weapon/bikehorn/attack(mob/living/carbon/M, mob/living/carbon/user)
GET_COMPONENT_FROM(mood, /datum/component/mood, M)
if(mood)
mood.add_event("honk", /datum/mood_event/honk)
M.SendSignal(COMSIG_ADD_MOOD_EVENT, "honk", /datum/mood_event/honk)
/obj/item/bikehorn/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] solemnly points the horn at [user.p_their()] temple! It looks like [user.p_theyre()] trying to commit suicide!</span>")
+1 -3
View File
@@ -96,9 +96,7 @@ GLOBAL_LIST_INIT(bibleitemstates, list("bible", "koran", "scrapbook", "bible",
H.visible_message("<span class='notice'>[user] heals [H] with the power of [deity_name]!</span>")
to_chat(H, "<span class='boldnotice'>May the power of [deity_name] compel you to be healed!</span>")
playsound(src.loc, "punch", 25, 1, -1)
GET_COMPONENT_FROM(mood, /datum/component/mood, H)
if(mood)
mood.add_event("blessing", /datum/mood_event/blessing)
H.SendSignal(COMSIG_ADD_MOOD_EVENT, "blessing", /datum/mood_event/blessing)
return 1
/obj/item/storage/book/bible/attack(mob/living/M, mob/living/carbon/human/user, heal_mode = TRUE)
+4
View File
@@ -444,6 +444,10 @@
throw_range = 2
attack_verb = list("busted")
/obj/item/statuebust/Initialize()
. = ..()
addtimer(CALLBACK(src, /datum.proc/AddComponent, /datum/component/beauty, 1000), 0)
/obj/item/tailclub
name = "tail club"
desc = "For the beating to death of lizards with their own tails."
+4
View File
@@ -291,6 +291,10 @@
throw_speed = 2
throw_range = 4
/obj/item/twohanded/required/kirbyplants/Initialize()
. = ..()
addtimer(CALLBACK(src, /datum.proc/AddComponent, /datum/component/beauty, 750), 0)
/obj/item/twohanded/required/kirbyplants/equipped(mob/living/user)
var/image/I = image(icon = 'icons/obj/flora/plants.dmi' , icon_state = src.icon_state, loc = user)
I.copy_overlays(src)
+6 -2
View File
@@ -11,6 +11,10 @@
anchored = TRUE
var/deconstruction_state = SHOWCASE_CONSTRUCTED
/obj/structure/showcase/Initialize()
. = ..()
addtimer(CALLBACK(src, /datum.proc/AddComponent, /datum/component/beauty, 750), 0)
/obj/structure/showcase/fakeid
name = "\improper CentCom identification console"
desc = "You can use this to change ID's."
@@ -18,7 +22,7 @@
icon_state = "computer"
/obj/structure/showcase/fakeid/Initialize()
..()
. = ..()
add_overlay("id")
add_overlay("id_key")
@@ -29,7 +33,7 @@
icon_state = "computer"
/obj/structure/showcase/fakesec/Initialize()
..()
. = ..()
add_overlay("security")
add_overlay("security_key")
+5
View File
@@ -10,6 +10,11 @@
var/material_drop_type = /obj/item/stack/sheet/metal
CanAtmosPass = ATMOS_PASS_DENSITY
/obj/structure/statue/Initialize()
. = ..()
addtimer(CALLBACK(src, /datum.proc/AddComponent, /datum/component/beauty, 1250), 0)
/obj/structure/statue/attackby(obj/item/W, mob/living/user, params)
add_fingerprint(user)
user.changeNext_move(CLICK_CD_MELEE)
+1 -8
View File
@@ -116,14 +116,7 @@
if(!ishuman(pushed_mob))
return
var/mob/living/carbon/human/H = pushed_mob
GET_COMPONENT_FROM(mood, /datum/component/mood, H)
if(mood)
if(iscatperson(H)) //Catpeople are a bit dumb and think its fun to be on a table
mood.add_event("table", /datum/mood_event/happytable)
H.startTailWag()
addtimer(CALLBACK(H, /mob/living/carbon/human.proc/endTailWag), 30)
else
mood.add_event("table", /datum/mood_event/table)
H.SendSignal(COMSIG_ADD_MOOD_EVENT, "table", /datum/mood_event/table)
/obj/structure/table/attackby(obj/item/I, mob/user, params)
if(!(flags_1 & NODECONSTRUCT_1))
+1 -3
View File
@@ -335,9 +335,7 @@
L.ExtinguishMob()
L.adjust_fire_stacks(-20) //Douse ourselves with water to avoid fire more easily
L.remove_atom_colour(WASHABLE_COLOUR_PRIORITY)
GET_COMPONENT_FROM(mood, /datum/component/mood, L)
if(mood)
mood.add_event("shower", /datum/mood_event/nice_shower)
L.SendSignal(COMSIG_ADD_MOOD_EVENT, "shower", /datum/mood_event/nice_shower)
if(iscarbon(L))
var/mob/living/carbon/M = L
. = TRUE
+1 -3
View File
@@ -203,9 +203,7 @@
if(!(lube&SLIDE_ICE))
playsound(C.loc, 'sound/misc/slip.ogg', 50, 1, -3)
GET_COMPONENT_FROM(mood, /datum/component/mood, C)
if(mood)
mood.add_event("slipped", /datum/mood_event/slipped)
C.SendSignal(COMSIG_ADD_MOOD_EVENT, "slipped", /datum/mood_event/slipped)
for(var/obj/item/I in C.held_items)
C.accident(I)