mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 19:17:50 +01:00
Merge pull request #6191 from Krausus/CharacterSlotFixes
Character Slot Randomization and Loading Fixes
This commit is contained in:
@@ -1963,6 +1963,9 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
|
||||
|
||||
if("randomslot")
|
||||
randomslot = !randomslot
|
||||
if(isnewplayer(usr))
|
||||
var/mob/new_player/N = usr
|
||||
N.new_player_panel_proc()
|
||||
|
||||
if("hear_midis")
|
||||
sound ^= SOUND_MIDI
|
||||
@@ -2188,26 +2191,26 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
|
||||
/datum/preferences/proc/open_load_dialog(mob/user)
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT slot,real_name FROM [format_table_name("characters")] WHERE ckey='[user.ckey]' ORDER BY slot")
|
||||
var/list/slotnames[max_save_slots]
|
||||
|
||||
if(!query.Execute())
|
||||
var/err = query.ErrorMsg()
|
||||
log_game("SQL ERROR during character slot loading. Error : \[[err]\]\n")
|
||||
message_admins("SQL ERROR during character slot loading. Error : \[[err]\]\n")
|
||||
return
|
||||
while(query.NextRow())
|
||||
slotnames[text2num(query.item[1])] = query.item[2]
|
||||
|
||||
var/dat = "<body>"
|
||||
dat += "<tt><center>"
|
||||
dat += "<b>Select a character slot to load</b><hr>"
|
||||
var/name
|
||||
|
||||
for(var/i=1, i<=max_save_slots, i++)
|
||||
if(!query.Execute())
|
||||
var/err = query.ErrorMsg()
|
||||
log_game("SQL ERROR during character slot loading. Error : \[[err]\]\n")
|
||||
message_admins("SQL ERROR during character slot loading. Error : \[[err]\]\n")
|
||||
return
|
||||
while(query.NextRow())
|
||||
if(i==text2num(query.item[1]))
|
||||
name = query.item[2]
|
||||
if(!name) name = "Character[i]"
|
||||
if(i==default_slot)
|
||||
for(var/i in 1 to max_save_slots)
|
||||
name = slotnames[i] || "Character [i]"
|
||||
if(i == default_slot)
|
||||
name = "<b>[name]</b>"
|
||||
dat += "<a href='?_src_=prefs;preference=changeslot;num=[i];'>[name]</a><br>"
|
||||
name = null
|
||||
|
||||
dat += "<hr>"
|
||||
dat += "<a href='byond://?src=[user.UID()];preference=close_load_dialog'>Close</a><br>"
|
||||
|
||||
@@ -500,21 +500,24 @@
|
||||
return
|
||||
return 1
|
||||
|
||||
/*
|
||||
/datum/preferences/proc/random_character(client/C)
|
||||
/datum/preferences/proc/load_random_character_slot(client/C)
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT slot FROM [format_table_name("characters")] WHERE ckey='[C.ckey]' ORDER BY slot")
|
||||
var/list/saves = list()
|
||||
|
||||
if(!query.Execute())
|
||||
var/err = query.ErrorMsg()
|
||||
log_game("SQL ERROR during random character slot picking. Error : \[[err]\]\n")
|
||||
message_admins("SQL ERROR during random character slot picking. Error : \[[err]\]\n")
|
||||
return
|
||||
|
||||
while(query.NextRow())
|
||||
var/list/saves = list()
|
||||
for(var/i=1, i<=MAX_SAVE_SLOTS, i++)
|
||||
if(i==text2num(query.item[1]))
|
||||
saves += i
|
||||
saves += text2num(query.item[1])
|
||||
|
||||
if(!saves.len)
|
||||
load_character(C)
|
||||
return 0
|
||||
load_character(C,pick(saves))
|
||||
return 1*/
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/SetChangelog(client/C,hash)
|
||||
lastchangelog=hash
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
/mob/new_player/proc/new_player_panel_proc()
|
||||
var/real_name = client.prefs.real_name
|
||||
if(client.prefs.randomslot)
|
||||
real_name = "Random Character Slot"
|
||||
var/output = "<center><p><a href='byond://?src=[UID()];show_preferences=1'>Setup Character</A><br /><i>[real_name]</i></p>"
|
||||
|
||||
if(!ticker || ticker.current_state <= GAME_STATE_PREGAME)
|
||||
@@ -169,6 +171,9 @@
|
||||
to_chat(usr, "\blue There is an administrative lock on entering the game!")
|
||||
return
|
||||
|
||||
if(client.prefs.randomslot)
|
||||
client.prefs.load_random_character_slot(client)
|
||||
|
||||
if(client.prefs.species in whitelisted_species)
|
||||
if(!is_alien_whitelisted(src, client.prefs.species) && config.usealienwhitelist)
|
||||
to_chat(src, alert("You are currently not whitelisted to play [client.prefs.species]."))
|
||||
|
||||
Reference in New Issue
Block a user