Files
CHOMPStation2/code/modules/client/preference_setup/vore/05_persistence.dm
Arokha Sieyes b1aeba9281 Persistent size between rounds
Allows your size to save at the end of each round. Get shrank'd or enbiggened? Now you can stay tiny between rounds if you like that consistency.

Don't want that? Just turn it off on the VORE tab. Accidentally left it on, and got saved? Just change your size to what you want in the character setup (and turn off saving it, too).
2017-06-16 09:41:34 -04:00

72 lines
3.2 KiB
Plaintext

#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_SIZE 0x10 // Persist size
#define PERSIST_COUNT 5 // Number of valid bits in this bitflag. Keep this updated!
#define PERSIST_DEFAULT PERSIST_SPAWN|PERSIST_ORGANS|PERSIST_MARKINGS|PERSIST_SIZE // 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
sanitize_character() // Don't let new characters start off with nulls
/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>"
. += "<tr><td title=\"Update character scale based on what you were at round end.\">Save Scale: </td>"
. += make_yesno(PERSIST_SIZE)
. += "</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 ..()