mirror of
https://github.com/Aurorastation/Aurora-Old.git
synced 2026-07-18 19:22:39 +01:00
Initial Commit
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
/client
|
||||
////////////////
|
||||
//ADMIN THINGS//
|
||||
////////////////
|
||||
var/datum/admins/holder = null
|
||||
var/buildmode = 0
|
||||
|
||||
var/last_message = "" //Contains the last message sent by this client - used to protect against copy-paste spamming.
|
||||
var/last_message_count = 0 //contins a number of how many times a message identical to last_message was sent.
|
||||
|
||||
/////////
|
||||
//OTHER//
|
||||
/////////
|
||||
var/datum/preferences/prefs = null
|
||||
var/move_delay = 1
|
||||
var/moving = null
|
||||
var/adminobs = null
|
||||
var/area = null
|
||||
var/time_died_as_mouse = null //when the client last died as a mouse
|
||||
|
||||
|
||||
///////////////
|
||||
//SOUND STUFF//
|
||||
///////////////
|
||||
var/ambience_playing= null
|
||||
var/played = 0
|
||||
|
||||
////////////
|
||||
//SECURITY//
|
||||
////////////
|
||||
var/next_allowed_topic_time = 10
|
||||
// comment out the line below when debugging locally to enable the options & messages menu
|
||||
//control_freak = 1
|
||||
|
||||
|
||||
////////////////////////////////////
|
||||
//things that require the database//
|
||||
////////////////////////////////////
|
||||
var/player_age = "Requires database" //So admins know why it isn't working - Used to determine how old the account is - in days.
|
||||
var/related_accounts_ip = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this ip
|
||||
var/related_accounts_cid = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this computer id
|
||||
|
||||
preload_rsc = 0 // This is 0 so we can set it to an URL once the player logs in and have them download the resources from a different server.
|
||||
@@ -0,0 +1,309 @@
|
||||
////////////
|
||||
//SECURITY//
|
||||
////////////
|
||||
#define TOPIC_SPAM_DELAY 2 //2 ticks is about 2/10ths of a second; it was 4 ticks, but that caused too many clicks to be lost due to lag
|
||||
#define UPLOAD_LIMIT 10485760 //Restricts client uploads to the server to 10MB //Boosted this thing. What's the worst that can happen?
|
||||
#define MIN_CLIENT_VERSION 0 //Just an ambiguously low version for now, I don't want to suddenly stop people playing.
|
||||
//I would just like the code ready should it ever need to be used.
|
||||
/*
|
||||
When somebody clicks a link in game, this Topic is called first.
|
||||
It does the stuff in this proc and then is redirected to the Topic() proc for the src=[0xWhatever]
|
||||
(if specified in the link). ie locate(hsrc).Topic()
|
||||
|
||||
Such links can be spoofed.
|
||||
|
||||
Because of this certain things MUST be considered whenever adding a Topic() for something:
|
||||
- Can it be fed harmful values which could cause runtimes?
|
||||
- Is the Topic call an admin-only thing?
|
||||
- If so, does it have checks to see if the person who called it (usr.client) is an admin?
|
||||
- Are the processes being called by Topic() particularly laggy?
|
||||
- If so, is there any protection against somebody spam-clicking a link?
|
||||
If you have any questions about this stuff feel free to ask. ~Carn
|
||||
*/
|
||||
/client/Topic(href, href_list, hsrc)
|
||||
if(!usr || usr != mob) //stops us calling Topic for somebody else's client. Also helps prevent usr=null
|
||||
return
|
||||
|
||||
//Reduces spamming of links by dropping calls that happen during the delay period
|
||||
if(next_allowed_topic_time > world.time)
|
||||
return
|
||||
next_allowed_topic_time = world.time + TOPIC_SPAM_DELAY
|
||||
|
||||
//search the href for script injection
|
||||
if( findtext(href,"<script",1,0) )
|
||||
world.log << "Attempted use of scripts within a topic call, by [src]"
|
||||
message_admins("Attempted use of scripts within a topic call, by [src]")
|
||||
//del(usr)
|
||||
return
|
||||
|
||||
//Admin PM
|
||||
if(href_list["priv_msg"])
|
||||
var/client/C = locate(href_list["priv_msg"])
|
||||
if(ismob(C)) //Old stuff can feed-in mobs instead of clients
|
||||
var/mob/M = C
|
||||
C = M.client
|
||||
cmd_admin_pm(C,null)
|
||||
return
|
||||
|
||||
//Logs all hrefs
|
||||
if(config && config.log_hrefs && href_logfile)
|
||||
href_logfile << "<small>[time2text(world.timeofday,"hh:mm")] [src] (usr:[usr])</small> || [hsrc ? "[hsrc] " : ""][href]<br>"
|
||||
|
||||
switch(href_list["_src_"])
|
||||
if("holder") hsrc = holder
|
||||
if("usr") hsrc = mob
|
||||
if("prefs") return prefs.process_link(usr,href_list)
|
||||
if("vars") return view_var_Topic(href,href_list,hsrc)
|
||||
|
||||
..() //redirect to hsrc.Topic()
|
||||
|
||||
/client/proc/handle_spam_prevention(var/message, var/mute_type)
|
||||
if(config.automute_on && !holder && src.last_message == message)
|
||||
src.last_message_count++
|
||||
if(src.last_message_count >= SPAM_TRIGGER_AUTOMUTE)
|
||||
src << "\red You have exceeded the spam filter limit for identical messages. An auto-mute was applied."
|
||||
cmd_admin_mute(src.mob, mute_type, 1)
|
||||
return 1
|
||||
if(src.last_message_count >= SPAM_TRIGGER_WARNING)
|
||||
src << "\red You are nearing the spam filter limit for identical messages."
|
||||
return 0
|
||||
else
|
||||
last_message = message
|
||||
src.last_message_count = 0
|
||||
return 0
|
||||
|
||||
//This stops files larger than UPLOAD_LIMIT being sent from client to server via input(), client.Import() etc.
|
||||
/client/AllowUpload(filename, filelength)
|
||||
if(filelength > UPLOAD_LIMIT)
|
||||
src << "<font color='red'>Error: AllowUpload(): File Upload too large. Upload Limit: [UPLOAD_LIMIT/1024]KiB.</font>"
|
||||
return 0
|
||||
/* //Don't need this at the moment. But it's here if it's needed later.
|
||||
//Helps prevent multiple files being uploaded at once. Or right after eachother.
|
||||
var/time_to_wait = fileaccess_timer - world.time
|
||||
if(time_to_wait > 0)
|
||||
src << "<font color='red'>Error: AllowUpload(): Spam prevention. Please wait [round(time_to_wait/10)] seconds.</font>"
|
||||
return 0
|
||||
fileaccess_timer = world.time + FTPDELAY */
|
||||
return 1
|
||||
|
||||
|
||||
///////////
|
||||
//CONNECT//
|
||||
///////////
|
||||
/client/New(TopicData)
|
||||
TopicData = null //Prevent calls to client.Topic from connect
|
||||
|
||||
if(connection != "seeker") //Invalid connection type.
|
||||
return null
|
||||
if(byond_version < MIN_CLIENT_VERSION) //Out of date client.
|
||||
return null
|
||||
|
||||
if(IsGuestKey(key))
|
||||
alert(src,"This server doesn't allow guest accounts to play. Please go to http://www.byond.com/ and register for a key.","Guest","OK")
|
||||
del(src)
|
||||
return
|
||||
|
||||
// Change the way they should download resources.
|
||||
if(config.resource_urls)
|
||||
src.preload_rsc = pick(config.resource_urls)
|
||||
else src.preload_rsc = 1 // If config.resource_urls is not set, preload like normal.
|
||||
|
||||
src << "\red If the title screen is black, resources are still downloading. Please be patient until the title screen appears."
|
||||
|
||||
|
||||
clients += src
|
||||
directory[ckey] = src
|
||||
|
||||
//Admin Authorisation
|
||||
holder = admin_datums[ckey]
|
||||
if(holder)
|
||||
admins += src
|
||||
holder.owner = src
|
||||
|
||||
//preferences datum - also holds some persistant data for the client (because we may as well keep these datums to a minimum)
|
||||
prefs = preferences_datums[ckey]
|
||||
if(!prefs)
|
||||
prefs = new /datum/preferences(src)
|
||||
preferences_datums[ckey] = prefs
|
||||
prefs.last_ip = address //these are gonna be used for banning
|
||||
prefs.last_id = computer_id //these are gonna be used for banning
|
||||
|
||||
. = ..() //calls mob.Login()
|
||||
|
||||
if(custom_event_msg && custom_event_msg != "")
|
||||
src << "<h1 class='alert'>Custom Event</h1>"
|
||||
src << "<h2 class='alert'>A custom event is taking place. OOC Info:</h2>"
|
||||
src << "<span class='alert'>[html_encode(custom_event_msg)]</span>"
|
||||
src << "<br>"
|
||||
|
||||
if( (world.address == address || !address) && !host )
|
||||
host = key
|
||||
world.update_status()
|
||||
|
||||
if(holder)
|
||||
add_admin_verbs()
|
||||
admin_memo_show()
|
||||
|
||||
log_client_to_db()
|
||||
|
||||
send_resources()
|
||||
|
||||
if(prefs.lastchangelog != changelog_hash) //bolds the changelog button on the interface so we know there are updates.
|
||||
winset(src, "rpane.changelog", "background-color=#eaeaea;font-style=bold")
|
||||
|
||||
|
||||
//////////////
|
||||
//DISCONNECT//
|
||||
//////////////
|
||||
/client/Del()
|
||||
if(holder)
|
||||
holder.owner = null
|
||||
admins -= src
|
||||
directory -= ckey
|
||||
clients -= src
|
||||
return ..()
|
||||
|
||||
|
||||
|
||||
/client/proc/log_client_to_db()
|
||||
|
||||
if ( IsGuestKey(src.key) )
|
||||
return
|
||||
|
||||
establish_db_connection()
|
||||
if(!dbcon.IsConnected())
|
||||
return
|
||||
|
||||
var/sql_ckey = sql_sanitize_text(src.ckey)
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id, datediff(Now(),firstseen) as age FROM erro_player WHERE ckey = '[sql_ckey]'")
|
||||
query.Execute()
|
||||
var/sql_id = 0
|
||||
while(query.NextRow())
|
||||
sql_id = query.item[1]
|
||||
player_age = text2num(query.item[2])
|
||||
break
|
||||
|
||||
var/DBQuery/query_ip = dbcon.NewQuery("SELECT ckey FROM erro_player WHERE ip = '[address]'")
|
||||
query_ip.Execute()
|
||||
related_accounts_ip = ""
|
||||
while(query_ip.NextRow())
|
||||
related_accounts_ip += "[query_ip.item[1]], "
|
||||
break
|
||||
|
||||
var/DBQuery/query_cid = dbcon.NewQuery("SELECT ckey FROM erro_player WHERE computerid = '[computer_id]'")
|
||||
query_cid.Execute()
|
||||
related_accounts_cid = ""
|
||||
while(query_cid.NextRow())
|
||||
related_accounts_cid += "[query_cid.item[1]], "
|
||||
break
|
||||
|
||||
//Just the standard check to see if it's actually a number
|
||||
if(sql_id)
|
||||
if(istext(sql_id))
|
||||
sql_id = text2num(sql_id)
|
||||
if(!isnum(sql_id))
|
||||
return
|
||||
|
||||
var/admin_rank = "Player"
|
||||
if(src.holder)
|
||||
admin_rank = src.holder.rank
|
||||
|
||||
var/sql_ip = sql_sanitize_text(src.address)
|
||||
var/sql_computerid = sql_sanitize_text(src.computer_id)
|
||||
var/sql_admin_rank = sql_sanitize_text(admin_rank)
|
||||
|
||||
|
||||
if(sql_id)
|
||||
//Player already identified previously, we need to just update the 'lastseen', 'ip' and 'computer_id' variables
|
||||
var/DBQuery/query_update = dbcon.NewQuery("UPDATE erro_player SET lastseen = Now(), ip = '[sql_ip]', computerid = '[sql_computerid]', lastadminrank = '[sql_admin_rank]' WHERE id = [sql_id]")
|
||||
query_update.Execute()
|
||||
else
|
||||
//New player!! Need to insert all the stuff
|
||||
var/DBQuery/query_insert = dbcon.NewQuery("INSERT INTO erro_player (id, ckey, firstseen, lastseen, ip, computerid, lastadminrank) VALUES (null, '[sql_ckey]', Now(), Now(), '[sql_ip]', '[sql_computerid]', '[sql_admin_rank]')")
|
||||
query_insert.Execute()
|
||||
|
||||
//Logging player access
|
||||
var/serverip = "[world.internet_address]:[world.port]"
|
||||
var/DBQuery/query_accesslog = dbcon.NewQuery("INSERT INTO `erro_connection_log`(`id`,`datetime`,`serverip`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),'[serverip]','[sql_ckey]','[sql_ip]','[sql_computerid]');")
|
||||
query_accesslog.Execute()
|
||||
|
||||
|
||||
#undef TOPIC_SPAM_DELAY
|
||||
#undef UPLOAD_LIMIT
|
||||
#undef MIN_CLIENT_VERSION
|
||||
|
||||
//checks if a client is afk
|
||||
//3000 frames = 5 minutes
|
||||
/client/proc/is_afk(duration=3000)
|
||||
if(inactivity > duration) return inactivity
|
||||
return 0
|
||||
|
||||
//send resources to the client. It's here in its own proc so we can move it around easiliy if need be
|
||||
/client/proc/send_resources()
|
||||
// preload_vox() //Causes long delays with initial start window and subsequent windows when first logged in.
|
||||
getFiles(
|
||||
'nano/js/libraries.min.js',
|
||||
'nano/js/nano_update.js',
|
||||
'nano/js/nano_config.js',
|
||||
'nano/js/nano_base_helpers.js',
|
||||
'nano/css/shared.css',
|
||||
'nano/css/icons.css',
|
||||
'nano/templates/chem_dispenser.tmpl',
|
||||
'nano/templates/cryo.tmpl',
|
||||
'nano/templates/geoscanner.tmpl',
|
||||
'nano/templates/dna_modifier.tmpl',
|
||||
'nano/templates/telescience_console.tmpl',
|
||||
'nano/templates/pda.tmpl',
|
||||
'nano/templates/smes.tmpl',
|
||||
'nano/templates/uplink.tmpl',
|
||||
'nano/images/uiBackground.png',
|
||||
'nano/images/uiIcons16.png',
|
||||
'nano/images/uiIcons24.png',
|
||||
'nano/images/uiBackground-Syndicate.png',
|
||||
'nano/images/uiLinkPendingIcon.gif',
|
||||
'nano/images/uiMaskBackground.png',
|
||||
'nano/images/uiNoticeBackground.jpg',
|
||||
'nano/images/uiTitleFluff.png',
|
||||
'nano/images/uiTitleFluff-Syndicate.png',
|
||||
'html/search.js',
|
||||
'html/panels.css',
|
||||
'icons/pda_icons/pda_atmos.png',
|
||||
'icons/pda_icons/pda_back.png',
|
||||
'icons/pda_icons/pda_bell.png',
|
||||
'icons/pda_icons/pda_blank.png',
|
||||
'icons/pda_icons/pda_boom.png',
|
||||
'icons/pda_icons/pda_bucket.png',
|
||||
'icons/pda_icons/pda_crate.png',
|
||||
'icons/pda_icons/pda_cuffs.png',
|
||||
'icons/pda_icons/pda_eject.png',
|
||||
'icons/pda_icons/pda_exit.png',
|
||||
'icons/pda_icons/pda_flashlight.png',
|
||||
'icons/pda_icons/pda_honk.png',
|
||||
'icons/pda_icons/pda_mail.png',
|
||||
'icons/pda_icons/pda_medical.png',
|
||||
'icons/pda_icons/pda_menu.png',
|
||||
'icons/pda_icons/pda_mule.png',
|
||||
'icons/pda_icons/pda_notes.png',
|
||||
'icons/pda_icons/pda_power.png',
|
||||
'icons/pda_icons/pda_rdoor.png',
|
||||
'icons/pda_icons/pda_reagent.png',
|
||||
'icons/pda_icons/pda_refresh.png',
|
||||
'icons/pda_icons/pda_scanner.png',
|
||||
'icons/pda_icons/pda_signaler.png',
|
||||
'icons/pda_icons/pda_status.png',
|
||||
'icons/spideros_icons/sos_1.png',
|
||||
'icons/spideros_icons/sos_2.png',
|
||||
'icons/spideros_icons/sos_3.png',
|
||||
'icons/spideros_icons/sos_4.png',
|
||||
'icons/spideros_icons/sos_5.png',
|
||||
'icons/spideros_icons/sos_6.png',
|
||||
'icons/spideros_icons/sos_7.png',
|
||||
'icons/spideros_icons/sos_8.png',
|
||||
'icons/spideros_icons/sos_9.png',
|
||||
'icons/spideros_icons/sos_10.png',
|
||||
'icons/spideros_icons/sos_11.png',
|
||||
'icons/spideros_icons/sos_12.png',
|
||||
'icons/spideros_icons/sos_13.png',
|
||||
'icons/spideros_icons/sos_14.png'
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,267 @@
|
||||
#define SAVEFILE_VERSION_MIN 8
|
||||
#define SAVEFILE_VERSION_MAX 11
|
||||
|
||||
//handles converting savefiles to new formats
|
||||
//MAKE SURE YOU KEEP THIS UP TO DATE!
|
||||
//If the sanity checks are capable of handling any issues. Only increase SAVEFILE_VERSION_MAX,
|
||||
//this will mean that savefile_version will still be over SAVEFILE_VERSION_MIN, meaning
|
||||
//this savefile update doesn't run everytime we load from the savefile.
|
||||
//This is mainly for format changes, such as the bitflags in toggles changing order or something.
|
||||
//if a file can't be updated, return 0 to delete it and start again
|
||||
//if a file was updated, return 1
|
||||
/datum/preferences/proc/savefile_update()
|
||||
if(savefile_version < 8) //lazily delete everything + additional files so they can be saved in the new format
|
||||
for(var/ckey in preferences_datums)
|
||||
var/datum/preferences/D = preferences_datums[ckey]
|
||||
if(D == src)
|
||||
var/delpath = "data/player_saves/[copytext(ckey,1,2)]/[ckey]/"
|
||||
if(delpath && fexists(delpath))
|
||||
fdel(delpath)
|
||||
break
|
||||
return 0
|
||||
|
||||
if(savefile_version == SAVEFILE_VERSION_MAX) //update successful.
|
||||
save_preferences()
|
||||
save_character()
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/preferences/proc/load_path(ckey,filename="preferences.sav")
|
||||
if(!ckey) return
|
||||
path = "data/player_saves/[copytext(ckey,1,2)]/[ckey]/[filename]"
|
||||
savefile_version = SAVEFILE_VERSION_MAX
|
||||
|
||||
/datum/preferences/proc/load_preferences()
|
||||
if(!path) return 0
|
||||
if(!fexists(path)) return 0
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(!S) return 0
|
||||
S.cd = "/"
|
||||
|
||||
S["version"] >> savefile_version
|
||||
//Conversion
|
||||
if(!savefile_version || !isnum(savefile_version) || savefile_version < SAVEFILE_VERSION_MIN || savefile_version > SAVEFILE_VERSION_MAX)
|
||||
if(!savefile_update()) //handles updates
|
||||
savefile_version = SAVEFILE_VERSION_MAX
|
||||
save_preferences()
|
||||
save_character()
|
||||
return 0
|
||||
|
||||
//general preferences
|
||||
S["ooccolor"] >> ooccolor
|
||||
S["lastchangelog"] >> lastchangelog
|
||||
S["UI_style"] >> UI_style
|
||||
S["be_special"] >> be_special
|
||||
S["default_slot"] >> default_slot
|
||||
S["toggles"] >> toggles
|
||||
S["UI_style_color"] >> UI_style_color
|
||||
S["UI_style_alpha"] >> UI_style_alpha
|
||||
|
||||
//Sanitize
|
||||
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
|
||||
lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog))
|
||||
UI_style = sanitize_inlist(UI_style, list("White", "Midnight","Orange","old"), initial(UI_style))
|
||||
be_special = sanitize_integer(be_special, 0, 65535, initial(be_special))
|
||||
default_slot = sanitize_integer(default_slot, 1, MAX_SAVE_SLOTS, initial(default_slot))
|
||||
toggles = sanitize_integer(toggles, 0, 65535, initial(toggles))
|
||||
UI_style_color = sanitize_hexcolor(UI_style_color, initial(UI_style_color))
|
||||
UI_style_alpha = sanitize_integer(UI_style_alpha, 0, 255, initial(UI_style_alpha))
|
||||
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/save_preferences()
|
||||
if(!path) return 0
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(!S) return 0
|
||||
S.cd = "/"
|
||||
|
||||
S["version"] << savefile_version
|
||||
|
||||
//general preferences
|
||||
S["ooccolor"] << ooccolor
|
||||
S["lastchangelog"] << lastchangelog
|
||||
S["UI_style"] << UI_style
|
||||
S["be_special"] << be_special
|
||||
S["default_slot"] << default_slot
|
||||
S["toggles"] << toggles
|
||||
S["UI_style_color"] << UI_style_color
|
||||
S["UI_style_alpha"] << UI_style_alpha
|
||||
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/load_character(slot)
|
||||
if(!path) return 0
|
||||
if(!fexists(path)) return 0
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(!S) return 0
|
||||
S.cd = "/"
|
||||
if(!slot) slot = default_slot
|
||||
slot = sanitize_integer(slot, 1, MAX_SAVE_SLOTS, initial(default_slot))
|
||||
if(slot != default_slot)
|
||||
default_slot = slot
|
||||
S["default_slot"] << slot
|
||||
S.cd = "/character[slot]"
|
||||
|
||||
//Character
|
||||
S["OOC_Notes"] >> metadata
|
||||
S["real_name"] >> real_name
|
||||
S["name_is_always_random"] >> be_random_name
|
||||
S["gender"] >> gender
|
||||
S["age"] >> age
|
||||
S["species"] >> species
|
||||
S["language"] >> language
|
||||
|
||||
//colors to be consolidated into hex strings (requires some work with dna code)
|
||||
S["hair_red"] >> r_hair
|
||||
S["hair_green"] >> g_hair
|
||||
S["hair_blue"] >> b_hair
|
||||
S["facial_red"] >> r_facial
|
||||
S["facial_green"] >> g_facial
|
||||
S["facial_blue"] >> b_facial
|
||||
S["skin_tone"] >> s_tone
|
||||
S["hair_style_name"] >> h_style
|
||||
S["facial_style_name"] >> f_style
|
||||
S["eyes_red"] >> r_eyes
|
||||
S["eyes_green"] >> g_eyes
|
||||
S["eyes_blue"] >> b_eyes
|
||||
S["underwear"] >> underwear
|
||||
S["backbag"] >> backbag
|
||||
S["b_type"] >> b_type
|
||||
|
||||
//Jobs
|
||||
S["alternate_option"] >> alternate_option
|
||||
S["job_civilian_high"] >> job_civilian_high
|
||||
S["job_civilian_med"] >> job_civilian_med
|
||||
S["job_civilian_low"] >> job_civilian_low
|
||||
S["job_medsci_high"] >> job_medsci_high
|
||||
S["job_medsci_med"] >> job_medsci_med
|
||||
S["job_medsci_low"] >> job_medsci_low
|
||||
S["job_engsec_high"] >> job_engsec_high
|
||||
S["job_engsec_med"] >> job_engsec_med
|
||||
S["job_engsec_low"] >> job_engsec_low
|
||||
|
||||
//Miscellaneous
|
||||
S["flavor_text"] >> flavor_text
|
||||
S["med_record"] >> med_record
|
||||
S["sec_record"] >> sec_record
|
||||
S["gen_record"] >> gen_record
|
||||
S["be_special"] >> be_special
|
||||
S["disabilities"] >> disabilities
|
||||
S["player_alt_titles"] >> player_alt_titles
|
||||
S["used_skillpoints"] >> used_skillpoints
|
||||
S["skills"] >> skills
|
||||
S["skill_specialization"] >> skill_specialization
|
||||
S["organ_data"] >> organ_data
|
||||
|
||||
S["nanotrasen_relation"] >> nanotrasen_relation
|
||||
//S["skin_style"] >> skin_style
|
||||
|
||||
//Sanitize
|
||||
metadata = sanitize_text(metadata, initial(metadata))
|
||||
real_name = reject_bad_name(real_name)
|
||||
if(isnull(species)) species = "Human"
|
||||
if(isnull(language)) language = "None"
|
||||
if(isnull(nanotrasen_relation)) nanotrasen_relation = initial(nanotrasen_relation)
|
||||
if(!real_name) real_name = random_name(gender)
|
||||
be_random_name = sanitize_integer(be_random_name, 0, 1, initial(be_random_name))
|
||||
gender = sanitize_gender(gender)
|
||||
age = sanitize_integer(age, AGE_MIN, AGE_MAX, initial(age))
|
||||
r_hair = sanitize_integer(r_hair, 0, 255, initial(r_hair))
|
||||
g_hair = sanitize_integer(g_hair, 0, 255, initial(g_hair))
|
||||
b_hair = sanitize_integer(b_hair, 0, 255, initial(b_hair))
|
||||
r_facial = sanitize_integer(r_facial, 0, 255, initial(r_facial))
|
||||
g_facial = sanitize_integer(g_facial, 0, 255, initial(g_facial))
|
||||
b_facial = sanitize_integer(b_facial, 0, 255, initial(b_facial))
|
||||
s_tone = sanitize_integer(s_tone, -185, 34, initial(s_tone))
|
||||
h_style = sanitize_inlist(h_style, hair_styles_list, initial(h_style))
|
||||
f_style = sanitize_inlist(f_style, facial_hair_styles_list, initial(f_style))
|
||||
r_eyes = sanitize_integer(r_eyes, 0, 255, initial(r_eyes))
|
||||
g_eyes = sanitize_integer(g_eyes, 0, 255, initial(g_eyes))
|
||||
b_eyes = sanitize_integer(b_eyes, 0, 255, initial(b_eyes))
|
||||
underwear = sanitize_integer(underwear, 1, underwear_m.len, initial(underwear))
|
||||
backbag = sanitize_integer(backbag, 1, backbaglist.len, initial(backbag))
|
||||
b_type = sanitize_text(b_type, initial(b_type))
|
||||
|
||||
alternate_option = sanitize_integer(alternate_option, 0, 2, initial(alternate_option))
|
||||
job_civilian_high = sanitize_integer(job_civilian_high, 0, 65535, initial(job_civilian_high))
|
||||
job_civilian_med = sanitize_integer(job_civilian_med, 0, 65535, initial(job_civilian_med))
|
||||
job_civilian_low = sanitize_integer(job_civilian_low, 0, 65535, initial(job_civilian_low))
|
||||
job_medsci_high = sanitize_integer(job_medsci_high, 0, 65535, initial(job_medsci_high))
|
||||
job_medsci_med = sanitize_integer(job_medsci_med, 0, 65535, initial(job_medsci_med))
|
||||
job_medsci_low = sanitize_integer(job_medsci_low, 0, 65535, initial(job_medsci_low))
|
||||
job_engsec_high = sanitize_integer(job_engsec_high, 0, 65535, initial(job_engsec_high))
|
||||
job_engsec_med = sanitize_integer(job_engsec_med, 0, 65535, initial(job_engsec_med))
|
||||
job_engsec_low = sanitize_integer(job_engsec_low, 0, 65535, initial(job_engsec_low))
|
||||
|
||||
if(!skills) skills = list()
|
||||
if(!used_skillpoints) used_skillpoints= 0
|
||||
if(isnull(disabilities)) disabilities = 0
|
||||
if(!player_alt_titles) player_alt_titles = new()
|
||||
if(!organ_data) src.organ_data = list()
|
||||
//if(!skin_style) skin_style = "Default"
|
||||
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/save_character()
|
||||
if(!path) return 0
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(!S) return 0
|
||||
S.cd = "/character[default_slot]"
|
||||
|
||||
//Character
|
||||
S["OOC_Notes"] << metadata
|
||||
S["real_name"] << real_name
|
||||
S["name_is_always_random"] << be_random_name
|
||||
S["gender"] << gender
|
||||
S["age"] << age
|
||||
S["species"] << species
|
||||
S["language"] << language
|
||||
S["hair_red"] << r_hair
|
||||
S["hair_green"] << g_hair
|
||||
S["hair_blue"] << b_hair
|
||||
S["facial_red"] << r_facial
|
||||
S["facial_green"] << g_facial
|
||||
S["facial_blue"] << b_facial
|
||||
S["skin_tone"] << s_tone
|
||||
S["hair_style_name"] << h_style
|
||||
S["facial_style_name"] << f_style
|
||||
S["eyes_red"] << r_eyes
|
||||
S["eyes_green"] << g_eyes
|
||||
S["eyes_blue"] << b_eyes
|
||||
S["underwear"] << underwear
|
||||
S["backbag"] << backbag
|
||||
S["b_type"] << b_type
|
||||
|
||||
//Jobs
|
||||
S["alternate_option"] << alternate_option
|
||||
S["job_civilian_high"] << job_civilian_high
|
||||
S["job_civilian_med"] << job_civilian_med
|
||||
S["job_civilian_low"] << job_civilian_low
|
||||
S["job_medsci_high"] << job_medsci_high
|
||||
S["job_medsci_med"] << job_medsci_med
|
||||
S["job_medsci_low"] << job_medsci_low
|
||||
S["job_engsec_high"] << job_engsec_high
|
||||
S["job_engsec_med"] << job_engsec_med
|
||||
S["job_engsec_low"] << job_engsec_low
|
||||
|
||||
//Miscellaneous
|
||||
S["flavor_text"] << flavor_text
|
||||
S["med_record"] << med_record
|
||||
S["sec_record"] << sec_record
|
||||
S["gen_record"] << gen_record
|
||||
S["player_alt_titles"] << player_alt_titles
|
||||
S["be_special"] << be_special
|
||||
S["disabilities"] << disabilities
|
||||
S["used_skillpoints"] << used_skillpoints
|
||||
S["skills"] << skills
|
||||
S["skill_specialization"] << skill_specialization
|
||||
S["organ_data"] << organ_data
|
||||
|
||||
S["nanotrasen_relation"] << nanotrasen_relation
|
||||
//S["skin_style"] << skin_style
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
#undef SAVEFILE_VERSION_MAX
|
||||
#undef SAVEFILE_VERSION_MIN
|
||||
@@ -0,0 +1,187 @@
|
||||
//toggles
|
||||
/client/verb/toggle_ghost_ears()
|
||||
set name = "Show/Hide GhostEars"
|
||||
set category = "Preferences"
|
||||
set desc = ".Toggle Between seeing all mob speech, and only speech of nearby mobs"
|
||||
prefs.toggles ^= CHAT_GHOSTEARS
|
||||
src << "As a ghost, you will now [(prefs.toggles & CHAT_GHOSTEARS) ? "see all speech in the world" : "only see speech from nearby mobs"]."
|
||||
prefs.save_preferences()
|
||||
feedback_add_details("admin_verb","TGE") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/verb/toggle_ghost_sight()
|
||||
set name = "Show/Hide GhostSight"
|
||||
set category = "Preferences"
|
||||
set desc = ".Toggle Between seeing all mob emotes, and only emotes of nearby mobs"
|
||||
prefs.toggles ^= CHAT_GHOSTSIGHT
|
||||
src << "As a ghost, you will now [(prefs.toggles & CHAT_GHOSTSIGHT) ? "see all emotes in the world" : "only see emotes from nearby mobs"]."
|
||||
prefs.save_preferences()
|
||||
feedback_add_details("admin_verb","TGS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/verb/toggle_ghost_radio()
|
||||
set name = "Enable/Disable GhostRadio"
|
||||
set category = "Preferences"
|
||||
set desc = ".Toggle between hearing all radio chatter, or only from nearby speakers"
|
||||
prefs.toggles ^= CHAT_GHOSTRADIO
|
||||
src << "As a ghost, you will now [(prefs.toggles & CHAT_GHOSTRADIO) ? "hear all radio chat in the world" : "only hear from nearby speakers"]."
|
||||
prefs.save_preferences()
|
||||
feedback_add_details("admin_verb","TGR")
|
||||
|
||||
/client/proc/toggle_hear_radio()
|
||||
set name = "Show/Hide RadioChatter"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggle seeing radiochatter from radios and speakers"
|
||||
if(!holder) return
|
||||
prefs.toggles ^= CHAT_RADIO
|
||||
prefs.save_preferences()
|
||||
usr << "You will [(prefs.toggles & CHAT_RADIO) ? "now" : "no longer"] see radio chatter from radios or speakers"
|
||||
feedback_add_details("admin_verb","THR") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/toggleadminhelpsound()
|
||||
set name = "Hear/Silence Adminhelps"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggle hearing a notification when admin PMs are recieved"
|
||||
if(!holder) return
|
||||
prefs.toggles ^= SOUND_ADMINHELP
|
||||
prefs.save_preferences()
|
||||
usr << "You will [(prefs.toggles & SOUND_ADMINHELP) ? "now" : "no longer"] hear a sound when adminhelps arrive."
|
||||
feedback_add_details("admin_verb","AHS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/verb/deadchat() // Deadchat toggle is usable by anyone.
|
||||
set name = "Show/Hide Deadchat"
|
||||
set category = "Preferences"
|
||||
set desc ="Toggles seeing deadchat"
|
||||
prefs.toggles ^= CHAT_DEAD
|
||||
prefs.save_preferences()
|
||||
|
||||
if(src.holder)
|
||||
src << "You will [(prefs.toggles & CHAT_DEAD) ? "now" : "no longer"] see deadchat."
|
||||
else
|
||||
src << "As a ghost, you will [(prefs.toggles & CHAT_DEAD) ? "now" : "no longer"] see deadchat."
|
||||
|
||||
feedback_add_details("admin_verb","TDV") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/proc/toggleprayers()
|
||||
set name = "Show/Hide Prayers"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggles seeing prayers"
|
||||
prefs.toggles ^= CHAT_PRAYER
|
||||
prefs.save_preferences()
|
||||
src << "You will [(prefs.toggles & CHAT_PRAYER) ? "now" : "no longer"] see prayerchat."
|
||||
feedback_add_details("admin_verb","TP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/verb/toggletitlemusic()
|
||||
set name = "Hear/Silence LobbyMusic"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggles hearing the GameLobby music"
|
||||
prefs.toggles ^= SOUND_LOBBY
|
||||
prefs.save_preferences()
|
||||
if(prefs.toggles & SOUND_LOBBY)
|
||||
src << "You will now hear music in the game lobby."
|
||||
if(istype(mob, /mob/new_player))
|
||||
playtitlemusic()
|
||||
else
|
||||
src << "You will no longer hear music in the game lobby."
|
||||
if(istype(mob, /mob/new_player))
|
||||
src << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // stop the jamsz
|
||||
feedback_add_details("admin_verb","TLobby") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/verb/togglemidis()
|
||||
set name = "Hear/Silence Midis"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggles hearing sounds uploaded by admins"
|
||||
prefs.toggles ^= SOUND_MIDI
|
||||
prefs.save_preferences()
|
||||
if(prefs.toggles & SOUND_MIDI)
|
||||
src << "You will now hear any sounds uploaded by admins."
|
||||
var/sound/break_sound = sound(null, repeat = 0, wait = 0, channel = 777)
|
||||
break_sound.priority = 250
|
||||
src << break_sound //breaks the client's sound output on channel 777
|
||||
else
|
||||
src << "You will no longer hear sounds uploaded by admins; any currently playing midis have been disabled."
|
||||
feedback_add_details("admin_verb","TMidi") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/verb/listen_ooc()
|
||||
set name = "Show/Hide OOC"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggles seeing OutOfCharacter chat"
|
||||
prefs.toggles ^= CHAT_OOC
|
||||
prefs.save_preferences()
|
||||
src << "You will [(prefs.toggles & CHAT_OOC) ? "now" : "no longer"] see messages on the OOC channel."
|
||||
feedback_add_details("admin_verb","TOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
|
||||
/client/verb/listen_looc()
|
||||
set name = "Show/Hide LOOC"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggles seeing Local OutOfCharacter chat"
|
||||
prefs.toggles ^= CHAT_LOOC
|
||||
prefs.save_preferences()
|
||||
|
||||
src << "You will [(prefs.toggles & CHAT_LOOC) ? "now" : "no longer"] see messages on the LOOC channel."
|
||||
feedback_add_details("admin_verb","TLOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
|
||||
|
||||
/client/verb/Toggle_Soundscape() //All new ambience should be added here so it works with this verb until someone better at things comes up with a fix that isn't awful
|
||||
set name = "Hear/Silence Ambience"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggles hearing ambient sound effects"
|
||||
prefs.toggles ^= SOUND_AMBIENCE
|
||||
prefs.save_preferences()
|
||||
if(prefs.toggles & SOUND_AMBIENCE)
|
||||
src << "You will now hear ambient sounds."
|
||||
else
|
||||
src << "You will no longer hear ambient sounds."
|
||||
src << sound(null, repeat = 0, wait = 0, volume = 0, channel = 1)
|
||||
src << sound(null, repeat = 0, wait = 0, volume = 0, channel = 2)
|
||||
feedback_add_details("admin_verb","TAmbi") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
//be special
|
||||
/client/verb/toggle_be_special(role in be_special_flags)
|
||||
set name = "Toggle SpecialRole Candidacy"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggles which special roles you would like to be a candidate for, during events."
|
||||
var/role_flag = be_special_flags[role]
|
||||
if(!role_flag) return
|
||||
prefs.be_special ^= role_flag
|
||||
prefs.save_preferences()
|
||||
src << "You will [(prefs.be_special & role_flag) ? "now" : "no longer"] be considered for [role] events (where possible)."
|
||||
feedback_add_details("admin_verb","TBeSpecial") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
|
||||
/client/verb/change_ui()
|
||||
set name = "Change UI"
|
||||
set category = "Preferences"
|
||||
set desc = "Configure your user interface"
|
||||
|
||||
if(!ishuman(usr))
|
||||
usr << "This only for human"
|
||||
return
|
||||
|
||||
var/UI_style_new = input(usr, "Select a style, we recommend White for customization") in list("White", "Midnight", "Orange", "old")
|
||||
if(!UI_style_new) return
|
||||
|
||||
var/UI_style_alpha_new = input(usr, "Select a new alpha(transparence) parametr for UI, between 50 and 255") as num
|
||||
if(!UI_style_alpha_new | !(UI_style_alpha_new <= 255 && UI_style_alpha_new >= 50)) return
|
||||
|
||||
var/UI_style_color_new = input(usr, "Choose your UI color, dark colors are not recommended!") as color|null
|
||||
if(!UI_style_color_new) return
|
||||
|
||||
//update UI
|
||||
var/list/icons = usr.hud_used.adding + usr.hud_used.other +usr.hud_used.hotkeybuttons
|
||||
icons.Add(usr.zone_sel)
|
||||
|
||||
for(var/obj/screen/I in icons)
|
||||
if(I.color && I.alpha)
|
||||
I.icon = ui_style2icon(UI_style_new)
|
||||
I.color = UI_style_color_new
|
||||
I.alpha = UI_style_alpha_new
|
||||
|
||||
|
||||
|
||||
if(alert("Like it? Save changes?",,"Yes", "No") == "Yes")
|
||||
prefs.UI_style = UI_style_new
|
||||
prefs.UI_style_alpha = UI_style_alpha_new
|
||||
prefs.UI_style_color = UI_style_color_new
|
||||
prefs.save_preferences()
|
||||
usr << "UI was saved"
|
||||
Reference in New Issue
Block a user