Merge pull request #15118 from Very-Soft/burf

BIRTH
This commit is contained in:
Heroman3003
2023-07-08 06:49:19 +10:00
committed by CHOMPStation2
parent 45b03b6ded
commit 01869185b3
9 changed files with 119 additions and 3 deletions

37
code/game/birthday.dm Normal file
View File

@@ -0,0 +1,37 @@
/mob/living/carbon/human/proc/consider_birthday()
if(!bday_month || !bday_day) //If we don't have one of these set, don't worry about it
return
if(real_name != client.prefs.real_name) //let's not celebrate the birthday of that weird mob we got dropped into
return
if(!(client.prefs.last_birthday_notification < world_time_year)) //you only get notified once a year
return
if((world_time_month == bday_month) && (world_time_day == bday_day)) //it is your birthday
birthday(1)
else if(world_time_month > bday_month) //your birthday was in a previous month
birthday()
else if((world_time_month == bday_month) && (world_time_day > bday_day)) //your birthday was earlier this month
birthday()
/mob/living/carbon/human/proc/birthday(var/birthday = 0)
var/msg
var/lastyear = client.prefs.last_birthday_notification
client.prefs.last_birthday_notification = world_time_year //We only want to ask once a year per character, this persists, update early in case of shenanigans
if(birthday) //woo
msg = "Today is your birthday! Do you want to increase your character's listed age?"
if(client.prefs.bday_announce)
var/list/sounds = list('sound/voice/BIRTH1.ogg','sound/voice/BIRTH2.ogg')
var/oursound = pickweight(sounds)
command_announcement.Announce("Confirmed presence of BIRTHDAY aboard the station! It is [src.real_name]'s birthday or similar sort of celebration, name day, hatchday, WHATEVER! We encourage you to go find [src.real_name] and show them how we celebrate around here! Have a secure day!", "BIRTHDAY!", oursound)
to_world("We did it")
else
msg = "Your birthday has passed! Do you want to increase your character's listed age?" //sad, but thus is the life of an adult
if(tgui_alert(src, msg,"BIRTHDAY! ([bday_month]/[bday_day])",list("Level me up, baby","No way, I'mma stay young forever")) == "Level me up, baby")
if(lastyear == 0) //We've never been asked, so let's just assume you were keeping track before now and only add 1
age += 1
else
var/howmuch = world_time_year - lastyear
age += howmuch
to_chat(src, "<span class = 'notice'>You are now [age]! Happy birthday!</span>")
client.prefs.age = age //Set the age on the character sheet
client.prefs.save_character() //Save the info

View File

@@ -1,8 +1,11 @@
var/world_time_season var/world_time_season
var/world_time_year
var/world_time_month
var/world_time_day
/proc/setup_season() /proc/setup_season()
var/month = text2num(time2text(world.timeofday, "MM")) // get the current month world_time_month = text2num(time2text(world.timeofday, "MM")) // get the current month
switch(month) switch(world_time_month)
if(1 to 2) if(1 to 2)
world_time_season = "winter" world_time_season = "winter"
if(3 to 5) if(3 to 5)
@@ -13,6 +16,8 @@ var/world_time_season
world_time_season = "autumn" world_time_season = "autumn"
if(12) if(12)
world_time_season = "winter" world_time_season = "winter"
world_time_day = text2num(time2text(world.timeofday, "DD"))
world_time_year = text2num(time2text(world.timeofday, "YYYY"))
/turf/simulated/floor/outdoors/grass/seasonal /turf/simulated/floor/outdoors/grass/seasonal
name = "grass" name = "grass"

View File

