Skip to content

Commit

Permalink
Slotting in the Polaris lore entries from Mechoid's culture PR.
Browse files Browse the repository at this point in the history
Piecemeal backporting the Nebula culture system.
  • Loading branch information
MistakeNot4892 committed Jul 19, 2023
1 parent 567f003 commit d059070
Show file tree
Hide file tree
Showing 40 changed files with 1,079 additions and 36 deletions.
11 changes: 11 additions & 0 deletions code/__defines/culture.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#define TAG_CULTURE "culture"
#define TAG_HOMEWORLD "home_system"
#define TAG_FACTION "faction"
#define TAG_RELIGION "religion"

var/global/list/ALL_CULTURAL_TAGS = list(
TAG_CULTURE = "Culture",
TAG_HOMEWORLD = "Residence",
TAG_FACTION = "Faction",
TAG_RELIGION = "Beliefs"
)
2 changes: 1 addition & 1 deletion code/controllers/subsystems/persistence.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ SUBSYSTEM_DEF(persistence)
if(!A || (A.atom_flags & AREA_FLAG_IS_NOT_PERSISTENT))
return

// if((!T.z in GLOB.using_map.station_levels) || !initialized)
// if((!T.z in using_map.station_levels) || !initialized)
if(!(T.z in using_map.station_levels))
return

Expand Down
4 changes: 4 additions & 0 deletions code/datums/datacore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,12 @@ var/global/list/PDA_Manifest = list()
G.fields["m_stat"] = "Stable"
G.fields["sex"] = gender2text(H.gender)
G.fields["species"] = H.get_species_name()
/*
G.fields["home_system"] = H.home_system
G.fields["citizenship"] = H.citizenship
G.fields["faction"] = H.personal_faction
G.fields["religion"] = H.religion
*/
if(H.gen_record && !jobban_isbanned(H, "Records"))
G.fields["notes"] = H.gen_record

Expand Down Expand Up @@ -388,10 +390,12 @@ var/global/list/PDA_Manifest = list()
L.fields["enzymes"] = H.dna.SE // Used in respawning
L.fields["identity"] = H.dna.UI // "
L.fields["species"] = H.get_species_name()
/*
L.fields["home_system"] = H.home_system
L.fields["citizenship"] = H.citizenship
L.fields["faction"] = H.personal_faction
L.fields["religion"] = H.religion
*/
L.fields["image"] = icon(cached_character_icon(H), dir = SOUTH)
L.fields["antagfac"] = H.antag_faction
L.fields["antagvis"] = H.antag_vis
Expand Down
7 changes: 3 additions & 4 deletions code/game/gamemodes/game_mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -523,11 +523,10 @@ var/global/list/additional_antag_types = list()

/proc/get_nt_opposed()
var/list/dudes = list()
for(var/mob/living/carbon/human/man in player_list)
for(var/mob/living/carbon/human/man in global.player_list)
if(man.client)
if(man.client.prefs.economic_status == CLASS_LOWER)
dudes += man
else if(man.client.prefs.economic_status == CLASS_LOWMID && prob(50))
var/decl/cultural_info/culture = man.get_cultural_value(TAG_FACTION)
if(culture && prob(25 * culture.subversive_potential))
dudes += man
if(dudes.len == 0) return null
return pick(dudes)
Expand Down
27 changes: 21 additions & 6 deletions code/game/jobs/job_controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -356,22 +356,37 @@ var/global/datum/controller/occupations/job_master
if(!G) //Not a real gear datum (maybe removed, as this is loaded from their savefile)
continue

var/permitted
var/permitted = FALSE
// Check if it is restricted to certain roles
if(G.allowed_roles)
for(var/job_name in G.allowed_roles)
if(job.title == job_name)
permitted = 1
permitted = TRUE
else
permitted = 1
permitted = TRUE

// Check if they're whitelisted for this gear (in alien whitelist? seriously?)
if(G.whitelisted && !is_alien_whitelisted(H, GLOB.all_species[G.whitelisted]))
permitted = 0
if(permitted && G.whitelisted && !is_alien_whitelisted(H, GLOB.all_species[G.whitelisted]))
permitted = FALSE

