FINALLY modularizes Polychromic Clothes AND modernizes all polychromic code! (#5269)

* FINALLY AFTER 2 MONTHS

WOOOOOOOOOOOOOOO

* Updates all polychromic code

This makes the default argument of all polychromic color input menus the last chosen color.
This commit is contained in:
Michiyamenotehifunana
2018-02-07 09:08:08 +08:00
committed by Poojawa
parent faf0c5f020
commit 389e6de8f5
10 changed files with 125 additions and 101 deletions
+19 -19
View File
@@ -1004,49 +1004,49 @@ obj/item/projectile/bullet/c10mm/soporific
switch(choice)
if("Frame Color")
var/frame_color_input = input(usr,"Choose Frame Color") as color|null
var/frame_color_input = input(usr,"","Choose Frame Color",frame_color) as color|null
if(frame_color_input)
frame_color = sanitize_hexcolor(frame_color_input, desired_format=6, include_crunch=1)
update_icon()
if("Receiver Color")
var/receiver_color_input = input(usr,"Choose Receiver Color") as color|null
var/receiver_color_input = input(usr,"","Choose Receiver Color",receiver_color) as color|null
if(receiver_color_input)
receiver_color = sanitize_hexcolor(receiver_color_input, desired_format=6, include_crunch=1)
update_icon()
if("Body Color")
var/body_color_input = input(usr,"Choose Body Color") as color|null
var/body_color_input = input(usr,"","Choose Body Color",body_color) as color|null
if(body_color_input)
body_color = sanitize_hexcolor(body_color_input, desired_format=6, include_crunch=1)
update_icon()
if("Barrel Color")
var/barrel_color_input = input(usr,"Choose Barrel Color") as color|null
var/barrel_color_input = input(usr,"","Choose Barrel Color",barrel_color) as color|null
if(barrel_color_input)
barrel_color = sanitize_hexcolor(barrel_color_input, desired_format=6, include_crunch=1)
update_icon()
if("Barrel Tip Color")
var/tip_color_input = input(usr,"Choose Barrel Tip Color") as color|null
var/tip_color_input = input(usr,"","Choose Barrel Tip Color",tip_color) as color|null
if(tip_color_input)
tip_color = sanitize_hexcolor(tip_color_input, desired_format=6, include_crunch=1)
update_icon()
if("Grip Light Color")
var/grip_color_input = input(usr,"Choose Grip Light Color") as color|null
var/grip_color_input = input(usr,"","Choose Grip Light Color",grip_color) as color|null
if(grip_color_input)
grip_color = sanitize_hexcolor(grip_color_input, desired_format=6, include_crunch=1)
update_icon()
if("Light Color")
var/energy_color_input = input(usr,"Choose Light Color") as color|null
var/energy_color_input = input(usr,"","Choose Light Color",energy_color) as color|null
if(energy_color_input)
energy_color = sanitize_hexcolor(energy_color_input, desired_format=6, include_crunch=1)
update_icon()
if("Arm Color")
var/arm_color_input = input(usr,"Choose Arm Color") as color|null
var/arm_color_input = input(usr,"","Choose Arm Color",arm_color) as color|null
if(arm_color_input)
arm_color = sanitize_hexcolor(arm_color_input, desired_format=6, include_crunch=1)
update_icon()
@@ -1183,7 +1183,6 @@ obj/item/gun/energy/e_gun/cx
ammo_type = list(/obj/item/ammo_casing/energy/disabler, /obj/item/ammo_casing/energy/laser)
flight_x_offset = 15
flight_y_offset = 10
actions_types = list(/datum/action/item_action/pick_color)
var/body_color = "#252528"
obj/item/gun/energy/e_gun/cx/update_icon()
@@ -1197,16 +1196,17 @@ obj/item/gun/energy/e_gun/cx/update_icon()
var/mob/M = loc
M.update_inv_hands()
obj/item/gun/energy/e_gun/cx/ui_action_click(mob/user, var/datum/action/A)
if(istype(A, /datum/action/item_action/pick_color))
if(alert("Are you sure you want to repaint your gun?", "Confirm Repaint", "Yes", "No") == "Yes")
var/body_color_input = input(usr,"Choose Body Color") as color|null
if(body_color_input)
body_color = sanitize_hexcolor(body_color_input, desired_format=6, include_crunch=1)
obj/item/gun/energy/e_gun/cx/AltClick(mob/living/user)
if(!in_range(src, user)) //Basic checks to prevent abuse
return
if(user.incapacitated() || !istype(user))
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
return
if(alert("Are you sure you want to repaint your gun?", "Confirm Repaint", "Yes", "No") == "Yes")
var/body_color_input = input(usr,"","Choose Body Color",body_color) as color|null
if(body_color_input)
body_color = sanitize_hexcolor(body_color_input, desired_format=6, include_crunch=1)
update_icon()
A.UpdateButtonIcon()
else
..()
obj/item/gun/energy/e_gun/cx/worn_overlays(isinhands, icon_file)
. = ..()
@@ -1262,7 +1262,7 @@ obj/item/gun/energy/e_gun/cx/worn_overlays(isinhands, icon_file)
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
return
if(alert("Are you sure you want to recolor your gun?", "Confirm Repaint", "Yes", "No") == "Yes")
var/body_color_input = input(usr,"Choose Shroud Color") as color|null
var/body_color_input = input(usr,"","Choose Shroud Color",body_color) as color|null
if(body_color_input)
body_color = sanitize_hexcolor(body_color_input, desired_format=6, include_crunch=1)
update_icon()
+1 -1
View File
@@ -32,7 +32,7 @@
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
return
if(alert("Are you sure you want to recolor your id?", "Confirm Repaint", "Yes", "No") == "Yes")
var/energy_color_input = input(usr,"Choose Energy Color") as color|null
var/energy_color_input = input(usr,"","Choose Energy Color",id_color) as color|null
if(energy_color_input)
id_color = sanitize_hexcolor(energy_color_input, desired_format=6, include_crunch=1)
update_icon()
@@ -83,7 +83,7 @@
return
if(alert("Are you sure you want to recolor your blade?", "Confirm Repaint", "Yes", "No") == "Yes")
var/energy_color_input = input(usr,"Choose Energy Color") as color|null
var/energy_color_input = input(usr,"","Choose Energy Color",light_color) as color|null
if(energy_color_input)
light_color = sanitize_hexcolor(energy_color_input, desired_format=6, include_crunch=1)
update_icon()
@@ -165,7 +165,7 @@
return
if(alert("Are you sure you want to recolor your blade?", "Confirm Repaint", "Yes", "No") == "Yes")
var/energy_color_input = input(usr,"Choose Energy Color") as color|null
var/energy_color_input = input(usr,"","Choose Energy Color",light_color) as color|null
if(energy_color_input)
light_color = sanitize_hexcolor(energy_color_input, desired_format=6, include_crunch=1)
update_icon()
@@ -282,7 +282,7 @@
return
if(alert("Are you sure you want to recolor your blade?", "Confirm Repaint", "Yes", "No") == "Yes")
var/energy_color_input = input(usr,"Choose Energy Color") as color|null
var/energy_color_input = input(usr,"","Choose Energy Color",light_color) as color|null
if(energy_color_input)
light_color = sanitize_hexcolor(energy_color_input, desired_format=6, include_crunch=1)
update_icon()
@@ -0,0 +1,5 @@
/obj/structure/closet/athletic_mixed/PopulateContents()
..()
new /obj/item/clothing/under/polychromic/shortpants(src)
new /obj/item/clothing/under/polychromic/shortpants(src)
new /obj/item/clothing/under/polychromic/shortpants(src)
@@ -0,0 +1,33 @@
/obj/structure/closet/wardrobe/mixed/PopulateContents()
if(prob(40))
new /obj/item/clothing/suit/jacket(src)
if(prob(40))
new /obj/item/clothing/suit/jacket(src)
new /obj/item/clothing/under/polychromic/jumpsuit(src)
new /obj/item/clothing/under/polychromic/jumpsuit(src)
new /obj/item/clothing/under/polychromic/jumpsuit(src)
new /obj/item/clothing/under/polychromic/shirt(src)
new /obj/item/clothing/under/polychromic/shirt(src)
new /obj/item/clothing/under/polychromic/shirt(src)
new /obj/item/clothing/under/polychromic/kilt(src)
new /obj/item/clothing/under/polychromic/kilt(src)
new /obj/item/clothing/under/polychromic/kilt(src)
new /obj/item/clothing/under/polychromic/skirt(src)
new /obj/item/clothing/under/polychromic/skirt(src)
new /obj/item/clothing/under/polychromic/skirt(src)
new /obj/item/clothing/under/polychromic/shorts(src)
new /obj/item/clothing/under/polychromic/shorts(src)
new /obj/item/clothing/under/polychromic/shorts(src)
new /obj/item/clothing/mask/bandana/red(src)
new /obj/item/clothing/mask/bandana/red(src)
new /obj/item/clothing/mask/bandana/blue(src)
new /obj/item/clothing/mask/bandana/blue(src)
new /obj/item/clothing/mask/bandana/gold(src)
new /obj/item/clothing/mask/bandana/gold(src)
new /obj/item/clothing/shoes/sneakers/black(src)
new /obj/item/clothing/shoes/sneakers/brown(src)
new /obj/item/clothing/shoes/sneakers/white(src)
if(prob(30))
new /obj/item/clothing/suit/hooded/wintercoat(src)
new /obj/item/clothing/shoes/winterboots(src)
return
@@ -1,14 +1,28 @@
/obj/item/clothing/under/polychromic
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Polychromic Clothes: //
// //
// Polychromic clothes simply consist of 4 sprites: A base, unrecoloured sprite, and up to 3 greyscaled sprites. //
// In order to add more polychromic clothes, simply create a base sprite, and up to 3 recolourable overlays for it, //
// and then name them as follows: [name], [name]-primary, [name]-secondary, [name]-tertiary. The sprites should //
// ideally be in 'modular_citadel/icons/polyclothes/item/uniform.dmi' and 'modular_citadel/icons/polyclothes/mob/uniform.dmi' for the //
// worn sprites. After that, copy paste the code from any of the example clothes beneath the giant mass of procs and //
// change the names around. [name] should go in BOTH icon_state and item_color. You can preset colors and disable //
// any overlays using the self-explainatory vars. //
// //
// -Tori //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/obj/item/clothing/under/polychromic //This is the parent object. DO NOT copy paste this and its vars if you want to make something new.
name = "polychromic suit"
desc = "For when you want to show off your horrible colour coordination skills."
icon = 'modular_citadel/icons/polyclothes/item/uniform.dmi'
icon_override = 'modular_citadel/icons/polyclothes/mob/uniform.dmi'
alternate_worn_icon = 'modular_citadel/icons/polyclothes/mob/uniform.dmi' //To make human/update_icon.dm read worn sprites from here.
icon_state = "polysuit"
item_color = "polysuit"
item_state = "sl_suit"
can_adjust = FALSE
item_color = "polysuit" //The item color is used to select its mob icon
item_state = "sl_suit" //Inhand sprites. Would be an arse to make one for all the clothes. Should probably be standardized to rainbow.
can_adjust = FALSE //to prevent you from "wearing it casually"
var/hasprimary = TRUE
var/hasprimary = TRUE //These vars allow you to choose which overlays a clothing has
var/hassecondary = TRUE
var/hastertiary = TRUE
@@ -18,63 +32,55 @@
/obj/item/clothing/under/polychromic/update_icon()
..()
cut_overlays()
if(hasprimary)
var/mutable_appearance/primary_overlay = mutable_appearance('modular_citadel/icons/polyclothes/item/uniform.dmi', "[item_color]-primary")
primary_overlay.color = primary_color
add_overlay(primary_overlay)
cut_overlays() //prevents the overlays from infinitely stacking
if(hasprimary) //Checks if the overlay is enabled
var/mutable_appearance/primary_overlay = mutable_appearance('modular_citadel/icons/polyclothes/item/uniform.dmi', "[item_color]-primary") //Automagically picks overlays
primary_overlay.color = primary_color //Colors the greyscaled overlay
add_overlay(primary_overlay) //Applies the coloured overlay onto the item sprite. but NOT the mob sprite.
if(hassecondary)
var/mutable_appearance/secondary_overlay = mutable_appearance('modular_citadel/icons/polyclothes/item/uniform.dmi', "[item_color]-secondary")
secondary_overlay.color = secondary_color
add_overlay(secondary_overlay)
if(hastertiary)
var/mutable_appearance/tertiary_overlay = mutable_appearance('modular_citadel/icons/polyclothes/item/uniform.dmi', "[item_color]-tertiary")
tertiary_overlay.color = tertiary_color
add_overlay(tertiary_overlay)
/obj/item/clothing/under/polychromic/AltClick(mob/living/user)
if(!in_range(src, user)) //Basic checks to prevent abuse
return
if(user.incapacitated() || !istype(user))
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
return
if(!in_range(src, user))
return
if(user.incapacitated() || !istype(user) || !in_range(src, user))
return
var/choice = input(user,"polychromic thread options", "Clothing Recolor") in list("Primary Color","Secondary Color","Tertiary Color","*CANCEL*")
switch(choice)
var/choice = input(user,"polychromic thread options", "Clothing Recolor") as null|anything in list("[hasprimary ? "Primary Color" : ""]", "[hassecondary ? "Secondary Color" : ""]", "[hastertiary ? "Tertiary Color" : ""]") //generates a list depending on the enabled overlays
switch(choice) //Lets the list's options actually lead to something
if("Primary Color")
var/primary_color_input = input(usr,"Choose Primary Color") as color|null
if(primary_color_input)
primary_color = sanitize_hexcolor(primary_color_input, desired_format=6, include_crunch=1)
update_icon()
user.update_inv_w_uniform()
var/primary_color_input = input(usr,"","Choose Primary Color",primary_color) as color|null //color input menu, the "|null" adds a cancel button to it.
if(primary_color_input) //Checks if the color selected is NULL, rejects it if it is NULL.
primary_color = sanitize_hexcolor(primary_color_input, desired_format=6, include_crunch=1) //formats the selected color properly
update_icon() //updates the item icon
user.update_inv_w_uniform() //updates the worn icon
if("Secondary Color")
var/secondary_color_input = input(usr,"Choose Secondary Color") as color|null
var/secondary_color_input = input(usr,"","Choose Secondary Color",secondary_color) as color|null
if(secondary_color_input)
secondary_color = sanitize_hexcolor(secondary_color_input, desired_format=6, include_crunch=1)
update_icon()
user.update_inv_w_uniform()
if("Tertiary Color")
var/tertiary_color_input = input(usr,"Choose Tertiary Color") as color|null
var/tertiary_color_input = input(usr,"","Choose Tertiary Color",tertiary_color) as color|null
if(tertiary_color_input)
tertiary_color = sanitize_hexcolor(tertiary_color_input, desired_format=6, include_crunch=1)
update_icon()
user.update_inv_w_uniform()
/obj/item/clothing/under/polychromic/worn_overlays(isinhands, icon_file)
/obj/item/clothing/under/polychromic/worn_overlays(isinhands, icon_file) //this is where the main magic happens
. = ..()
if(!isinhands)
if(hasprimary)
var/mutable_appearance/primary_worn = mutable_appearance('modular_citadel/icons/polyclothes/mob/uniform.dmi', "[item_color]-primary")
primary_worn.color = primary_color
. += primary_worn
if(!isinhands) //prevents the worn sprites from showing up if you're just holding them
if(hasprimary) //checks if overlays are enabled
var/mutable_appearance/primary_worn = mutable_appearance('modular_citadel/icons/polyclothes/mob/uniform.dmi', "[item_color]-primary") //automagical sprite selection
primary_worn.color = primary_color //colors the overlay
. += primary_worn //adds the overlay onto the buffer list to draw on the mob sprite.
if(hassecondary)
var/mutable_appearance/secondary_worn = mutable_appearance('modular_citadel/icons/polyclothes/mob/uniform.dmi', "[item_color]-secondary")
secondary_worn.color = secondary_color
@@ -86,13 +92,13 @@
/obj/item/clothing/under/polychromic/examine(mob/user)
..()
to_chat(user, "<span class='notice'>Alt-click to recolor it.</span>")
to_chat(user, "<span class='notice'>Alt-click to recolor it.</span>") // so people don't "OOC how do you use polychromic clothes????"
/obj/item/clothing/under/polychromic/Initialize()
..()
update_icon()
update_icon() //Applies the overlays and default colors onto the clothes on spawn.
/obj/item/clothing/under/polychromic/shirt
/obj/item/clothing/under/polychromic/shirt //COPY PASTE THIS TO MAKE A NEW THING
name = "polychromic button-up shirt"
desc = "A fancy button-up shirt made with polychromic threads."
icon_state = "polysuit"
@@ -157,38 +163,16 @@
secondary_color = "#808080"
tertiary_color = "#FF3535"
//replaces the jumpsuit contents of the mixed wardrobe
/obj/structure/closet/wardrobe/mixed/PopulateContents()
if(prob(40))
new /obj/item/clothing/suit/jacket(src)
if(prob(40))
new /obj/item/clothing/suit/jacket(src)
new /obj/item/clothing/under/polychromic/jumpsuit(src)
new /obj/item/clothing/under/polychromic/jumpsuit(src)
new /obj/item/clothing/under/polychromic/jumpsuit(src)
new /obj/item/clothing/under/polychromic/shirt(src)
new /obj/item/clothing/under/polychromic/shirt(src)
new /obj/item/clothing/under/polychromic/shirt(src)
new /obj/item/clothing/under/polychromic/kilt(src)
new /obj/item/clothing/under/polychromic/kilt(src)
new /obj/item/clothing/under/polychromic/kilt(src)
new /obj/item/clothing/under/polychromic/skirt(src)
new /obj/item/clothing/under/polychromic/skirt(src)
new /obj/item/clothing/under/polychromic/skirt(src)
new /obj/item/clothing/under/polychromic/shorts(src)
new /obj/item/clothing/under/polychromic/shorts(src)
new /obj/item/clothing/under/polychromic/shorts(src)
new /obj/item/clothing/mask/bandana/red(src)
new /obj/item/clothing/mask/bandana/red(src)
new /obj/item/clothing/mask/bandana/blue(src)
new /obj/item/clothing/mask/bandana/blue(src)
new /obj/item/clothing/mask/bandana/gold(src)
new /obj/item/clothing/mask/bandana/gold(src)
new /obj/item/clothing/shoes/sneakers/black(src)
new /obj/item/clothing/shoes/sneakers/brown(src)
new /obj/item/clothing/shoes/sneakers/white(src)
if(prob(30))
new /obj/item/clothing/suit/hooded/wintercoat(src)
new /obj/item/clothing/shoes/winterboots(src)
return
/obj/item/clothing/under/polychromic/shortpants
name = "polychromic athletic shorts"
desc = "95% Polychrome, 5% Spandex!"
icon_state = "polyshortpants"
item_color = "polyshortpants"
item_state = "rainbow"
hasprimary = TRUE
hassecondary = TRUE
hastertiary = FALSE
primary_color = "#FFFFFF" //RGB in hexcode
secondary_color = "#F08080"
gender = PLURAL //Because shortS
body_parts_covered = GROIN //Because there's no shirt included
+1 -1
View File
@@ -141,7 +141,7 @@
return
if(alert("Are you sure you want to recolor your armor stripes?", "Confirm Repaint", "Yes", "No") == "Yes")
var/energy_color_input = input(usr,"Choose Energy Color") as color|null
var/energy_color_input = input(usr,"","Choose Energy Color",energy_color) as color|null
if(energy_color_input)
energy_color = sanitize_hexcolor(energy_color_input, desired_format=6, include_crunch=1)
user.update_inv_wear_suit()
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 10 KiB

+5 -3
View File
@@ -2505,7 +2505,6 @@
#include "modular_citadel\citadel_ghostrole_spawners.dm"
#include "modular_citadel\cydonian_armor.dm"
#include "modular_citadel\dresscode_values.dm"
#include "modular_citadel\polychromic_clothes.dm"
#include "modular_citadel\simplemob_vore_values.dm"
#include "modular_citadel\code\init.dm"
#include "modular_citadel\code\__HELPERS\lists.dm"
@@ -2521,17 +2520,19 @@
#include "modular_citadel\code\game\machinery\Sleeper.dm"
#include "modular_citadel\code\game\objects\ids.dm"
#include "modular_citadel\code\game\objects\items\handcuffs.dm"
#include "modular_citadel\code\game\objects\items\circuitboards\machine_circuitboards.dm"
#include "modular_citadel\code\game\objects\items\stunsword.dm"
#include "modular_citadel\code\game\objects\items\circuitboards\machine_circuitboards.dm"
#include "modular_citadel\code\game\objects\items\devices\aicard.dm"
#include "modular_citadel\code\game\objects\items\devices\PDA\PDA.dm"
#include "modular_citadel\code\game\objects\items\devices\radio\shockcollar.dm"
#include "modular_citadel\code\game\objects\items\melee\eutactic_blades.dm"
#include "modular_citadel\code\game\objects\structures\beds_chairs\sofa.dm"
#include "modular_citadel\code\game\objects\structures\crates_lockers\closets\fitness.dm"
#include "modular_citadel\code\game\objects\structures\crates_lockers\closets\wardrobe.dm"
#include "modular_citadel\code\modules\admin\admin.dm"
#include "modular_citadel\code\modules\admin\holder2.dm"
#include "modular_citadel\code\modules\admin\secrets.dm"
#include "modular_citadel\code\modules\admin\topic.dm"
#include "modular_citadel\code\game\objects\structures\beds_chairs\sofa.dm"
#include "modular_citadel\code\modules\cargo\console.dm"
#include "modular_citadel\code\modules\cargo\packs.dm"
#include "modular_citadel\code\modules\client\client_procs.dm"
@@ -2554,6 +2555,7 @@
#include "modular_citadel\code\modules\client\loadout\uniform.dm"
#include "modular_citadel\code\modules\client\verbs\who.dm"
#include "modular_citadel\code\modules\clothing\under.dm"
#include "modular_citadel\code\modules\clothing\under\polychromic_clothes.dm"
#include "modular_citadel\code\modules\clothing\under\turtlenecks.dm"
#include "modular_citadel\code\modules\crafting\recipes.dm"
#include "modular_citadel\code\modules\mentor\follow.dm"