diff --git a/code/game/birthday.dm b/code/game/birthday.dm new file mode 100644 index 0000000000..933d9f020d --- /dev/null +++ b/code/game/birthday.dm @@ -0,0 +1,31 @@ +/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 + if(birthday) //woo + msg = "Today is your birthday! Do you want to increase your character's listed age?" + 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(client.prefs.last_birthday_notification == 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 - client.prefs.last_birthday_notification + age += howmuch + to_chat(src, "You are now [age]! Happy birthday!") + client.prefs.age = age //Set the age on the character sheet + + client.prefs.last_birthday_notification = world_time_year //We only want to ask once a year per character, this persists + client.prefs.save_character() //Save the info diff --git a/code/game/turfs/flooring/seasonal.dm b/code/game/turfs/flooring/seasonal.dm index 5bb1fbe91c..79b90e6f80 100644 --- a/code/game/turfs/flooring/seasonal.dm +++ b/code/game/turfs/flooring/seasonal.dm @@ -1,8 +1,11 @@ var/world_time_season +var/world_time_year +var/world_time_month +var/world_time_day /proc/setup_season() - var/month = text2num(time2text(world.timeofday, "MM")) // get the current month - switch(month) + world_time_month = text2num(time2text(world.timeofday, "MM")) // get the current month + switch(world_time_month) if(1 to 2) world_time_season = "winter" if(3 to 5) @@ -13,6 +16,8 @@ var/world_time_season world_time_season = "autumn" if(12) 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 name = "grass" diff --git a/code/modules/client/preference_setup/general/01_basic.dm b/code/modules/client/preference_setup/general/01_basic.dm index 4b85b2bf0a..ff9f89193f 100644 --- a/code/modules/client/preference_setup/general/01_basic.dm +++ b/code/modules/client/preference_setup/general/01_basic.dm @@ -17,6 +17,9 @@ S["gender"] >> pref.biological_gender S["id_gender"] >> pref.identifying_gender 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["spawnpoint"] >> pref.spawnpoint S["OOC_Notes"] >> pref.metadata @@ -27,11 +30,17 @@ S["gender"] << pref.biological_gender S["id_gender"] << pref.identifying_gender 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["spawnpoint"] << pref.spawnpoint S["OOC_Notes"] << pref.metadata /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.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.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()) @@ -61,6 +70,8 @@ character.gender = pref.biological_gender character.identifying_gender = pref.identifying_gender 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() . = list() @@ -73,7 +84,7 @@ . += "
" . += "Biological Sex: [gender2text(pref.biological_gender)]
" . += "Pronouns: [gender2text(pref.identifying_gender)]
" - . += "Age: [pref.age]
" + . += "Age: [pref.age] Birthday: [pref.bday_month]/[pref.bday_day]
" . += "Spawn Point: [pref.spawnpoint]
" if(config.allow_Metadata) . += "OOC Notes: Edit
" @@ -130,6 +141,54 @@ pref.age = max(min(round(text2num(new_age)), max_age), min_age) 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["spawnpoint"]) var/list/spawnkeys = list() for(var/spawntype in spawntypes) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index db1e8fda21..c6c6e291fb 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -38,6 +38,9 @@ var/list/preferences_datums = list() var/be_random_name = 0 //whether we are a random name every round var/nickname //our character's nickname 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/spawnpoint = "Arrivals Shuttle" //where this character will spawn (0-2). var/b_type = "A+" //blood type (not-chooseable) var/backbag = 2 //backpack type diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 13aa181f1c..4b2236218e 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -43,6 +43,9 @@ 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/bday_month = 0 //Character birth month + var/bday_day = 0 //Character birthday day + 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. diff --git a/code/modules/mob/living/carbon/human/login.dm b/code/modules/mob/living/carbon/human/login.dm index 802ed62a6d..839385ac62 100644 --- a/code/modules/mob/living/carbon/human/login.dm +++ b/code/modules/mob/living/carbon/human/login.dm @@ -19,6 +19,7 @@ client.autohiss_mode = AUTOHISS_BASIC if("Off") client.autohiss_mode = AUTOHISS_OFF + consider_birthday() // VOREStation Add if(species) species.handle_login_special(src) return diff --git a/vorestation.dme b/vorestation.dme index f503be6f86..403c28c6e8 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -543,6 +543,7 @@ #include "code\game\atoms_movable.dm" #include "code\game\atoms_movable_vr.dm" #include "code\game\base_turf.dm" +#include "code\game\birthday.dm" #include "code\game\periodic_news.dm" #include "code\game\response_team.dm" #include "code\game\response_team_vr.dm"