if(permitted && length(G.available_to_backgrounds))
permitted = FALSE
for(var/tag in ALL_CULTURAL_TAGS)
var/decl/cultural_info/culture_decl = H.get_cultural_value(tag)
if(culture_decl && (culture_decl.type in G.available_to_backgrounds))
permitted = TRUE
break

if(permitted && length(G.blacklisted_from_backgrounds))
for(var/tag in ALL_CULTURAL_TAGS)
var/decl/cultural_info/culture_decl = H.get_cultural_value(tag)
if(culture_decl && (culture_decl.type in G.blacklisted_from_backgrounds))
permitted = FALSE
break

// If they aren't, tell them
if(!permitted)
to_chat(H, "<span class='warning'>Your current species, job or whitelist status does not permit you to spawn with [thing]!</span>")
to_chat(H, "<span class='warning'>Your current species, job, background or whitelist status does not permit you to spawn with [thing]!</span>")
continue

// Implants get special treatment
Expand Down
18 changes: 14 additions & 4 deletions code/modules/client/preference_setup/general/05_background.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,32 @@
S["med_record"] >> pref.med_record
S["sec_record"] >> pref.sec_record
S["gen_record"] >> pref.gen_record
/*
S["home_system"] >> pref.home_system
S["citizenship"] >> pref.citizenship
S["faction"] >> pref.faction
S["religion"] >> pref.religion
S["economic_status"] >> pref.economic_status

*/
/datum/category_item/player_setup_item/general/background/save_character(var/savefile/S)
S["med_record"] << pref.med_record
S["sec_record"] << pref.sec_record
S["gen_record"] << pref.gen_record
/*
S["home_system"] << pref.home_system
S["citizenship"] << pref.citizenship
S["faction"] << pref.faction
S["religion"] << pref.religion
S["economic_status"] << pref.economic_status
*/

/datum/category_item/player_setup_item/general/background/sanitize_character()
/*
if(!pref.home_system) pref.home_system = "Unset"
if(!pref.citizenship) pref.citizenship = "Solar Confederate Government"
if(!pref.faction) pref.faction = "NanoTrasen"
if(!pref.religion) pref.religion = "None"
*/

pref.economic_status = sanitize_inlist(pref.economic_status, ECONOMIC_CLASS, initial(pref.economic_status))

Expand All @@ -35,19 +40,22 @@
character.med_record = pref.med_record
character.sec_record = pref.sec_record
character.gen_record = pref.gen_record
/*
character.home_system = pref.home_system
character.citizenship = pref.citizenship
character.personal_faction = pref.faction
character.religion = pref.religion
*/

/datum/category_item/player_setup_item/general/background/content(var/mob/user)
. += "<b>Background Information</b><br>"
/*
. += "Economic Status: <a href='?src=\ref[src];econ_status=1'>[pref.economic_status]</a><br/>"
. += "Home System: <a href='?src=\ref[src];home_system=1'>[pref.home_system]</a><br/>"
. += "Citizenship: <a href='?src=\ref[src];citizenship=1'>[pref.citizenship]</a><br/>"
. += "Faction: <a href='?src=\ref[src];faction=1'>[pref.faction]</a><br/>"
. += "Religion: <a href='?src=\ref[src];religion=1'>[pref.religion]</a><br/>"

*/
. += "<br/><b>Records</b>:<br/>"
if(jobban_isbanned(user, "Records"))
. += "<span class='danger'>You are banned from using character records.</span><br>"
Expand All @@ -60,6 +68,7 @@
. += "<a href='?src=\ref[src];set_security_records=1'>[TextPreview(pref.sec_record,40)]</a><br>"

/datum/category_item/player_setup_item/general/background/OnTopic(var/href,var/list/href_list, var/mob/user)
/*
if(href_list["econ_status"])
var/new_class = input(user, "Choose your economic status. This will affect the amount of money you will start with.", "Character Preference", pref.economic_status) as null|anything in ECONOMIC_CLASS
if(new_class && CanUseTopic(user))
Expand Down Expand Up @@ -113,8 +122,9 @@
else
pref.religion = choice
return TOPIC_REFRESH

else if(href_list["set_medical_records"]) //2023-03-18, we're using sanitizeSafe() in order to remove <> entirely, allowing us to safely decode it on the pref screen
else
*/
if(href_list["set_medical_records"]) //2023-03-18, we're using sanitizeSafe() in order to remove <> entirely, allowing us to safely decode it on the pref screen
var/new_medical = html_decode(sanitizeSafe(input(user,"Enter medical information here.","Character Preference", html_decode(pref.med_record)) as message|null, MAX_RECORD_LENGTH, extra = 0))
if(!isnull(new_medical) && !jobban_isbanned(user, "Records") && CanUseTopic(user))
pref.med_record = new_medical
Expand Down
129 changes: 129 additions & 0 deletions code/modules/client/preference_setup/general/06_background.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#define GET_ALLOWED_VALUES(write_to, check_key) \
var/datum/species/S = GLOB.all_species[pref.species]; \
if(!S) { \
write_to = list(); \
} else if(S.force_cultural_info[check_key]) { \
write_to = list(S.force_cultural_info[check_key] = TRUE); \
} else { \
write_to = list(); \
for(var/cul in S.available_cultural_info[check_key]) { \
write_to[cul] = TRUE; \
} \
}

/datum/preferences
var/list/cultural_info = list()

/datum/category_item/player_setup_item/general/background
name = "Culture"
sort_order = 6
var/list/hidden
var/list/expanded

/datum/category_item/player_setup_item/general/background/New()
hidden = list()
expanded = list()
for(var/token in ALL_CULTURAL_TAGS)
hidden[token] = TRUE
expanded[token] = FALSE
..()

/datum/category_item/player_setup_item/general/background/sanitize_character()

if(!islist(pref.cultural_info))
pref.cultural_info = list()

// Map any non-path tokens (ie. data that has been loaded from a file) to decls.
var/list/all_cultural_decls = decls_repository.get_decls_of_subtype(/decl/cultural_info)
for(var/token in ALL_CULTURAL_TAGS)
var/entry = pref.cultural_info[token]
if(!entry || ispath(entry, /decl/cultural_info))
continue
entry = lowertext(entry)
pref.cultural_info -= token
for(var/ftype in all_cultural_decls)
var/decl/cultural_info/culture = all_cultural_decls[ftype]
if(lowertext(culture.name) == entry)
pref.cultural_info[token] = culture.type
break

// Sanitize and initialize our culture lists, taking data from our map
// or other defaults if we haven't got anything loaded for the various tokens.
for(var/token in ALL_CULTURAL_TAGS)
var/list/_cultures
GET_ALLOWED_VALUES(_cultures, token)
if(!LAZYLEN(_cultures))
pref.cultural_info[token] = global.using_map.default_cultural_info[token]
else
var/current_value = pref.cultural_info[token]
if(!current_value || !_cultures[current_value])
pref.cultural_info[token] = _cultures[1]

/datum/category_item/player_setup_item/general/background/load_character(var/savefile/S)
for(var/token in ALL_CULTURAL_TAGS)
S[token] >> pref.cultural_info[token]

/datum/category_item/player_setup_item/general/background/save_character(var/savefile/S)
for(var/token in ALL_CULTURAL_TAGS)
var/entry = pref.cultural_info[token]
if(entry)
if(ispath(entry, /decl/cultural_info))
var/decl/cultural_info/culture = GET_DECL(entry)
entry = culture.name
S[token] << entry

/datum/category_item/player_setup_item/general/background/content()
. = list()
for(var/token in ALL_CULTURAL_TAGS)

var/decl/cultural_info/culture = GET_DECL(pref.cultural_info[token])

