Files
Aurora.3/code/modules/client/preference_setup/preference_setup.dm
Lohikar f6dc33a465 Newmap - SMC, Openturf, Arrivals Controller, and Mine Turf Improvements (#1958)
* Replace SSingulo with SScalamity; processing cleanup
- SScalamity now handles blobs as well as singularity-types.
- Processing subtypes have been simplified to not require a stop_processing definition.

* this is probably important

* Remove cascade disabling SSgarbage

* Fixed a bug where dust() did not qdel the target mob

* Misc fixes

* Fix decals surviving break-to-plating

* Subsystem flag tweaks

* Apparently subsystems are new'd before config is.

* Fix paper icons

* Speculative fix for insane lag

* Better machinery stat

* Make organs not use SSoverlay

* Misc bugfixes & tweaks

* Nightmode fixes

* Changelog for SMC

* Port /tg/'s improved MC crash handling

* Add some more SS Recover() procs

* supply_controller -> SScargo

* More New() -> Initialize()

* pAI and robot construction overlays

* Fix cargo unit tests

* Merge the DMM Suite's atom/New() into atoms_init

* Lighting pre-baking

* Lighting initialization logging

* Fix some bad SS init orders

* Fix SSlighting logging; rename Processes to MC

* Speculative fix for insane GC lag

* Prebaked openturf/icon_smooth & fix lighting prebake

* SS init status; SSatoms LATEQDEL

* Fix bug with MC init stat panel

* Fix parallax

* Misc

* Ignore SS_NO_DISPLAY during init

* apparently this is important

* REEEEEE

* Image GC fixes; broadcaster radio-new sanity

* RCON Cleanup

* Move pAI recruiter into subsystem

* Move global solars list into sun subsystem

* Make chickens not use a global

* Demote SSdisposals to SS_BACKGROUND; garbage-debug cleanup

* Speed up space init a little

* Fix bad timer flags on floor drying

* Subsystem panic-restart verb for mins

* Explosion speedup

* Minor subsystem & MC logging tweaks

* SSopenturf improvements

* Make pipenet actually initialize (whoops)

* Minor tweaks

* Implement lighting rounding

* comments are hard okay

* Minor lattice tweaks

* Fix some timer issues & better closet init

* Timer sanity

* Request console tweaks + Storage init sanity

* Minor SSmachiner RCON improvements

* Further reduce world-start timer count

* Standardize subsystem logging

* Garbage hard delete profiling from /tg/

* Timer hang detection & recovery

* Log machines that sleep in process() and fuck up SSmachinery

* Fix an issue with external airlocks sleeping in process()

* Failsafe logging

* Minor tweaks

* Revert "Request console tweaks + Storage init sanity"

This reverts commit 98d3579e35.

* Re-implement RC changes

* Fix SQL FT saving

* Fix SSmachinery sleep in disposals

* Minor SS tweaks

* Paper fixes

* Blood drying fixes

* Merge gameticker and SSticker

* Minor global list init cleanup

* Lagcheck biogenerator & bags

* Tweak SScargo init order; RIG Initialize()

* Caching tweaks

* Remove rogue comma

* Initialize fixes

* Lighting destroy cleanup

* Fix emagging airlocks

* Initial SSicon implementation

* Tweaks & Fixes

* Fire + Air alarm queued icon updates

* Overlays + Queued icon cleanup

* Runtime & background fixes

* Kill some meaningless set statements

* Kill some image qdels

* Bump up lighting rounding val

* Fix adv. scanner destroy runtimes

* Remove unneeded icon update limiting

* Move icon smoothing into helpers

* Show a warning if DM 510 compiles without memory leak hack enabled

* Re-organize subsystems & MC defines a little

* Airlock SFX

* Log of Changes

* Make SSicon_update disable itself when not doing anything

* Fix respawn verb runtime when used early in server-init

* Add more information to MC's stat_entry()

* Replace direct refernces to gcDestroyed with QDEL* macros

* plant_controller -> SSplants

* More plant tweaks

* Add more humor to changelog

* Move parallax globals into SSparallax

* Lighting responsiveness tweaks

* Fix parallax init order & better MC init panel stat

* Make mobs GC

* More overlays + Remove intercom spawn()

* SSfast_process; make pinpointers not use spawn-recursion to process
Also made the SM Cascade beach process with SSprocessing instead of a spawn loop.

* Update changelog

* Mob GC tweaks

* Del() cleanup

* Fix insomniac ZAS connection edges

* Minor pAI cleanup

* Convert more things to SSoverlay; fix duplicated overlay in field gens

* SM Bluespace turf tweaks

* Update SSgarbage debug globals list

* Human-type qdel tweaks

* Subsystem suspension; stat_entry improvements

* SQL Statistics cleanup

* Fix runtimes with ambrosia

* More disable() -> suspend(); fix nightmode again

* Human qdel fix; minor tweaks

* Update turbolift to work with StonedMC

* Make lifts use timers instead of a subsystem

* Make SSassets start earlier

* Convert the radio controller into a subsystem

* Fix some missing CHECK_TICKs in asteroid generation

* MC stat tweaks; make shouldnt_see a typecache

* Kill some redundant debug-controller entries

* radio_controller -> SSradio

* Better SSgarbage hard-del logging from /tg/ upstream

* Logging tweaks + GELF

* Misc client caching improvements

* Slime SSoverlay

* Oven icon fixes

* Implant fixes
- Death implants will no longer spam Common on death of user.
- Death implants should handle a deleted user better.

* Holder tweaks + Welding tool Initialize()

* Fix some bad subsystem logging

* Fix suit cooling units spawning without cells

* Starlight tweaks

* Gibber infinite gib fix

* More SSoverlay stuff

* Make crates use CUT_OVERLAY_IN

* Make SSarrivals suspend instead of disable

* Make openturf use split/phased tick checks

* Speculative fix for unwet timer runtimes

* Blood overlay tweaks/fixes

* Update crusher to play nice with SMC + SSoverlay

* Openturf improvements and fixes

* Minor turbolift tweaks

* Lighting performance improvements + ChangeTurf tweaks

* this is probably important

* Fix wall weld noises on changeturf

* More ChangeTurf tweaks

* Explosion tweaks

* Pre-game lobby tweaks

* Openturf tweaks

* Prevent admins from starting the game before init finishes

* Fix Travis

* Kill an unused var

* Fix ChangeTurf runtimes on openturfs

* Fixes

* Browser datum fixes, asset caching

* Update changelog

* Changelog

* Lobby tweaks

* Ticker tweaks; kill ticker var

* Further lobby tweaks

* Cascade tweaks

* air_master -> SSair

* Reduce overhead from radio autosay

* alarm_manager -> SSalarm

* bomb_processor -> SSexplosives

* corp_regs -> SSlaw

* ZAS overlay fixes

* Small wall icon optimization

* Fix effects master

* Assembly tweaks

* Megavend fixes

* Shuttle fixes

* Camera alert performance improvements

* Fix some world.log spam from lighting overlays

* Fix some Initialize() procs

* Openspace responsiveness tweaks

* Make HE pipes animate through openturfs

* Kill a spawn
2017-05-02 14:40:40 -04:00

306 lines
9.9 KiB
Plaintext

// These are not flags, binary operations not intended
#define TOPIC_NOACTION 0
#define TOPIC_HANDLED 1
#define TOPIC_REFRESH 2
// These are bitflags. Use wisely.
#define SQL_CHARACTER 0x1
#define SQL_PREFERENCES 0x2
/datum/category_group/player_setup_category/general_preferences
name = "General"
sort_order = 1
category_item_type = /datum/category_item/player_setup_item/general
/datum/category_group/player_setup_category/skill_preferences
name = "Skills"
sort_order = 2
category_item_type = /datum/category_item/player_setup_item/skills
/datum/category_group/player_setup_category/occupation_preferences
name = "Occupation"
sort_order = 3
category_item_type = /datum/category_item/player_setup_item/occupation
/datum/category_group/player_setup_category/appearance_preferences
name = "Roles"
sort_order = 4
category_item_type = /datum/category_item/player_setup_item/antagonism
/datum/category_group/player_setup_category/loadout_preferences
name = "Loadout"
sort_order = 5
category_item_type = /datum/category_item/player_setup_item/loadout
/datum/category_group/player_setup_category/global_preferences
name = "Global"
sort_order = 5
category_item_type = /datum/category_item/player_setup_item/player_global
sql_role = SQL_PREFERENCES
/datum/category_group/player_setup_category/other_preferences
name = "Other"
sort_order = 6
category_item_type = /datum/category_item/player_setup_item/other
/****************************
* Category Collection Setup *
****************************/
/datum/category_collection/player_setup_collection
category_group_type = /datum/category_group/player_setup_category
var/datum/preferences/preferences
var/datum/category_group/player_setup_category/selected_category = null
/datum/category_collection/player_setup_collection/New(var/datum/preferences/preferences)
src.preferences = preferences
..()
selected_category = categories[1]
/datum/category_collection/player_setup_collection/Destroy()
preferences = null
selected_category = null
return ..()
/datum/category_collection/player_setup_collection/proc/sanitize_setup()
for(var/datum/category_group/player_setup_category/PS in categories)
PS.sanitize_setup()
/datum/category_collection/player_setup_collection/proc/load_character(var/savefile/S)
for(var/datum/category_group/player_setup_category/PS in categories)
PS.load_character(S)
/datum/category_collection/player_setup_collection/proc/save_character(var/savefile/S)
for(var/datum/category_group/player_setup_category/PS in categories)
PS.save_character(S)
/datum/category_collection/player_setup_collection/proc/load_preferences(var/savefile/S)
for(var/datum/category_group/player_setup_category/PS in categories)
PS.load_preferences(S)
/datum/category_collection/player_setup_collection/proc/save_preferences(var/savefile/S)
for(var/datum/category_group/player_setup_category/PS in categories)
PS.save_preferences(S)
/datum/category_collection/player_setup_collection/proc/update_setup(var/savefile/preferences, var/savefile/character)
for(var/datum/category_group/player_setup_category/PS in categories)
. = . || PS.update_setup(preferences, character)
/datum/category_collection/player_setup_collection/proc/header()
var/dat = ""
for(var/datum/category_group/player_setup_category/PS in categories)
if(PS == selected_category)
dat += "[PS.name] " // TODO: Check how to properly mark a href/button selected in a classic browser window
else
dat += "<a href='?src=\ref[src];category=\ref[PS]'>[PS.name]</a> "
return dat
/datum/category_collection/player_setup_collection/proc/content(var/mob/user)
if(selected_category)
return selected_category.content(user)
/datum/category_collection/player_setup_collection/Topic(var/href,var/list/href_list)
if(..())
return 1
var/mob/user = usr
if(!user.client)
return 1
if(href_list["category"])
var/category = locate(href_list["category"])
if(category && category in categories)
selected_category = category
. = 1
if(.)
user.client.prefs.ShowChoices(user)
/**************************
* Category Category Setup *
**************************/
/datum/category_group/player_setup_category
var/sort_order = 0
var/sql_role = SQL_CHARACTER
var/modified = 0
/datum/category_group/player_setup_category/proc/sanitize_setup()
for(var/datum/category_item/player_setup_item/PI in items)
PI.sanitize_preferences()
for(var/datum/category_item/player_setup_item/PI in items)
PI.sanitize_character()
/datum/category_group/player_setup_category/proc/load_character(var/savefile/S)
// Load all data, then sanitize it.
// Need due to, for example, the 01_basic module relying on species having been loaded to sanitize correctly but that isn't loaded until module 03_body.
if (!config.sql_saves || !establish_db_connection(dbcon))
for(var/datum/category_item/player_setup_item/PI in items)
PI.load_character(S)
else
// Load every category minus the global
handle_sql_loading(SQL_CHARACTER)
for(var/datum/category_item/player_setup_item/PI in items)
PI.load_special(S)
PI.sanitize_character(config.sql_saves)
/datum/category_group/player_setup_category/proc/save_character(var/savefile/S)
// Sanitize all data, then save it
for (var/datum/category_item/player_setup_item/PI in items)
PI.sanitize_character()
if (!config.sql_saves || !establish_db_connection(dbcon))
for (var/datum/category_item/player_setup_item/PI in items)
PI.save_character(S)
else
if (modified)
// No save here, because this is only called from the menu and needs to save /everything/.
handle_sql_saving(SQL_CHARACTER)
modified = 0
/datum/category_group/player_setup_category/proc/load_preferences(var/savefile/S)
if (!config.sql_saves || !establish_db_connection(dbcon))
for (var/datum/category_item/player_setup_item/PI in items)
PI.load_preferences(S)
else
handle_sql_loading(SQL_PREFERENCES)
for (var/datum/category_item/player_setup_item/PI in items)
PI.sanitize_preferences(config.sql_saves)
/datum/category_group/player_setup_category/proc/save_preferences(var/savefile/S)
for (var/datum/category_item/player_setup_item/PI in items)
PI.sanitize_preferences()
if (!config.sql_saves || !establish_db_connection(dbcon))
for (var/datum/category_item/player_setup_item/PI in items)
PI.save_preferences(S)
else
handle_sql_saving(SQL_PREFERENCES)
/datum/category_group/player_setup_category/proc/update_setup(var/savefile/preferences, var/savefile/character)
for(var/datum/category_item/player_setup_item/PI in items)
. = . || PI.update_setup(preferences, character)
/datum/category_group/player_setup_category/proc/content(var/mob/user)
. = "<table style='width:100%'><tr style='vertical-align:top'><td style='width:50%'>"
var/current = 0
var/halfway = items.len / 2
for(var/datum/category_item/player_setup_item/PI in items)
if(halfway && current++ >= halfway)
halfway = 0
. += "</td><td></td><td style='width:50%'>"
. += "[PI.content(user)]<br>"
. += "</td></tr></table>"
/datum/category_group/player_setup_category/occupation_preferences/content(var/mob/user)
for(var/datum/category_item/player_setup_item/PI in items)
. += "[PI.content(user)]<br>"
/**********************
* Category Item Setup *
**********************/
/datum/category_item/player_setup_item
var/sort_order = 0
var/datum/preferences/pref
/datum/category_item/player_setup_item/New()
..()
var/datum/category_collection/player_setup_collection/psc = category.collection
pref = psc.preferences
/datum/category_item/player_setup_item/Destroy()
pref = null
return ..()
/*
* Called when the item is asked to load per character settings - Only called when sql saves are disabled or unavailable
*/
/datum/category_item/player_setup_item/proc/load_character(var/savefile/S)
return
/*
* Called no matter if sql safes are enabled or disabled
*/
/datum/category_item/player_setup_item/proc/load_special(var/savefile/S)
return
/*
* Called when the item is asked to save per character settings
*/
/datum/category_item/player_setup_item/proc/save_character(var/savefile/S)
return
/*
* Called when the item is asked to load user/global settings
*/
/datum/category_item/player_setup_item/proc/load_preferences(var/savefile/S)
return
/*
* Called when the item is asked to save user/global settings
*/
/datum/category_item/player_setup_item/proc/save_preferences(var/savefile/S)
return
/*
* Called when the item is asked to update user/global settings
*/
/datum/category_item/player_setup_item/proc/update_setup(var/savefile/preferences, var/savefile/character)
return 0
/*
* Called when the owner category is composing its load query
*/
/datum/category_item/player_setup_item/proc/gather_load_query()
return list()
/*
* Called when the owner category is composing its insert query
*/
/datum/category_item/player_setup_item/proc/gather_save_query()
return list()
/*
* Called when the owner category is composing its query parameters for loading.
*/
/datum/category_item/player_setup_item/proc/gather_load_parameters()
return list()
/*
* Called when the owner category is composing its query parameters for inserting a new record.
*/
/datum/category_item/player_setup_item/proc/gather_save_parameters()
return list()
/datum/category_item/player_setup_item/proc/content()
return
/datum/category_item/player_setup_item/proc/sanitize_character(var/sql_load = 0)
return
/datum/category_item/player_setup_item/proc/sanitize_preferences(var/sql_load = 0)
return
/datum/category_item/player_setup_item/Topic(var/href,var/list/href_list)
if(..())
return 1
var/mob/user = usr
if (!user.client)
return 1
. = OnTopic(href, href_list, user)
if (. != TOPIC_NOACTION)
var/datum/category_group/player_setup_category/cat = category
cat.modified = 1
if (. == TOPIC_REFRESH)
user.client.prefs.ShowChoices(user)
/datum/category_item/player_setup_item/CanUseTopic(var/mob/user)
return 1
/datum/category_item/player_setup_item/proc/OnTopic(var/href,var/list/href_list, var/mob/user)
return TOPIC_NOACTION
/datum/category_item/player_setup_item/proc/preference_mob()
if(pref && pref.client && pref.client.mob)
return pref.client.mob