Merge pull request #2981 from Citadel-Station-13/upstream-merge-30763

[MIRROR] Configuration datum refactor
This commit is contained in:
LetterJay
2017-10-01 02:50:17 -04:00
committed by GitHub
138 changed files with 3709 additions and 3500 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ AI MODULES
for(var/mylaw in lawlist)
if(mylaw != "")
tot_laws++
if(tot_laws > config.silicon_max_law_amount && !bypass_law_amt_check)//allows certain boards to avoid this check, eg: reset
if(tot_laws > CONFIG_GET(number/silicon_max_law_amount) && !bypass_law_amt_check)//allows certain boards to avoid this check, eg: reset
to_chat(user, "<span class='caution'>Not enough memory allocated to [law_datum.owner ? law_datum.owner : "the AI core"]'s law processor to handle this amount of laws.</span>")
message_admins("[key_name_admin(user)] tried to upload laws to [law_datum.owner ? key_name_admin(law_datum.owner) : "an AI core"] that would exceed the law cap.")
overflow = TRUE
+5 -6
View File
@@ -72,16 +72,15 @@
user.visible_message("<span class='suicide'>[user] is jamming [src] up [user.p_their()] nose and into [user.p_their()] brain. It looks like [user.p_theyre()] trying to commit suicide!</span>")
return (BRUTELOSS|OXYLOSS)
/obj/item/toy/crayon/New()
..()
/obj/item/toy/crayon/Initialize()
. = ..()
// Makes crayons identifiable in things like grinders
if(name == "crayon")
name = "[item_color] crayon"
if(config)
if(config.mutant_races == 1)
graffiti |= "antilizard"
graffiti |= "prolizard"
if(CONFIG_GET(flag/join_with_mutant_race))
graffiti |= "antilizard"
graffiti |= "prolizard"
all_drawables = graffiti + letters + numerals + oriented + runes + graffiti_large_h
drawtype = pick(all_drawables)
+3 -2
View File
@@ -882,7 +882,8 @@
..()
/obj/item/book/manual/wiki/proc/initialize_wikibook()
if(config.wikiurl)
var/wikiurl = CONFIG_GET(string/wikiurl)
if(wikiurl)
dat = {"
<html><head>
@@ -900,7 +901,7 @@
}
</script>
<p id='loading'>You start skimming through the manual...</p>
<iframe width='100%' height='97%' onload="pageloaded(this)" src="[config.wikiurl]/[page_link]?printable=yes&remove_links=1" frameborder="0" id="main_frame"></iframe>
<iframe width='100%' height='97%' onload="pageloaded(this)" src="[wikiurl]/[page_link]?printable=yes&remove_links=1" frameborder="0" id="main_frame"></iframe>
</body>
</html>
+1 -1
View File
@@ -134,7 +134,7 @@
to_chat(user, "<span class='warning'>Sticking an inactive [M.name] into the frame would sort of defeat the purpose.</span>")
return
if((config) && (!config.allow_ai) || jobban_isbanned(M.brainmob, "AI"))
if(!CONFIG_GET(flag/allow_ai) || jobban_isbanned(M.brainmob, "AI"))
to_chat(user, "<span class='warning'>This [M.name] does not seem to fit!</span>")
return
@@ -98,7 +98,7 @@
set category = "Object"
set src in oview(1)
if(config.ghost_interaction)
if(CONFIG_GET(flag/ghost_interaction))
spin()
else
if(!usr || !isturf(usr.loc))
@@ -23,7 +23,7 @@
return
move_delay = 1
if(step(src, direction))
spawn(config.walk_speed*move_speed_multiplier)
spawn(CONFIG_GET(number/walk_delay) * move_speed_multiplier)
move_delay = 0
else
move_delay = 0
+226 -225
View File
@@ -1,225 +1,226 @@
//wip wip wup
/obj/structure/mirror
name = "mirror"
desc = "Mirror mirror on the wall, who's the most robust of them all?"
icon = 'icons/obj/watercloset.dmi'
icon_state = "mirror"
density = FALSE
anchored = TRUE
max_integrity = 200
integrity_failure = 100
/obj/structure/mirror/attack_hand(mob/user)
if(broken || !Adjacent(user))
return
if(ishuman(user))
var/mob/living/carbon/human/H = user
var/userloc = H.loc
//see code/modules/mob/dead/new_player/preferences.dm at approx line 545 for comments!
//this is largely copypasted from there.
//handle facial hair (if necessary)
if(H.gender == MALE)
var/new_style = input(user, "Select a facial hair style", "Grooming") as null|anything in GLOB.facial_hair_styles_list
if(userloc != H.loc)
return //no tele-grooming
if(new_style)
H.facial_hair_style = new_style
else
H.facial_hair_style = "Shaved"
//handle normal hair
var/new_style = input(user, "Select a hair style", "Grooming") as null|anything in GLOB.hair_styles_list
if(userloc != H.loc)
return //no tele-grooming
if(new_style)
H.hair_style = new_style
H.update_hair()
/obj/structure/mirror/examine_status(mob/user)
if(broken)
return // no message spam
..()
/obj/structure/mirror/obj_break(damage_flag)
if(!broken && !(flags_1 & NODECONSTRUCT_1))
icon_state = "mirror_broke"
playsound(src, "shatter", 70, 1)
desc = "Oh no, seven years of bad luck!"
broken = 1
/obj/structure/mirror/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))
if(!disassembled)
new /obj/item/shard( src.loc )
qdel(src)
/obj/structure/mirror/attackby(obj/item/I, mob/living/user, params)
if(istype(I, /obj/item/weldingtool) && user.a_intent != INTENT_HARM)
var/obj/item/weldingtool/WT = I
if(broken)
user.changeNext_move(CLICK_CD_MELEE)
if(WT.remove_fuel(0, user))
to_chat(user, "<span class='notice'>You begin repairing [src]...</span>")
playsound(src, 'sound/items/welder.ogg', 100, 1)
if(do_after(user, 10*I.toolspeed, target = src))
if(!user || !WT || !WT.isOn())
return
to_chat(user, "<span class='notice'>You repair [src].</span>")
broken = 0
icon_state = initial(icon_state)
desc = initial(desc)
else
return ..()
/obj/structure/mirror/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
switch(damage_type)
if(BRUTE)
playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1)
if(BURN)
playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1)
/obj/structure/mirror/magic
name = "magic mirror"
desc = "Turn and face the strange... face."
icon_state = "magic_mirror"
var/list/races_blacklist = list("skeleton", "agent", "angel", "military_synth", "memezombie")
var/list/choosable_races = list()
/obj/structure/mirror/magic/New()
if(!choosable_races.len)
for(var/speciestype in subtypesof(/datum/species))
var/datum/species/S = new speciestype()
if(!(S.id in races_blacklist))
choosable_races += S.id
..()
/obj/structure/mirror/magic/lesser/New()
choosable_races = GLOB.roundstart_species
..()
/obj/structure/mirror/magic/badmin/New()
for(var/speciestype in subtypesof(/datum/species))
var/datum/species/S = new speciestype()
choosable_races += S.id
..()
/obj/structure/mirror/magic/attack_hand(mob/user)
if(!ishuman(user))
return
var/mob/living/carbon/human/H = user
var/choice = input(user, "Something to change?", "Magical Grooming") as null|anything in list("name", "race", "gender", "hair", "eyes")
if(!Adjacent(user))
return
switch(choice)
if("name")
var/newname = copytext(sanitize(input(H, "Who are we again?", "Name change", H.name) as null|text),1,MAX_NAME_LEN)
if(!newname)
return
if(!Adjacent(user))
return
H.real_name = newname
H.name = newname
if(H.dna)
H.dna.real_name = newname
if(H.mind)
H.mind.name = newname
if("race")
var/newrace
var/racechoice = input(H, "What are we again?", "Race change") as null|anything in choosable_races
newrace = GLOB.species_list[racechoice]
if(!newrace)
return
if(!Adjacent(user))
return
H.set_species(newrace, icon_update=0)
if(H.dna.species.use_skintones)
var/new_s_tone = input(user, "Choose your skin tone:", "Race change") as null|anything in GLOB.skin_tones
if(new_s_tone)
H.skin_tone = new_s_tone
H.dna.update_ui_block(DNA_SKIN_TONE_BLOCK)
if(MUTCOLORS in H.dna.species.species_traits)
var/new_mutantcolor = input(user, "Choose your skin color:", "Race change") as color|null
if(new_mutantcolor)
var/temp_hsv = RGBtoHSV(new_mutantcolor)
if(ReadHSV(temp_hsv)[3] >= ReadHSV("#7F7F7F")[3]) // mutantcolors must be bright
H.dna.features["mcolor"] = sanitize_hexcolor(new_mutantcolor)
else
to_chat(H, "<span class='notice'>Invalid color. Your color is not bright enough.</span>")
H.update_body()
H.update_hair()
H.update_body_parts()
H.update_mutations_overlay() // no hulk lizard
if("gender")
if(!(H.gender in list("male", "female"))) //blame the patriarchy
return
if(!Adjacent(user))
return
if(H.gender == "male")
if(alert(H, "Become a Witch?", "Confirmation", "Yes", "No") == "Yes")
H.gender = "female"
to_chat(H, "<span class='notice'>Man, you feel like a woman!</span>")
else
return
else
if(alert(H, "Become a Warlock?", "Confirmation", "Yes", "No") == "Yes")
H.gender = "male"
to_chat(H, "<span class='notice'>Whoa man, you feel like a man!</span>")
else
return
H.dna.update_ui_block(DNA_GENDER_BLOCK)
H.update_body()
H.update_mutations_overlay() //(hulk male/female)
if("hair")
var/hairchoice = alert(H, "Hair style or hair color?", "Change Hair", "Style", "Color")
if(!Adjacent(user))
return
if(hairchoice == "Style") //So you just want to use a mirror then?
..()
else
var/new_hair_color = input(H, "Choose your hair color", "Hair Color") as null|color
if(new_hair_color)
H.hair_color = sanitize_hexcolor(new_hair_color)
H.dna.update_ui_block(DNA_HAIR_COLOR_BLOCK)
if(H.gender == "male")
var/new_face_color = input(H, "Choose your facial hair color", "Hair Color") as null|color
if(new_face_color)
H.facial_hair_color = sanitize_hexcolor(new_face_color)
H.dna.update_ui_block(DNA_FACIAL_HAIR_COLOR_BLOCK)
H.update_hair()
if("eyes")
var/new_eye_color = input(H, "Choose your eye color", "Eye Color") as null|color
if(!Adjacent(user))
return
if(new_eye_color)
H.eye_color = sanitize_hexcolor(new_eye_color)
H.dna.update_ui_block(DNA_EYE_COLOR_BLOCK)
H.update_body()
if(choice)
curse(user)
/obj/structure/mirror/magic/proc/curse(mob/living/user)
return
//wip wip wup
/obj/structure/mirror
name = "mirror"
desc = "Mirror mirror on the wall, who's the most robust of them all?"
icon = 'icons/obj/watercloset.dmi'
icon_state = "mirror"
density = FALSE
anchored = TRUE
max_integrity = 200
integrity_failure = 100
/obj/structure/mirror/attack_hand(mob/user)
if(broken || !Adjacent(user))
return
if(ishuman(user))
var/mob/living/carbon/human/H = user
var/userloc = H.loc
//see code/modules/mob/dead/new_player/preferences.dm at approx line 545 for comments!
//this is largely copypasted from there.
//handle facial hair (if necessary)
if(H.gender == MALE)
var/new_style = input(user, "Select a facial hair style", "Grooming") as null|anything in GLOB.facial_hair_styles_list
if(userloc != H.loc)
return //no tele-grooming
if(new_style)
H.facial_hair_style = new_style
else
H.facial_hair_style = "Shaved"
//handle normal hair
var/new_style = input(user, "Select a hair style", "Grooming") as null|anything in GLOB.hair_styles_list
if(userloc != H.loc)
return //no tele-grooming
if(new_style)
H.hair_style = new_style
H.update_hair()
/obj/structure/mirror/examine_status(mob/user)
if(broken)
return // no message spam
..()
/obj/structure/mirror/obj_break(damage_flag)
if(!broken && !(flags_1 & NODECONSTRUCT_1))
icon_state = "mirror_broke"
playsound(src, "shatter", 70, 1)
desc = "Oh no, seven years of bad luck!"
broken = 1
/obj/structure/mirror/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))
if(!disassembled)
new /obj/item/shard( src.loc )
qdel(src)
/obj/structure/mirror/attackby(obj/item/I, mob/living/user, params)
if(istype(I, /obj/item/weldingtool) && user.a_intent != INTENT_HARM)
var/obj/item/weldingtool/WT = I
if(broken)
user.changeNext_move(CLICK_CD_MELEE)
if(WT.remove_fuel(0, user))
to_chat(user, "<span class='notice'>You begin repairing [src]...</span>")
playsound(src, 'sound/items/welder.ogg', 100, 1)
if(do_after(user, 10*I.toolspeed, target = src))
if(!user || !WT || !WT.isOn())
return
to_chat(user, "<span class='notice'>You repair [src].</span>")
broken = 0
icon_state = initial(icon_state)
desc = initial(desc)
else
return ..()
/obj/structure/mirror/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
switch(damage_type)
if(BRUTE)
playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1)
if(BURN)
playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1)
/obj/structure/mirror/magic
name = "magic mirror"
desc = "Turn and face the strange... face."
icon_state = "magic_mirror"
var/list/races_blacklist = list("skeleton", "agent", "angel", "military_synth", "memezombie")
var/list/choosable_races = list()
/obj/structure/mirror/magic/New()
if(!choosable_races.len)
for(var/speciestype in subtypesof(/datum/species))
var/datum/species/S = new speciestype()
if(!(S.id in races_blacklist))
choosable_races += S.id
..()
/obj/structure/mirror/magic/lesser/New()
var/list/L = CONFIG_GET(keyed_flag_list/roundstart_races)
choosable_races = L.Copy()
..()
/obj/structure/mirror/magic/badmin/New()
for(var/speciestype in subtypesof(/datum/species))
var/datum/species/S = new speciestype()
choosable_races += S.id
..()
/obj/structure/mirror/magic/attack_hand(mob/user)
if(!ishuman(user))
return
var/mob/living/carbon/human/H = user
var/choice = input(user, "Something to change?", "Magical Grooming") as null|anything in list("name", "race", "gender", "hair", "eyes")
if(!Adjacent(user))
return
switch(choice)
if("name")
var/newname = copytext(sanitize(input(H, "Who are we again?", "Name change", H.name) as null|text),1,MAX_NAME_LEN)
if(!newname)
return
if(!Adjacent(user))
return
H.real_name = newname
H.name = newname
if(H.dna)
H.dna.real_name = newname
if(H.mind)
H.mind.name = newname
if("race")
var/newrace
var/racechoice = input(H, "What are we again?", "Race change") as null|anything in choosable_races
newrace = GLOB.species_list[racechoice]
if(!newrace)
return
if(!Adjacent(user))
return
H.set_species(newrace, icon_update=0)
if(H.dna.species.use_skintones)
var/new_s_tone = input(user, "Choose your skin tone:", "Race change") as null|anything in GLOB.skin_tones
if(new_s_tone)
H.skin_tone = new_s_tone
H.dna.update_ui_block(DNA_SKIN_TONE_BLOCK)
if(MUTCOLORS in H.dna.species.species_traits)
var/new_mutantcolor = input(user, "Choose your skin color:", "Race change") as color|null
if(new_mutantcolor)
var/temp_hsv = RGBtoHSV(new_mutantcolor)
if(ReadHSV(temp_hsv)[3] >= ReadHSV("#7F7F7F")[3]) // mutantcolors must be bright
H.dna.features["mcolor"] = sanitize_hexcolor(new_mutantcolor)
else
to_chat(H, "<span class='notice'>Invalid color. Your color is not bright enough.</span>")
H.update_body()
H.update_hair()
H.update_body_parts()
H.update_mutations_overlay() // no hulk lizard
if("gender")
if(!(H.gender in list("male", "female"))) //blame the patriarchy
return
if(!Adjacent(user))
return
if(H.gender == "male")
if(alert(H, "Become a Witch?", "Confirmation", "Yes", "No") == "Yes")
H.gender = "female"
to_chat(H, "<span class='notice'>Man, you feel like a woman!</span>")
else
return
else
if(alert(H, "Become a Warlock?", "Confirmation", "Yes", "No") == "Yes")
H.gender = "male"
to_chat(H, "<span class='notice'>Whoa man, you feel like a man!</span>")
else
return
H.dna.update_ui_block(DNA_GENDER_BLOCK)
H.update_body()
H.update_mutations_overlay() //(hulk male/female)
if("hair")
var/hairchoice = alert(H, "Hair style or hair color?", "Change Hair", "Style", "Color")
if(!Adjacent(user))
return
if(hairchoice == "Style") //So you just want to use a mirror then?
..()
else
var/new_hair_color = input(H, "Choose your hair color", "Hair Color") as null|color
if(new_hair_color)
H.hair_color = sanitize_hexcolor(new_hair_color)
H.dna.update_ui_block(DNA_HAIR_COLOR_BLOCK)
if(H.gender == "male")
var/new_face_color = input(H, "Choose your facial hair color", "Hair Color") as null|color
if(new_face_color)
H.facial_hair_color = sanitize_hexcolor(new_face_color)
H.dna.update_ui_block(DNA_FACIAL_HAIR_COLOR_BLOCK)
H.update_hair()
if("eyes")
var/new_eye_color = input(H, "Choose your eye color", "Eye Color") as null|color
if(!Adjacent(user))
return
if(new_eye_color)
H.eye_color = sanitize_hexcolor(new_eye_color)
H.dna.update_ui_block(DNA_EYE_COLOR_BLOCK)
H.update_body()
if(choice)
curse(user)
/obj/structure/mirror/magic/proc/curse(mob/living/user)
return