From 4d74a8f5c216904fee848e397f8ef9bdc206ba35 Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Fri, 8 Apr 2016 10:31:51 +0200 Subject: [PATCH 1/4] Various fixes. Client Login() now calls ..() before setting up preferences, ensuring a mob has actually been assigned. Fixes #12560 (and probably other somehow subtle sanitation issues). The alien whitelist now checks the rights of the supplied mob, not usr. When granting xeno loadout gear the mob's current species must match the gear's whiteliste species. --- code/game/jobs/job_controller.dm | 6 ++++-- code/game/jobs/whitelist.dm | 2 +- code/modules/client/client procs.dm | 4 ++-- .../modules/client/preference_setup/loadout/loadout.dm | 10 ++++++---- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index 14d772437d6..766149d4123 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -342,11 +342,13 @@ var/global/datum/controller/occupations/job_master else permitted = 1 - if(G.whitelisted && !is_alien_whitelisted(H, all_species[G.whitelisted])) + //if(G.whitelisted && !is_alien_whitelisted(H, all_species[G.whitelisted])) + + if(G.whitelisted && (G.whitelisted != H.species.name || !is_alien_whitelisted(H, G.whitelisted))) permitted = 0 if(!permitted) - H << "Your current job or whitelist status does not permit you to spawn with [thing]!" + H << "Your current species, job or whitelist status does not permit you to spawn with [thing]!" continue if(G.slot && !(G.slot in custom_equip_slots)) diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm index 4d7106d2134..9a13e066a54 100644 --- a/code/game/jobs/whitelist.dm +++ b/code/game/jobs/whitelist.dm @@ -75,7 +75,7 @@ var/list/whitelist = list() /proc/whitelist_overrides(mob/M) if(!config.usealienwhitelist) return 1 - if(check_rights(R_ADMIN, 0)) + if(check_rights(R_ADMIN, 0, M)) return 1 return 0 diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 0962d540611..ef5eb76728d 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -122,6 +122,8 @@ admins += src holder.owner = src + . = ..() //calls mob.Login() + //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) @@ -130,8 +132,6 @@ 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 << "

Custom Event

" src << "

A custom event is taking place. OOC Info:

