diff --git a/code/__defines/misc.dm b/code/__defines/misc.dm
index 1e622cb16e2..08d131d6da8 100644
--- a/code/__defines/misc.dm
+++ b/code/__defines/misc.dm
@@ -149,7 +149,7 @@
#define WALL_CAN_OPEN 1
#define WALL_OPENING 2
-#define MIN_DAMAGE_TO_HIT 15 //Minimum damage needed to dent walls and girders by hitting them with a weapon.
+#define MIN_DAMAGE_TO_HIT 15 //Minimum damage needed to dent walls and girders by hitting them with a weapon.
#define DEFAULT_TABLE_MATERIAL "plastic"
#define DEFAULT_WALL_MATERIAL "steel"
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index 8beeab22130..80afc036860 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -20,6 +20,9 @@
///Chemistry.
var/datum/reagents/reagents = null
+ var/list/atom_colours //used to store the different colors on an atom
+ //its inherent color, the colored paint applied on it, special color effect etc...
+
//var/chem_is_open_container = 0
// replaced by OPENCONTAINER flags and atom/proc/is_open_container()
///Chemistry.
@@ -480,3 +483,49 @@
/atom/movable/onDropInto(var/atom/movable/AM)
return loc // If onDropInto returns something, then dropInto will attempt to drop AM there.
+
+/*
+ Atom Colour Priority System
+ A System that gives finer control over which atom colour to colour the atom with.
+ The "highest priority" one is always displayed as opposed to the default of
+ "whichever was set last is displayed"
+*/
+
+
+/*
+ Adds an instance of colour_type to the atom's atom_colours list
+*/
+/atom/proc/add_atom_colour(coloration)
+ if(!atom_colours || !atom_colours.len)
+ atom_colours = list()
+ if(!coloration)
+ return
+ update_atom_colour()
+
+
+/*
+ Removes an instance of colour_type from the atom's atom_colours list
+*/
+/atom/proc/remove_atom_colour(coloration)
+ if(!atom_colours)
+ atom_colours = list()
+ update_atom_colour()
+
+
+/*
+ Resets the atom's color to null, and then sets it to the highest priority
+ colour available
+*/
+/atom/proc/update_atom_colour()
+ if(!atom_colours)
+ atom_colours = list()
+ color = null
+ for(var/C in atom_colours)
+ if(islist(C))
+ var/list/L = C
+ if(L.len)
+ color = L
+ return
+ else if(C)
+ color = C
+ return
diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm
index b7bac596af4..92c54a83ca9 100644
--- a/code/game/objects/items/weapons/tools.dm
+++ b/code/game/objects/items/weapons/tools.dm
@@ -55,7 +55,6 @@
item_state = "screwdriver"
flags = CONDUCT
slot_flags = SLOT_BELT | SLOT_EARS
- center_of_mass = list("x" = 13,"y" = 7)
force = 8
throwforce = 5
throw_speed = 3
@@ -67,38 +66,58 @@
drop_sound = 'sound/items/drop/screwdriver.ogg'
pickup_sound = 'sound/items/pickup/screwdriver.ogg'
lock_picking_level = 5
+ var/random_color = TRUE //if the tool uses random coloring
+ var/static/list/tool_colors = list(
+ COLOR_BLUE,
+ COLOR_RED,
+ COLOR_PINK,
+ COLOR_BROWN,
+ COLOR_GREEN,
+ COLOR_CYAN,
+ COLOR_YELLOW
+ )
var/random_icon = TRUE
/obj/item/screwdriver/Initialize()
. = ..()
- if(!random_icon)
+ if(random_color) //random colors!
+ icon_state = "screwdriver"
+ var/our_color = pick(tool_colors)
+ add_atom_colour(tool_colors[our_color])
+ update_icon()
+
+/obj/item/screwdriver/update_icon()
+ var/matrix/tf = matrix()
+ if(istype(loc, /obj/item/storage))
+ tf.Turn(-90) //Vertical for storing compactly
+ tf.Translate(-3,0) //Could do this with pixel_x but let's just update the appearance once.
+ transform = tf
+
+ if(!random_color) //icon override
return
+ cut_overlays()
+ var/mutable_appearance/base_overlay = mutable_appearance(icon, "[icon_state]_head")
+ base_overlay.appearance_flags = RESET_COLOR
+ add_overlay(base_overlay)
- switch(pick("red","blue","purple","brown","green","cyan","yellow"))
- if ("red")
- icon_state = "screwdriver2"
- item_state = "screwdriver"
- if ("blue")
- icon_state = "screwdriver"
- item_state = "screwdriver_blue"
- if ("purple")
- icon_state = "screwdriver3"
- item_state = "screwdriver_purple"
- if ("brown")
- icon_state = "screwdriver4"
- item_state = "screwdriver_brown"
- if ("green")
- icon_state = "screwdriver5"
- item_state = "screwdriver_green"
- if ("cyan")
- icon_state = "screwdriver6"
- item_state = "screwdriver_cyan"
- if ("yellow")
- icon_state = "screwdriver7"
- item_state = "screwdriver_yellow"
+/obj/item/screwdriver/pickup(mob/user)
+ ..()
+ update_icon()
- if (prob(75))
- src.pixel_y = rand(0, 16)
+/obj/item/screwdriver/dropped(mob/user)
+ ..()
+ update_icon()
+
+/obj/item/screwdriver/attack_hand()
+ ..()
+ update_icon()
+
+/obj/item/screwdriver/worn_overlays()
+ . = list()
+ if(random_color)
+ var/mutable_appearance/M = mutable_appearance(icon, "[icon_state]_head")
+ M.appearance_flags = RESET_COLOR
+ . += M
/obj/item/screwdriver/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob, var/target_zone)
if(!istype(M) || user.a_intent == "help")
@@ -123,10 +142,8 @@
slot_l_hand_str = 'icons/mob/items/lefthand_tools.dmi',
slot_r_hand_str = 'icons/mob/items/righthand_tools.dmi',
)
- icon_state = "cutters"
- item_state = "cutters"
+ icon_state = "wirecutters"
flags = CONDUCT
- center_of_mass = list("x" = 18,"y" = 10)
slot_flags = SLOT_BELT
force = 6
throw_speed = 2
@@ -140,12 +157,56 @@
drop_sound = 'sound/items/drop/wirecutter.ogg'
pickup_sound = 'sound/items/pickup/wirecutter.ogg'
var/bomb_defusal_chance = 30 // 30% chance to safely defuse a bomb
+ var/random_color = TRUE
+ var/static/list/tool_colors = list(
+ COLOR_BLUE,
+ COLOR_RED,
+ COLOR_PINK,
+ COLOR_BROWN,
+ COLOR_GREEN,
+ COLOR_CYAN,
+ COLOR_YELLOW
+ )
-/obj/item/wirecutters/New()
- if(prob(50))
- icon_state = "cutters-y"
- item_state = "cutters_yellow"
+/obj/item/wirecutters/Initialize()
+ . = ..()
+ if(random_color) //random colors!
+ var/our_color = pick(tool_colors)
+ add_atom_colour(tool_colors[our_color])
+ update_icon()
+
+/obj/item/wirecutters/update_icon()
+ var/matrix/tf = matrix()
+ if(istype(loc, /obj/item/storage))
+ tf.Turn(-90) //Vertical for storing compactly
+ tf.Translate(-1,0) //Could do this with pixel_x but let's just update the appearance once.
+ transform = tf
+
+ if(!random_color) //icon override
+ return
+ cut_overlays()
+ var/mutable_appearance/base_overlay = mutable_appearance(icon, "[icon_state]_head")
+ base_overlay.appearance_flags = RESET_COLOR
+ add_overlay(base_overlay)
+
+/obj/item/wirecutters/pickup(mob/user)
..()
+ update_icon()
+
+/obj/item/wirecutters/dropped(mob/user)
+ ..()
+ update_icon()
+
+/obj/item/wirecutters/attack_hand()
+ ..()
+ update_icon()
+
+/obj/item/wirecutters/worn_overlays()
+ . = list()
+ if(random_color)
+ var/mutable_appearance/M = mutable_appearance(icon, "[icon_state]_head")
+ M.appearance_flags = RESET_COLOR
+ . += M
/obj/item/wirecutters/attack(mob/living/carbon/C, mob/user, var/target_zone)
if(user.a_intent == I_HELP && (C.handcuffed) && (istype(C.handcuffed, /obj/item/handcuffs/cable)))
@@ -166,16 +227,10 @@
/obj/item/wirecutters/bomb
name = "bomb defusal wirecutters"
desc = "A tool used to delicately sever the wires used in bomb fuses."
- icon_state = "mini_wirecutter"
+ icon_state = "mini_wirecutters"
toolspeed = 0.6
bomb_defusal_chance = 90 // 90% chance, because the thrill of dying must be kept at all times, duh
-/obj/item/wirecutters/bomb/Initialize()
- . = ..()
- if(prob(50))
- icon_state = "[initial(icon_state)]-yellow"
- item_state = "[initial(icon_state)]_yellow"
-
/*
* Welding Tool
*/
diff --git a/code/modules/hydroponics/trays/tray_tools.dm b/code/modules/hydroponics/trays/tray_tools.dm
index c7ae479df94..87eab67a8df 100644
--- a/code/modules/hydroponics/trays/tray_tools.dm
+++ b/code/modules/hydroponics/trays/tray_tools.dm
@@ -3,8 +3,33 @@
/obj/item/wirecutters/clippers
name = "plant clippers"
desc = "A tool used to take samples from plants."
+ icon_state = "plantclippers"
+ item_icons = list(
+ slot_l_hand_str = 'icons/mob/items/lefthand_hydro.dmi',
+ slot_r_hand_str = 'icons/mob/items/righthand_hydro.dmi',
+ )
toolspeed = 0.7
bomb_defusal_chance = 40 // 40% chance to successfully defuse a bomb, higher than standard because plant clippers are smaller
+ random_color = FALSE
+
+/obj/item/wirecutters/clippers/update_icon()
+ var/matrix/tf = matrix()
+ if(istype(loc, /obj/item/storage))
+ tf.Turn(-90) //Vertical for storing compactly
+ tf.Translate(-1,0) //Could do this with pixel_x but let's just update the appearance once.
+ transform = tf
+
+/obj/item/wirecutters/pickup(mob/user)
+ ..()
+ update_icon()
+
+/obj/item/wirecutters/dropped(mob/user)
+ ..()
+ update_icon()
+
+/obj/item/wirecutters/attack_hand()
+ ..()
+ update_icon()
/obj/item/device/analyzer/plant_analyzer
name = "plant analyzer"
diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm
index 4288b38a1a1..2048774cbbc 100644
--- a/code/modules/mob/living/carbon/human/update_icons.dm
+++ b/code/modules/mob/living/carbon/human/update_icons.dm
@@ -218,6 +218,12 @@ There are several things that need to be remembered:
if(update_icons)
update_icons()
+//Overlays for the worn overlay so you can overlay while you overlay
+//eg: ammo counters, primed grenade flashing, etc.
+//"item_icons" is used automatically for inhands etc. to make sure it gets the correct inhand file
+/obj/item/proc/worn_overlays(item_icons)
+ . = list()
+
//BASE MOB SPRITE
/mob/living/carbon/human/proc/update_body(var/update_icons=1)
if (QDELING(src))
diff --git a/code/modules/mob/living/silicon/robot/robot_items.dm b/code/modules/mob/living/silicon/robot/robot_items.dm
index d64b4464516..d9b07037a20 100644
--- a/code/modules/mob/living/silicon/robot/robot_items.dm
+++ b/code/modules/mob/living/silicon/robot/robot_items.dm
@@ -380,7 +380,7 @@
/obj/item/screwdriver/robotic
icon = 'icons/obj/robot_items.dmi'
icon_state = "screwdriver"
- random_icon = FALSE
+ random_color = FALSE
/obj/item/device/multitool/robotic
icon = 'icons/obj/robot_items.dmi'
@@ -389,4 +389,4 @@
icon = 'icons/obj/robot_items.dmi'
/obj/item/weldingtool/robotic
- icon = 'icons/obj/robot_items.dmi'
\ No newline at end of file
+ icon = 'icons/obj/robot_items.dmi'
diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm
index 0625552e195..1c3719e8d12 100644
--- a/code/modules/power/cable.dm
+++ b/code/modules/power/cable.dm
@@ -475,7 +475,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
icon_state = "coil"
amount = MAXCOIL
max_amount = MAXCOIL
- color = COLOR_RED
+ var/our_color = COLOR_RED
desc = "A coil of power cable."
throwforce = 10
w_class = 2.0
@@ -492,9 +492,13 @@ obj/structure/cable/proc/cableColor(var/colorC)
/obj/item/stack/cable_coil/Initialize(mapload, amt, param_color = null)
. = ..(mapload, amt)
+ icon_state = "coil"
+ our_color = pick(possible_cable_coil_colours)
+ add_atom_colour(possible_cable_coil_colours[our_color])
+ update_icon()
if (param_color) // It should be red by default, so only recolor it if parameter was specified.
- color = param_color
+ our_color = param_color
pixel_x = rand(-2,2)
pixel_y = rand(-2,2)
@@ -597,17 +601,27 @@ obj/structure/cable/proc/cableColor(var/colorC)
to_chat(user, span("warning", "You don't have enough cable for this!"))
/obj/item/stack/cable_coil/update_icon()
- if (!color)
- color = pick(COLOR_RED, COLOR_BLUE, COLOR_LIME, COLOR_ORANGE, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN)
if(amount == 1)
icon_state = "coil1"
name = "cable piece"
+ cut_overlays()
+ var/mutable_appearance/base_overlay = mutable_appearance(icon, "coil1_end")
+ base_overlay.appearance_flags = RESET_COLOR
+ add_overlay(base_overlay)
else if(amount == 2)
icon_state = "coil2"
name = "cable piece"
+ cut_overlays()
+ var/mutable_appearance/base_overlay = mutable_appearance(icon, "coil2_end")
+ base_overlay.appearance_flags = RESET_COLOR
+ add_overlay(base_overlay)
else
icon_state = "coil"
name = "cable coil"
+ cut_overlays()
+ var/mutable_appearance/base_overlay = mutable_appearance(icon, "coil_end")
+ base_overlay.appearance_flags = RESET_COLOR
+ add_overlay(base_overlay)
/obj/item/stack/cable_coil/attackby(var/obj/item/W, var/mob/user)
if(W.ismultitool())
@@ -626,7 +640,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
if(!final_color)
final_color = possible_cable_coil_colours["Red"]
selected_color = "red"
- color = final_color
+ our_color = final_color
to_chat(user, "You change \the [src]'s color to [lowertext(selected_color)].")
/obj/item/stack/cable_coil/proc/update_wclass()
@@ -660,7 +674,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
to_chat(usr, "You need at least 15 lengths to make restraints!")
return
var/obj/item/handcuffs/cable/B = new /obj/item/handcuffs/cable(usr.loc)
- B.color = color
+ B.color = our_color
to_chat(usr, "You wind some cable together to make some restraints.")
src.use(15)
else
@@ -754,7 +768,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
var/obj/structure/cable/C = new(F)
var/obj/structure/cable/D = new(GetBelow(F))
- C.cableColor(color)
+ C.cableColor(our_color)
C.d1 = 11
C.d2 = dirn
@@ -787,7 +801,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
var/obj/structure/cable/C = new(F)
- C.cableColor(color)
+ C.cableColor(our_color)
//set up the new cable
C.d1 = 0 //it's a O-X node cable
@@ -852,7 +866,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
return
var/obj/structure/cable/NC = new(U)
- NC.cableColor(color)
+ NC.cableColor(our_color)
NC.d1 = 0
NC.d2 = fdirn
@@ -898,7 +912,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
return
- C.cableColor(color)
+ C.cableColor(our_color)
C.d1 = nd1
C.d2 = nd2
@@ -944,28 +958,28 @@ obj/structure/cable/proc/cableColor(var/colorC)
update_wclass()
/obj/item/stack/cable_coil/yellow
- color = COLOR_YELLOW
+ our_color = COLOR_YELLOW
/obj/item/stack/cable_coil/blue
- color = COLOR_BLUE
+ our_color = COLOR_BLUE
/obj/item/stack/cable_coil/green
- color = COLOR_LIME
+ our_color = COLOR_LIME
/obj/item/stack/cable_coil/pink
- color = COLOR_PINK
+ our_color = COLOR_PINK
/obj/item/stack/cable_coil/orange
- color = COLOR_ORANGE
+ our_color = COLOR_ORANGE
/obj/item/stack/cable_coil/cyan
- color = COLOR_CYAN
+ our_color = COLOR_CYAN
/obj/item/stack/cable_coil/white
- color = COLOR_WHITE
+ our_color = COLOR_WHITE
/obj/item/stack/cable_coil/random/Initialize()
- color = pick(COLOR_RED, COLOR_BLUE, COLOR_LIME, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN)
+ our_color = pick(COLOR_RED, COLOR_BLUE, COLOR_LIME, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN)
. = ..()
//nooses - all catbeast/ligger/squiggers/synths must hang
diff --git a/html/changelogs/wezzy_tool_color_refactor.yml b/html/changelogs/wezzy_tool_color_refactor.yml
new file mode 100644
index 00000000000..17baefa1aa3
--- /dev/null
+++ b/html/changelogs/wezzy_tool_color_refactor.yml
@@ -0,0 +1,41 @@
+################################
+# 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
+# balance
+# admin
+# backend
+# security
+# refactor
+#################################
+
+# Your name.
+author: Wowzewow (Wezzy)
+
+# 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:
+ - imageadd: "New icons for wirecutters and screwdrivers! Also they fit better in your backpacks."
diff --git a/icons/mob/items/lefthand_hydro.dmi b/icons/mob/items/lefthand_hydro.dmi
index 742fd7ac72d..59498ec649f 100644
Binary files a/icons/mob/items/lefthand_hydro.dmi and b/icons/mob/items/lefthand_hydro.dmi differ
diff --git a/icons/mob/items/lefthand_tools.dmi b/icons/mob/items/lefthand_tools.dmi
index a51ad223191..60e94c5383b 100644
Binary files a/icons/mob/items/lefthand_tools.dmi and b/icons/mob/items/lefthand_tools.dmi differ
diff --git a/icons/mob/items/righthand_hydro.dmi b/icons/mob/items/righthand_hydro.dmi
index b80426213a5..142c37fbb82 100644
Binary files a/icons/mob/items/righthand_hydro.dmi and b/icons/mob/items/righthand_hydro.dmi differ
diff --git a/icons/mob/items/righthand_tools.dmi b/icons/mob/items/righthand_tools.dmi
index 874e737c9fe..a7c4bc03f44 100644
Binary files a/icons/mob/items/righthand_tools.dmi and b/icons/mob/items/righthand_tools.dmi differ
diff --git a/icons/mob/items/stacks/lefthand_materials.dmi b/icons/mob/items/stacks/lefthand_materials.dmi
index c0d3e80df78..005111c153b 100644
Binary files a/icons/mob/items/stacks/lefthand_materials.dmi and b/icons/mob/items/stacks/lefthand_materials.dmi differ
diff --git a/icons/mob/items/stacks/righthand_materials.dmi b/icons/mob/items/stacks/righthand_materials.dmi
index d1439af0a2b..0380e1061f1 100644
Binary files a/icons/mob/items/stacks/righthand_materials.dmi and b/icons/mob/items/stacks/righthand_materials.dmi differ
diff --git a/icons/obj/items.dmi b/icons/obj/items.dmi
index 52ddf886cb1..03183a200d8 100644
Binary files a/icons/obj/items.dmi and b/icons/obj/items.dmi differ
diff --git a/icons/obj/power.dmi b/icons/obj/power.dmi
index 68c2fa42efb..a905de431fc 100644
Binary files a/icons/obj/power.dmi and b/icons/obj/power.dmi differ
diff --git a/icons/obj/tools.dmi b/icons/obj/tools.dmi
index 8e9f572d641..c937b9f967e 100644
Binary files a/icons/obj/tools.dmi and b/icons/obj/tools.dmi differ