fixes tool colors (#9129)

This commit is contained in:
Wowzewow (Wezzy)
2020-06-14 18:47:02 +02:00
committed by GitHub
parent 1ebc09e0d1
commit 36094ab834
14 changed files with 137 additions and 167 deletions
-46
View File
@@ -483,49 +483,3 @@
/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
+31 -56
View File
@@ -51,7 +51,7 @@
slot_l_hand_str = 'icons/mob/items/lefthand_tools.dmi',
slot_r_hand_str = 'icons/mob/items/righthand_tools.dmi',
)
icon_state = "screwdriver2"
icon_state = "screwdriver"
item_state = "screwdriver"
flags = CONDUCT
slot_flags = SLOT_BELT | SLOT_EARS
@@ -66,25 +66,25 @@
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/build_from_parts = TRUE //if the tool uses random coloring
var/tool_colors = list( //if you're wondering why "blue" = COLOR_BLUE, it's so that inhands work.
"blue" = COLOR_BLUE,
"red" = COLOR_RED,
"purple" = COLOR_PURPLE,
"brown" = COLOR_BROWN,
"green" = COLOR_GREEN,
"cyan" = COLOR_CYAN,
"yellow" = COLOR_YELLOW
)
var/random_icon = TRUE
/obj/item/screwdriver/Initialize()
. = ..()
if(random_color) //random colors!
icon_state = "screwdriver"
if(build_from_parts) //random colors!
var/our_color = pick(tool_colors)
add_atom_colour(tool_colors[our_color])
update_icon()
var/color_hex = tool_colors[our_color]
color = color_hex
item_state = "[initial(icon_state)]-[our_color]" // hardcoded. sucks, but inhands are hard and I can't be bothered.
add_overlay(overlay_image(icon, "[initial(icon_state)]_head", flags=RESET_COLOR))
/obj/item/screwdriver/update_icon()
var/matrix/tf = matrix()
@@ -93,13 +93,6 @@
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)
/obj/item/screwdriver/pickup(mob/user)
..()
update_icon()
@@ -112,13 +105,6 @@
..()
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")
return ..()
@@ -143,6 +129,7 @@
slot_r_hand_str = 'icons/mob/items/righthand_tools.dmi',
)
icon_state = "wirecutters"
item_state = "wirecutters"
flags = CONDUCT
slot_flags = SLOT_BELT
force = 6
@@ -157,23 +144,25 @@
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
var/build_from_parts = TRUE
var/tool_colors = list(
"blue" = COLOR_BLUE,
"red" = COLOR_RED,
"purple" = COLOR_PURPLE,
"brown" = COLOR_BROWN,
"green" = COLOR_GREEN,
"cyan" = COLOR_CYAN,
"yellow" = COLOR_YELLOW
)
/obj/item/wirecutters/Initialize()
. = ..()
if(random_color) //random colors!
if(build_from_parts)
var/our_color = pick(tool_colors)
add_atom_colour(tool_colors[our_color])
update_icon()
var/color_hex = tool_colors[our_color]
color = color_hex
item_state = "[initial(icon_state)]-[our_color]" // hardcoded. sucks, but inhands are hard and I can't be bothered.
add_overlay(overlay_image(icon, "[initial(icon_state)]_head", flags=RESET_COLOR))
/obj/item/wirecutters/update_icon()
var/matrix/tf = matrix()
@@ -182,13 +171,6 @@
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()
@@ -201,13 +183,6 @@
..()
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)))
user.visible_message(SPAN_NOTICE("\The [user] cuts \the [C]'s restraints with \the [src]!"),\
@@ -819,4 +794,4 @@
to_chat(user, "You switch \the [src] to the [tool] fitting.")
playsound(loc, 'sound/items/change_drill.ogg', 50, 1)
update_tool()
return TRUE
return TRUE
+1 -1
View File
@@ -10,7 +10,7 @@
)
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
build_from_parts = FALSE
/obj/item/wirecutters/clippers/update_icon()
var/matrix/tf = matrix()
@@ -119,6 +119,12 @@ There are several things that need to be remembered:
#define GET_BODY_TYPE (cached_bodytype || (cached_bodytype = species.get_bodytype()))
#define GET_TAIL_LAYER (dir == NORTH ? TAIL_NORTH_LAYER : TAIL_SOUTH_LAYER)
/proc/overlay_image(icon,icon_state,color,flags)
var/image/ret = image(icon,icon_state)
ret.color = color
ret.appearance_flags = flags
return ret
/mob/living/carbon/human
var/list/overlays_raw[TOTAL_LAYERS] // Our set of "raw" overlays that can be modified, but cannot be directly applied to the mob without preprocessing.
var/previous_damage_appearance // store what the body last looked like, so we only have to update it if something changed
@@ -380,13 +380,15 @@
/obj/item/screwdriver/robotic
icon = 'icons/obj/robot_items.dmi'
icon_state = "screwdriver"
random_color = FALSE
build_from_parts = FALSE
/obj/item/device/multitool/robotic
icon = 'icons/obj/robot_items.dmi'
/obj/item/wirecutters/robotic
icon = 'icons/obj/robot_items.dmi'
icon_state = "wirecutters"
build_from_parts = FALSE
/obj/item/weldingtool/robotic
icon = 'icons/obj/robot_items.dmi'
+49 -61
View File
@@ -21,17 +21,6 @@ If d1 = 0 and d2 = dir, it's a O-X cable, getting from the center of the tile to
If d1 = dir1 and d2 = dir2, it's a full X-X cable, getting from dir1 to dir2
By design, d1 is the smallest direction and d2 is the highest
*/
var/list/possible_cable_coil_colours = list(
"Yellow" = COLOR_YELLOW,
"Green" = COLOR_LIME,
"Pink" = COLOR_PINK,
"Blue" = COLOR_BLUE,
"Orange" = COLOR_ORANGE,
"Cyan" = COLOR_CYAN,
"Red" = COLOR_RED
)
/obj/structure/cable
level = 1
anchored =1
@@ -470,12 +459,12 @@ obj/structure/cable/proc/cableColor(var/colorC)
#define MAXCOIL 30
/obj/item/stack/cable_coil
name = "cable coil"
name = "power cable"
icon = 'icons/obj/power.dmi'
icon_state = "coil"
amount = MAXCOIL
max_amount = MAXCOIL
var/our_color = COLOR_RED
var/our_color = "Red"
desc = "A coil of power cable."
throwforce = 10
w_class = 2.0
@@ -489,17 +478,18 @@ obj/structure/cable/proc/cableColor(var/colorC)
stacktype = /obj/item/stack/cable_coil
drop_sound = 'sound/items/drop/accessory.ogg'
pickup_sound = 'sound/items/pickup/accessory.ogg'
var/list/possible_cable_coil_colours = list(
"Yellow" = COLOR_YELLOW,
"Green" = COLOR_LIME,
"Pink" = COLOR_PINK,
"Blue" = COLOR_BLUE,
"Orange" = COLOR_ORANGE,
"Cyan" = COLOR_CYAN,
"Red" = COLOR_RED
)
/obj/item/stack/cable_coil/Initialize(mapload, amt, param_color = null)
/obj/item/stack/cable_coil/Initialize(mapload, amt)
. = ..(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.
our_color = param_color
pixel_x = rand(-2,2)
pixel_y = rand(-2,2)
update_icon()
@@ -601,27 +591,23 @@ 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()
name = "[initial(name)]"
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)
icon_state = "[initial(icon_state)]1"
name += " piece"
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)
icon_state = "[initial(icon_state)]2"
name += " piece"
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)
icon_state = "[initial(icon_state)]"
name += " coil"
overlays.Cut()
add_overlay(overlay_image(icon, "[icon_state]_end", flags=RESET_COLOR))
if(our_color)
var/color_hex = possible_cable_coil_colours[our_color]
color = color_hex
item_state = "coil-[our_color]"
update_held_icon()
/obj/item/stack/cable_coil/attackby(var/obj/item/W, var/mob/user)
if(W.ismultitool())
@@ -632,15 +618,14 @@ obj/structure/cable/proc/cableColor(var/colorC)
var/selected_type = input("Pick new colour.", "Cable Colour", null, null) as null|anything in possible_cable_coil_colours
set_cable_color(selected_type, usr)
/obj/item/stack/cable_coil/proc/set_cable_color(var/selected_color, var/user)
/obj/item/stack/cable_coil/proc/set_cable_color(selected_color, var/user)
if(!selected_color)
return
var/final_color = possible_cable_coil_colours[selected_color]
if(!final_color)
final_color = possible_cable_coil_colours["Red"]
selected_color = "red"
our_color = final_color
our_color = selected_color
if(!our_color)
our_color = "Red"
update_icon()
to_chat(user, "<span class='notice'>You change \the [src]'s color to [lowertext(selected_color)].</span>")
/obj/item/stack/cable_coil/proc/update_wclass()
@@ -727,6 +712,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
// called when cable_coil is clicked on a turf/simulated/floor
/obj/item/stack/cable_coil/proc/turf_place(turf/F, mob/user)
var/color_hex = possible_cable_coil_colours[our_color]
if(!isturf(user.loc))
return
@@ -768,7 +754,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(our_color)
C.cableColor(color_hex)
C.d1 = 11
C.d2 = dirn
@@ -781,7 +767,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
C.mergeConnectedNetworks(C.d2)
C.mergeConnectedNetworksOnTurf()
D.cableColor(color)
D.cableColor(color_hex)
D.d1 = 12
D.d2 = 0
@@ -801,7 +787,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
var/obj/structure/cable/C = new(F)
C.cableColor(our_color)
C.cableColor(color_hex)
//set up the new cable
C.d1 = 0 //it's a O-X node cable
@@ -829,6 +815,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
// called when cable_coil is click on an installed obj/cable
// or click on a turf that already contains a "node" cable
/obj/item/stack/cable_coil/proc/cable_join(obj/structure/cable/C, mob/user)
var/color_hex = possible_cable_coil_colours[our_color]
var/turf/U = user.loc
if(!isturf(U))
return
@@ -866,7 +853,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
return
var/obj/structure/cable/NC = new(U)
NC.cableColor(our_color)
NC.cableColor(color_hex)
NC.d1 = 0
NC.d2 = fdirn
@@ -912,7 +899,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
return
C.cableColor(our_color)
C.cableColor(color_hex)
C.d1 = nd1
C.d2 = nd2
@@ -958,32 +945,33 @@ obj/structure/cable/proc/cableColor(var/colorC)
update_wclass()
/obj/item/stack/cable_coil/yellow
our_color = COLOR_YELLOW
our_color = "Yellow"
/obj/item/stack/cable_coil/blue
our_color = COLOR_BLUE
our_color = "Blue"
/obj/item/stack/cable_coil/green
our_color = COLOR_LIME
our_color = "Green"
/obj/item/stack/cable_coil/pink
our_color = COLOR_PINK
our_color = "Pink"
/obj/item/stack/cable_coil/orange
our_color = COLOR_ORANGE
our_color = "Orange"
/obj/item/stack/cable_coil/cyan
our_color = COLOR_CYAN
our_color = "Cyan"
/obj/item/stack/cable_coil/white
our_color = COLOR_WHITE
our_color = "White"
/obj/item/stack/cable_coil/random/Initialize()
our_color = pick(COLOR_RED, COLOR_BLUE, COLOR_LIME, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN)
our_color = pick(possible_cable_coil_colours)
. = ..()
//nooses - all catbeast/ligger/squiggers/synths must hang
//////////////////////////////
// Nooses.
/////////////////////////////
/obj/item/stack/cable_coil/verb/make_noose()
set name = "Make Noose"
set category = "Object"
+5 -2
View File
@@ -1,7 +1,10 @@
/obj/item/stack/cable_coil/heavyduty
name = "heavy cable coil"
name = "heavy-duty power cable"
desc = "A tough, heavy-duty coil of power cable."
icon = 'icons/obj/power.dmi'
our_color = null
icon_state = "wire"
item_state = "wire"
/obj/structure/cable/heavyduty
icon = 'icons/obj/power_cond_heavy.dmi'
@@ -25,4 +28,4 @@
..()
/obj/structure/cable/heavyduty/cableColor(var/colorC)
return
return
+42
View File
@@ -0,0 +1,42 @@
################################
# 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:
- bugfix: "Fixes invisible red crowbars."
- bugfix: "Fixes cable coil and tool colors."
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB