Enables round-to-round persistence of a few aspects of characters.

* More accurately, it automates updating your character setup.  None of this code does anything you could not already do manually on the Character Setup screen, it simply does it automatically for you.
* Specifically a few things are saved either at round end or when you cryo:
  * Your late-join spawn location is determined by which cryo/elevator/etc you used to leave last time.  Departing thru the elevators will set your spawn location to elevators etc.
  * Your weight is saved (also any extra or deficient nutrition is resolved into weight gain/loss)
  * Your limbs settings are updated based on your status at end of round (whether limbs are normal, missing, robotic, etc)
  * Your markings are saved so they will be the same as when they were at end of round.
* ALL of these changes are optional, toggled on the VORE tab of character setup.
* Replaced hard coded numbers for weight gain with constant defines.
This commit is contained in:
Leshana
2017-04-03 17:57:08 -04:00
parent cf8a7a8bee
commit f17ea64bbe
11 changed files with 269 additions and 40 deletions
@@ -0,0 +1,65 @@
#define PERSIST_SPAWN 0x01 // Persist spawnpoint based on location of despawn/logout.
#define PERSIST_WEIGHT 0x02 // Persist mob weight
#define PERSIST_ORGANS 0x04 // Persist the status (normal/amputated/robotic/etc) and model (for robotic) status of organs
#define PERSIST_MARKINGS 0x08 // Persist markings
#define PERSIST_COUNT 4 // Number of valid bits in this bitflag. Keep this updated!
#define PERSIST_DEFAULT PERSIST_SPAWN|PERSIST_ORGANS|PERSIST_MARKINGS // Default setting for new folks
// Define a place to save in character setup
/datum/preferences
var/persistence_settings = PERSIST_DEFAULT // Control what if anything is persisted for this character between rounds.
// Definition of the stuff for Sizing
/datum/category_item/player_setup_item/vore/persistence
name = "Persistence"
sort_order = 5
/datum/category_item/player_setup_item/vore/persistence/load_character(var/savefile/S)
S["persistence_settings"] >> pref.persistence_settings
/datum/category_item/player_setup_item/vore/persistence/save_character(var/savefile/S)
S["persistence_settings"] << pref.persistence_settings
/datum/category_item/player_setup_item/vore/persistence/sanitize_character()
pref.persistence_settings = sanitize_integer(pref.persistence_settings, 0, (1<<(PERSIST_COUNT+1)-1), initial(pref.persistence_settings))
/datum/category_item/player_setup_item/vore/persistence/content(var/mob/user)
. = list()
. += "<b>Round-to-Round Persistence</b><br>"
. += "<table>"
. += "<tr><td title=\"Set spawn location based on where you cryo'd out.\">Save Spawn Location: </td>"
. += make_yesno(PERSIST_SPAWN)
. += "</tr>"
. += "<tr><td title=\"Save your character's weight until next round.\">Save Weight: </td>"
. += make_yesno(PERSIST_WEIGHT)
. += "</tr>"
. += "<tr><td title=\"Update organ preferences (normal/amputated/robotic/etc) and model (for robotic) based on what you have at round end.\">Save Organs: </td>"
. += make_yesno(PERSIST_ORGANS)
. += "</tr>"
. += "<tr><td title=\"Update marking preferences (type and color) based on what you have at round end.\">Save Markings: </td>"
. += make_yesno(PERSIST_MARKINGS)
. += "</tr>"
. += "</table>"
return jointext(., "")
/datum/category_item/player_setup_item/vore/persistence/proc/make_yesno(var/bit)
if(pref.persistence_settings & bit)
return "<td><span class='linkOn'><b>Yes</b></span></td> <td><a href='?src=\ref[src];toggle_off=[bit]'>No</a></td>"
else
return "<td><a href='?src=\ref[src];toggle_on=[bit]'>Yes</a></td> <td><span class='linkOn'><b>No</b></span></td>"
/datum/category_item/player_setup_item/vore/persistence/OnTopic(var/href, var/list/href_list, var/mob/user)
if(href_list["toggle_on"])
var/bit = text2num(href_list["toggle_on"])
pref.persistence_settings |= bit
return TOPIC_REFRESH
else if(href_list["toggle_off"])
var/bit = text2num(href_list["toggle_off"])
pref.persistence_settings &= ~bit
return TOPIC_REFRESH
return ..()