@@ -17,6 +17,10 @@
S["gender"] >> pref.biological_gender S["gender"] >> pref.biological_gender
S["id_gender"] >> pref.identifying_gender S["id_gender"] >> pref.identifying_gender
S["age"] >> pref.age S["age"] >> pref.age
S["bday_month"] >> pref.bday_month
S["bday_day"] >> pref.bday_day
S["last_bday_note"] >> pref.last_birthday_notification
S["bday_announce"] >> pref.bday_announce
S["spawnpoint"] >> pref.spawnpoint S["spawnpoint"] >> pref.spawnpoint
S["OOC_Notes"] >> pref.metadata S["OOC_Notes"] >> pref.metadata
@@ -27,11 +31,18 @@
S["gender"] << pref.biological_gender S["gender"] << pref.biological_gender
S["id_gender"] << pref.identifying_gender S["id_gender"] << pref.identifying_gender
S["age"] << pref.age S["age"] << pref.age
S["bday_month"] << pref.bday_month
S["bday_day"] << pref.bday_day
S["last_bday_note"] << pref.last_birthday_notification
S["bday_announce"] << pref.bday_announce
S["spawnpoint"] << pref.spawnpoint S["spawnpoint"] << pref.spawnpoint
S["OOC_Notes"] << pref.metadata S["OOC_Notes"] << pref.metadata
/datum/category_item/player_setup_item/general/basic/sanitize_character() /datum/category_item/player_setup_item/general/basic/sanitize_character()
pref.age = sanitize_integer(pref.age, get_min_age(), get_max_age(), initial(pref.age)) pref.age = sanitize_integer(pref.age, get_min_age(), get_max_age(), initial(pref.age))
pref.bday_month = sanitize_integer(pref.bday_month, 0, 12, initial(pref.bday_month))
pref.bday_day = sanitize_integer(pref.bday_day, 0, 31, initial(pref.bday_day))
pref.last_birthday_notification = sanitize_integer(pref.last_birthday_notification, 0, 9999, initial(pref.last_birthday_notification))
pref.biological_gender = sanitize_inlist(pref.biological_gender, get_genders(), pick(get_genders())) pref.biological_gender = sanitize_inlist(pref.biological_gender, get_genders(), pick(get_genders()))
pref.identifying_gender = (pref.identifying_gender in all_genders_define_list) ? pref.identifying_gender : pref.biological_gender pref.identifying_gender = (pref.identifying_gender in all_genders_define_list) ? pref.identifying_gender : pref.biological_gender
pref.real_name = sanitize_name(pref.real_name, pref.species, is_FBP()) pref.real_name = sanitize_name(pref.real_name, pref.species, is_FBP())
@@ -61,6 +72,8 @@
character.gender = pref.biological_gender character.gender = pref.biological_gender
character.identifying_gender = pref.identifying_gender character.identifying_gender = pref.identifying_gender
character.age = pref.age character.age = pref.age
character.bday_month = pref.bday_month
character.bday_day = pref.bday_day
/datum/category_item/player_setup_item/general/basic/content() /datum/category_item/player_setup_item/general/basic/content()
. = list() . = list()
@@ -73,7 +86,7 @@
. += "<br>" . += "<br>"
. += "<b>Biological Sex:</b> <a href='?src=\ref[src];bio_gender=1'><b>[gender2text(pref.biological_gender)]</b></a><br>" . += "<b>Biological Sex:</b> <a href='?src=\ref[src];bio_gender=1'><b>[gender2text(pref.biological_gender)]</b></a><br>"
. += "<b>Pronouns:</b> <a href='?src=\ref[src];id_gender=1'><b>[gender2text(pref.identifying_gender)]</b></a><br>" . += "<b>Pronouns:</b> <a href='?src=\ref[src];id_gender=1'><b>[gender2text(pref.identifying_gender)]</b></a><br>"
. += "<b>Age:</b> <a href='?src=\ref[src];age=1'>[pref.age]</a><br>" . += "<b>Age:</b> <a href='?src=\ref[src];age=1'>[pref.age]</a> <b>Birthday:</b> <a href='?src=\ref[src];bday_month=1'>[pref.bday_month]</a><b>/</b><a href='?src=\ref[src];bday_day=1'>[pref.bday_day]</a> - <b>Announce?:</b> <a href='?src=\ref[src];bday_announce=1'>[pref.bday_announce ? "Yes" : "No"]</a><br>"
. += "<b>Spawn Point</b>: <a href='?src=\ref[src];spawnpoint=1'>[pref.spawnpoint]</a><br>" . += "<b>Spawn Point</b>: <a href='?src=\ref[src];spawnpoint=1'>[pref.spawnpoint]</a><br>"
if(config.allow_Metadata) if(config.allow_Metadata)
. += "<b>OOC Notes:</b> <a href='?src=\ref[src];metadata=1'> Edit </a><br>" . += "<b>OOC Notes:</b> <a href='?src=\ref[src];metadata=1'> Edit </a><br>"
@@ -130,6 +143,58 @@
pref.age = max(min(round(text2num(new_age)), max_age), min_age) pref.age = max(min(round(text2num(new_age)), max_age), min_age)
return TOPIC_REFRESH return TOPIC_REFRESH
else if(href_list["bday_month"])
var/new_month = tgui_input_number(user, "Choose your character's birth month (number)", "Birthday Month", pref.bday_month, 0, 12)
if(new_month && CanUseTopic(user))
pref.bday_month = new_month
else if((tgui_alert(user, "Would you like to clear the birthday entry?","Clear?",list("No","Yes")) == "Yes") && CanUseTopic(user))
pref.bday_month = 0
pref.bday_day = 0
return TOPIC_REFRESH
else if(href_list["bday_day"])
if(!pref.bday_month)
tgui_alert(user,"You must set a birth month before you can set a day.", "Error", list("Okay"))
return
var/max_days
switch(pref.bday_month)
if(1)
max_days = 31
if(2)
max_days = 29
if(3)
max_days = 31
if(4)
max_days = 30
if(5)
max_days = 31
if(6)
max_days = 30
if(7)
max_days = 31
if(8)
max_days = 31
if(9)
max_days = 30
if(10)
max_days = 31
if(11)
max_days = 30
if(12)
max_days = 31
var/new_day = tgui_input_number(user, "Choose your character's birth day (number, 1-[max_days])", "Birthday Day", pref.bday_day, 0, max_days)
if(new_day && CanUseTopic(user))
pref.bday_day = new_day
else if((tgui_alert(user, "Would you like to clear the birthday entry?","Clear?",list("No","Yes")) == "Yes") && CanUseTopic(user))
pref.bday_month = 0
pref.bday_day = 0
return TOPIC_REFRESH
else if(href_list["bday_announce"])
pref.bday_announce = !pref.bday_announce
return TOPIC_REFRESH
else if(href_list["spawnpoint"]) else if(href_list["spawnpoint"])
var/list/spawnkeys = list() var/list/spawnkeys = list()
for(var/spawntype in spawntypes) for(var/spawntype in spawntypes)

