mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Colored Cable Fix
- Cables are now properly colored when placing them with colored cable coil (instead of always making red cable) - Removed duplicate definition of color (color and item_color), only var color is now used. That probably caused this issue in first place.
This commit is contained in:
@@ -207,7 +207,8 @@
|
|||||||
icon_state = "coil"
|
icon_state = "coil"
|
||||||
amount = MAXCOIL
|
amount = MAXCOIL
|
||||||
max_amount = MAXCOIL
|
max_amount = MAXCOIL
|
||||||
item_color = COLOR_RED
|
color = COLOR_RED
|
||||||
|
//item_color = COLOR_RED Use regular "color" var instead. No need to have it duplicate in two vars. Causes confusion.
|
||||||
desc = "A coil of power cable."
|
desc = "A coil of power cable."
|
||||||
throwforce = 10
|
throwforce = 10
|
||||||
w_class = 2.0
|
w_class = 2.0
|
||||||
@@ -227,10 +228,8 @@
|
|||||||
/obj/item/stack/cable_coil/New(loc, length = MAXCOIL, var/param_color = null)
|
/obj/item/stack/cable_coil/New(loc, length = MAXCOIL, var/param_color = null)
|
||||||
..()
|
..()
|
||||||
src.amount = length
|
src.amount = length
|
||||||
if (param_color)
|
if (param_color) // It should be red by default, so only recolor it if parameter was specified.
|
||||||
color = param_color
|
color = param_color
|
||||||
else
|
|
||||||
color = item_color
|
|
||||||
pixel_x = rand(-2,2)
|
pixel_x = rand(-2,2)
|
||||||
pixel_y = rand(-2,2)
|
pixel_y = rand(-2,2)
|
||||||
updateicon()
|
updateicon()
|
||||||
@@ -239,7 +238,6 @@
|
|||||||
/obj/item/stack/cable_coil/proc/updateicon()
|
/obj/item/stack/cable_coil/proc/updateicon()
|
||||||
if (!color)
|
if (!color)
|
||||||
color = pick(COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_ORANGE, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN)
|
color = pick(COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_ORANGE, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN)
|
||||||
item_color = color
|
|
||||||
if(amount == 1)
|
if(amount == 1)
|
||||||
icon_state = "coil1"
|
icon_state = "coil1"
|
||||||
name = "cable piece"
|
name = "cable piece"
|
||||||
@@ -277,7 +275,7 @@
|
|||||||
usr << "<span class='warning'>You need at least 15 lengths to make restraints!</span>"
|
usr << "<span class='warning'>You need at least 15 lengths to make restraints!</span>"
|
||||||
return
|
return
|
||||||
var/obj/item/weapon/handcuffs/cable/B = new /obj/item/weapon/handcuffs/cable(usr.loc)
|
var/obj/item/weapon/handcuffs/cable/B = new /obj/item/weapon/handcuffs/cable(usr.loc)
|
||||||
B.color = item_color
|
B.color = color
|
||||||
usr << "<span class='notice'>You wind some cable together to make some restraints.</span>"
|
usr << "<span class='notice'>You wind some cable together to make some restraints.</span>"
|
||||||
src.use(15)
|
src.use(15)
|
||||||
else
|
else
|
||||||
@@ -287,7 +285,7 @@
|
|||||||
/obj/item/stack/cable_coil/attackby(obj/item/weapon/W, mob/user)
|
/obj/item/stack/cable_coil/attackby(obj/item/weapon/W, mob/user)
|
||||||
if( istype(W, /obj/item/weapon/wirecutters) && src.amount > 1)
|
if( istype(W, /obj/item/weapon/wirecutters) && src.amount > 1)
|
||||||
src.amount--
|
src.amount--
|
||||||
new/obj/item/stack/cable_coil(user.loc, 1,item_color)
|
new/obj/item/stack/cable_coil(user.loc, 1,color)
|
||||||
user << "<span class='notice'>You cut a piece off the cable coil.</span>"
|
user << "<span class='notice'>You cut a piece off the cable coil.</span>"
|
||||||
src.updateicon()
|
src.updateicon()
|
||||||
src.update_wclass()
|
src.update_wclass()
|
||||||
@@ -375,7 +373,7 @@
|
|||||||
var/obj/structure/cable/C = new(F)
|
var/obj/structure/cable/C = new(F)
|
||||||
var/obj/structure/cable/D = new(temp.floorbelow)
|
var/obj/structure/cable/D = new(temp.floorbelow)
|
||||||
|
|
||||||
C.cableColor(item_color)
|
C.cableColor(color)
|
||||||
|
|
||||||
C.d1 = 11
|
C.d1 = 11
|
||||||
C.d2 = dirn
|
C.d2 = dirn
|
||||||
@@ -389,7 +387,7 @@
|
|||||||
C.mergeConnectedNetworks(C.d2)
|
C.mergeConnectedNetworks(C.d2)
|
||||||
C.mergeConnectedNetworksOnTurf()
|
C.mergeConnectedNetworksOnTurf()
|
||||||
|
|
||||||
D.cableColor(item_color)
|
D.cableColor(color)
|
||||||
|
|
||||||
D.d1 = 12
|
D.d1 = 12
|
||||||
D.d2 = 0
|
D.d2 = 0
|
||||||
@@ -412,7 +410,7 @@
|
|||||||
|
|
||||||
var/obj/structure/cable/C = new(F)
|
var/obj/structure/cable/C = new(F)
|
||||||
|
|
||||||
C.cableColor(item_color)
|
C.cableColor(color)
|
||||||
|
|
||||||
C.d1 = 0
|
C.d1 = 0
|
||||||
C.d2 = dirn
|
C.d2 = dirn
|
||||||
@@ -475,7 +473,7 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
var/obj/structure/cable/NC = new(U)
|
var/obj/structure/cable/NC = new(U)
|
||||||
NC.cableColor(item_color)
|
NC.cableColor(color)
|
||||||
|
|
||||||
NC.d1 = 0
|
NC.d1 = 0
|
||||||
NC.d2 = fdirn
|
NC.d2 = fdirn
|
||||||
@@ -513,7 +511,7 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
C.cableColor(item_color)
|
C.cableColor(color)
|
||||||
|
|
||||||
C.d1 = nd1
|
C.d1 = nd1
|
||||||
C.d2 = nd2
|
C.d2 = nd2
|
||||||
@@ -619,28 +617,28 @@ obj/structure/cable/proc/cableColor(var/colorC)
|
|||||||
update_wclass()
|
update_wclass()
|
||||||
|
|
||||||
/obj/item/stack/cable_coil/yellow
|
/obj/item/stack/cable_coil/yellow
|
||||||
item_color = COLOR_YELLOW
|
color = COLOR_YELLOW
|
||||||
|
|
||||||
/obj/item/stack/cable_coil/blue
|
/obj/item/stack/cable_coil/blue
|
||||||
item_color = COLOR_BLUE
|
color = COLOR_BLUE
|
||||||
|
|
||||||
/obj/item/stack/cable_coil/green
|
/obj/item/stack/cable_coil/green
|
||||||
item_color = COLOR_GREEN
|
color = COLOR_GREEN
|
||||||
|
|
||||||
/obj/item/stack/cable_coil/pink
|
/obj/item/stack/cable_coil/pink
|
||||||
item_color = COLOR_PINK
|
color = COLOR_PINK
|
||||||
|
|
||||||
/obj/item/stack/cable_coil/orange
|
/obj/item/stack/cable_coil/orange
|
||||||
item_color = COLOR_ORANGE
|
color = COLOR_ORANGE
|
||||||
|
|
||||||
/obj/item/stack/cable_coil/cyan
|
/obj/item/stack/cable_coil/cyan
|
||||||
item_color = COLOR_CYAN
|
color = COLOR_CYAN
|
||||||
|
|
||||||
/obj/item/stack/cable_coil/white
|
/obj/item/stack/cable_coil/white
|
||||||
item_color = COLOR_WHITE
|
color = COLOR_WHITE
|
||||||
|
|
||||||
/obj/item/stack/cable_coil/random/New()
|
/obj/item/stack/cable_coil/random/New()
|
||||||
item_color = pick(COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN)
|
color = pick(COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN)
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/obj/item/stack/cable_coil/attack(mob/M as mob, mob/user as mob)
|
/obj/item/stack/cable_coil/attack(mob/M as mob, mob/user as mob)
|
||||||
|
|||||||
Reference in New Issue
Block a user