. += "<table width = '100%'>"
. += "<tr><td colspan=3><center><h3>[ALL_CULTURAL_TAGS[token]]: <a href='?src=\ref[src];expand_options_[token]=1'>[culture.name] <small>\[[expanded[token] ? "-" : "+"]\]</small></a></h3>"
if(expanded[token])
var/list/valid_values
GET_ALLOWED_VALUES(valid_values, token)
. += "</center></td></tr>"
. += "<tr><td colspan=3><center>"
for(var/culture_path in valid_values)
var/decl/cultural_info/culture_data = GET_DECL(culture_path)
if(pref.cultural_info[token] == culture_data.type)
. += "<span class='linkOn'>[culture_data.name]</span> "
else
. += "<a href='?src=\ref[src];set_token_entry_[token]=\ref[culture_data]'>[culture_data.name]</a> "
. += "</center><hr/></td></tr>"

var/list/culture_info = culture.get_description(!hidden[token])
. += "<tr><td width = '200px'>"
. += "<small>[culture_info["details"] || "No additional details."]</small>"
. += "</td><td>"
. += "[culture_info["body"] || "No description."]"
. += "</td><td width = '50px'>"
. += "<a href='?src=\ref[src];toggle_verbose_[token]=1'>[hidden[token] ? "Expand" : "Collapse"]</a>"
. += "</td></tr>"
. += "</table><hr>"

. = jointext(.,null)

/datum/category_item/player_setup_item/general/background/OnTopic(var/href,var/list/href_list, var/mob/user)

for(var/token in ALL_CULTURAL_TAGS)

if(href_list["toggle_verbose_[token]"])
hidden[token] = !hidden[token]
return TOPIC_REFRESH

if(href_list["expand_options_[token]"])
expanded[token] = !expanded[token]
return TOPIC_REFRESH

var/decl/cultural_info/new_token = href_list["set_token_entry_[token]"]
if(!isnull(new_token))
new_token = locate(new_token)
if(istype(new_token))
pref.cultural_info[token] = new_token.type
return TOPIC_REFRESH

. = ..()

#undef GET_ALLOWED_VALUES
2 changes: 2 additions & 0 deletions code/modules/client/preference_setup/loadout/loadout.dm
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ var/global/list/gear_datums = list()
var/list/gear_tweaks = list() //List of datums which will alter the item after it has been spawned.
var/exploitable = 0 //Does it go on the exploitable information list?
var/type_category = null
var/list/blacklisted_from_backgrounds // If set to a list, background paths in this list will ban the item.
var/list/available_to_backgrounds // If set to a list, only background paths in this list will allow the item.

/datum/gear/New()
..()
Expand Down
14 changes: 10 additions & 4 deletions code/modules/client/preference_setup/preference_setup.dm
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,23 @@

// Returns what kind of FBP the player's prefs are. Returns 0 if they're not an FBP.
/datum/category_item/player_setup_item/proc/get_FBP_type()
// todo retrieve braintype from culture
if(!is_FBP())
return 0 // Not a robot.
if(O_BRAIN in pref.organ_data)
switch(pref.organ_data[O_BRAIN])
if("assisted")
return PREF_FBP_CYBORG
. = PREF_FBP_CYBORG
if("mechanical")
return PREF_FBP_POSI
. = PREF_FBP_POSI
if("digital")
return PREF_FBP_SOFTWARE
return 0 //Something went wrong!
. = PREF_FBP_SOFTWARE
if(.)
for(var/tag in pref.cultural_info)
var/decl/cultural_info/culture_decl = GET_DECL(pref.cultural_info[tag])
var/new_brain = culture_decl.override_fbp_brain_type(.)
if(new_brain && new_brain != .)
. = new_brain

/datum/category_item/player_setup_item/proc/get_min_age()
var/datum/species/S = GLOB.all_species[pref.species ? pref.species : "Human"]
Expand Down
6 changes: 1 addition & 5 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ var/global/list/preferences_datums = list()
var/b_synth //Same as above
var/synth_markings = 0 //Enable/disable markings on synth parts.

//Some faction information.
var/home_system = "Unset" //System of birth.
var/citizenship = "Solar Confederate Government" //Nation of citizenship
var/faction = "NanoTrasen" //General associated faction.
var/religion = "None" //Religious association.
//Some faction information.
var/antag_faction = "None" //Antag associated faction.
var/antag_vis = "Hidden" //How visible antag association is to others.

Expand Down
Loading

0 comments on commit d059070

Please sign in to comment.