View File

@@ -37,6 +37,10 @@ var/list/preferences_datums = list()
var/be_random_name = 0 //whether we are a random name every round var/be_random_name = 0 //whether we are a random name every round
var/nickname //our character's nickname var/nickname //our character's nickname
var/age = 30 //age of character var/age = 30 //age of character
var/bday_month = 0 //Birthday month
var/bday_day = 0 //Birthday day
var/last_birthday_notification = 0 //The last year we were notified about our birthday
var/bday_announce = FALSE //Public announcement for birthdays
var/spawnpoint = "Arrivals Shuttle" //where this character will spawn (0-2). var/spawnpoint = "Arrivals Shuttle" //where this character will spawn (0-2).
var/b_type = "A+" //blood type (not-chooseable) var/b_type = "A+" //blood type (not-chooseable)
var/backbag = 2 //backpack type var/backbag = 2 //backpack type

View File

@@ -43,6 +43,9 @@
var/lip_style = null //no lipstick by default- arguably misleading, as it could be used for general makeup var/lip_style = null //no lipstick by default- arguably misleading, as it could be used for general makeup
var/age = 30 //Player's age (pure fluff) var/age = 30 //Player's age (pure fluff)
var/bday_month = 0 //Character birth month
var/bday_day = 0 //Character birthday day
var/b_type = "A+" //Player's bloodtype var/b_type = "A+" //Player's bloodtype
var/datum/robolimb/synthetic //If they are a synthetic (aka synthetic torso). Also holds the datum for the type of robolimb. var/datum/robolimb/synthetic //If they are a synthetic (aka synthetic torso). Also holds the datum for the type of robolimb.

View File

@@ -19,6 +19,7 @@
client.autohiss_mode = AUTOHISS_BASIC client.autohiss_mode = AUTOHISS_BASIC
if("Off") if("Off")
client.autohiss_mode = AUTOHISS_OFF client.autohiss_mode = AUTOHISS_OFF
consider_birthday()
// VOREStation Add // VOREStation Add
if(species) species.handle_login_special(src) if(species) species.handle_login_special(src)
return return

BIN
sound/voice/BIRTH1.ogg Normal file

Binary file not shown.

BIN
sound/voice/BIRTH2.ogg Normal file

Binary file not shown.

View File

@@ -574,6 +574,7 @@
#include "code\game\atoms_movable_ch.dm" #include "code\game\atoms_movable_ch.dm"
#include "code\game\atoms_movable_vr.dm" #include "code\game\atoms_movable_vr.dm"
#include "code\game\base_turf.dm" #include "code\game\base_turf.dm"
#include "code\game\birthday.dm"
#include "code\game\periodic_news.dm" #include "code\game\periodic_news.dm"
#include "code\game\response_team.dm" #include "code\game\response_team.dm"
#include "code\game\response_team_vr.dm" #include "code\game\response_team_vr.dm"