" diff --git a/code/modules/client/preference_setup/loadout/loadout.dm b/code/modules/client/preference_setup/loadout/loadout.dm index 31b510ef1a8..4bee6c65663 100644 --- a/code/modules/client/preference_setup/loadout/loadout.dm +++ b/code/modules/client/preference_setup/loadout/loadout.dm @@ -52,15 +52,17 @@ var/list/gear_datums = list() S["gear"] << pref.gear /datum/category_item/player_setup_item/loadout/proc/valid_gear_choices(var/max_cost) - var/list/valid_gear_choices = list() + . = list() + var/mob/preference_mob = preference_mob() for(var/gear_name in gear_datums) var/datum/gear/G = gear_datums[gear_name] - if(G.whitelisted && !is_alien_whitelisted(preference_mob(), all_species[G.whitelisted])) + //if(G.whitelisted && !is_alien_whitelisted(preference_mob(), all_species[G.whitelisted])) + + if(G.whitelisted && !is_alien_whitelisted(preference_mob, G.whitelisted)) continue if(max_cost && G.cost > max_cost) continue - valid_gear_choices += gear_name - return valid_gear_choices + . += gear_name /datum/category_item/player_setup_item/loadout/sanitize_character() if(!islist(pref.gear)) From 3f238f471a5591997321f8ea92e910083eb130ae Mon Sep 17 00:00:00 2001 From: Yoshax Date: Fri, 5 Aug 2016 17:37:48 +0100 Subject: [PATCH 2/4] Adds changelog --- html/changelogs/Yoshax - Xeno.yml | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 html/changelogs/Yoshax - Xeno.yml diff --git a/html/changelogs/Yoshax - Xeno.yml b/html/changelogs/Yoshax - Xeno.yml new file mode 100644 index 00000000000..d456954c721 --- /dev/null +++ b/html/changelogs/Yoshax - Xeno.yml @@ -0,0 +1,36 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +################################# + +# Your name. +author: Yoshax + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Xeno loadout items will now properly be reloaded into a slot when the server restarts." From 77dda80477a0f732da75b0b79b8481fb1496b28e Mon Sep 17 00:00:00 2001 From: Yoshax Date: Fri, 5 Aug 2016 17:38:08 +0100 Subject: [PATCH 3/4] Removes whitelist taj from furs and mantle --- .../client/preference_setup/loadout/loadout_xeno.dm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/code/modules/client/preference_setup/loadout/loadout_xeno.dm b/code/modules/client/preference_setup/loadout/loadout_xeno.dm index 9f814743aea..80e6bb8ebf8 100644 --- a/code/modules/client/preference_setup/loadout/loadout_xeno.dm +++ b/code/modules/client/preference_setup/loadout/loadout_xeno.dm @@ -2,14 +2,12 @@ /datum/gear/suit/zhan_furs display_name = "Zhan-Khazan furs (Tajara)" path = /obj/item/clothing/suit/tajaran/furs - whitelisted = "Tajara" sort_category = "Xenowear" /datum/gear/suit/unathi_mantle display_name = "hide mantle (Unathi)" path = /obj/item/clothing/suit/unathi/mantle cost = 1 - whitelisted = "Unathi" sort_category = "Xenowear" /datum/gear/ears/skrell/chains //Chains @@ -25,7 +23,7 @@ var/obj/item/clothing/ears/skrell/chain/chain = chain_style chaintypes[initial(chain.name)] = chain gear_tweaks += new/datum/gear_tweak/path(sortAssoc(chaintypes)) - + /datum/gear/ears/skrell/bands display_name = "headtail band selection (Skrell)" path = /obj/item/clothing/ears/skrell/band @@ -39,7 +37,7 @@ var/obj/item/clothing/ears/skrell/band/band = band_style bandtypes[initial(band.name)] = band gear_tweaks += new/datum/gear_tweak/path(sortAssoc(bandtypes)) - + /datum/gear/ears/skrell/cloth/male display_name = "male headtail cloth selection (Skrell)" path = /obj/item/clothing/ears/skrell/cloth_male @@ -73,17 +71,17 @@ path = /obj/item/clothing/ears/skrell/colored/band sort_category = "Xenowear" whitelisted = "Skrell" - + /datum/gear/ears/skrell/colored/band/New() ..() gear_tweaks = list(gear_tweak_free_color_choice) - + /datum/gear/ears/skrell/colored/chain display_name = "Colored chain (Skrell)" path = /obj/item/clothing/ears/skrell/colored/chain sort_category = "Xenowear" whitelisted = "Skrell" - + /datum/gear/ears/skrell/colored/chain/New() ..() gear_tweaks = list(gear_tweak_free_color_choice) From 0f830b0f98226033fa5e3640a8b1bd8d410c6017 Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Thu, 2 Jun 2016 09:48:11 +0200 Subject: [PATCH 4/4] no message --- code/modules/client/client procs.dm | 5 +++-- code/modules/client/preference_setup/preference_setup.dm | 4 ---- code/modules/client/preferences.dm | 2 ++ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index ef5eb76728d..4463209157b 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -122,8 +122,6 @@ admins += src holder.owner = src - . = ..() //calls mob.Login() - //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) @@ -132,6 +130,9 @@ 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() + prefs.sanitize_preferences() + if(custom_event_msg && custom_event_msg != "") src << "

Custom Event

" src << "

A custom event is taking place. OOC Info:

" diff --git a/code/modules/client/preference_setup/preference_setup.dm b/code/modules/client/preference_setup/preference_setup.dm index 832d529d7c1..f72ff0645c0 100644 --- a/code/modules/client/preference_setup/preference_setup.dm +++ b/code/modules/client/preference_setup/preference_setup.dm @@ -129,8 +129,6 @@ // 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. for(var/datum/category_item/player_setup_item/PI in items) PI.load_character(S) - for(var/datum/category_item/player_setup_item/PI in items) - PI.sanitize_character() /datum/category_group/player_setup_category/proc/save_character(var/savefile/S) // Sanitize all data, then save it @@ -142,8 +140,6 @@ /datum/category_group/player_setup_category/proc/load_preferences(var/savefile/S) for(var/datum/category_item/player_setup_item/PI in items) PI.load_preferences(S) - for(var/datum/category_item/player_setup_item/PI in items) - PI.sanitize_preferences() /datum/category_group/player_setup_category/proc/save_preferences(var/savefile/S) for(var/datum/category_item/player_setup_item/PI in items) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 4aeaf7c800d..db12940bd9a 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -237,12 +237,14 @@ datum/preferences else if(href_list["reload"]) load_preferences() load_character() + sanitize_preferences() else if(href_list["load"]) if(!IsGuestKey(usr.key)) open_load_dialog(usr) return 1 else if(href_list["changeslot"]) load_character(text2num(href_list["changeslot"])) + sanitize_preferences() close_load_dialog(usr) else return 0