first commit with everything
This commit is contained in:
@@ -193,7 +193,10 @@
|
||||
|
||||
/obj/item/melee/transforming/energy/sword/saber
|
||||
possible_colors = list("red" = LIGHT_COLOR_RED, "blue" = LIGHT_COLOR_LIGHT_CYAN, "green" = LIGHT_COLOR_GREEN, "purple" = LIGHT_COLOR_LAVENDER)
|
||||
unique_reskin = list("Sword" = "sword0", "Saber" = "esaber0")
|
||||
unique_reskin = list(
|
||||
"Sword" = list("icon_state" = "sword0"),
|
||||
"Saber" = list("icon_state" = "esaber0")
|
||||
)
|
||||
var/hacked = FALSE
|
||||
var/saber = FALSE
|
||||
|
||||
@@ -201,26 +204,22 @@
|
||||
. = ..()
|
||||
if(.)
|
||||
if(active)
|
||||
if(sword_color)
|
||||
if(saber)
|
||||
icon_state = "esaber[sword_color]"
|
||||
else
|
||||
icon_state = "sword[sword_color]"
|
||||
else
|
||||
if(saber)
|
||||
icon_state = "esaber0"
|
||||
else
|
||||
icon_state = "sword0"
|
||||
switch(current_skin)
|
||||
if("Sword")
|
||||
icon_state = "sword[sword_color ? sword_color : "0"]"
|
||||
if("Saber")
|
||||
icon_state = "esaber[sword_color ? sword_color : "0"]"
|
||||
|
||||
/obj/item/melee/transforming/energy/sword/saber/reskin_obj(mob/M)
|
||||
. = ..()
|
||||
if(icon_state == "esaber0")
|
||||
saber = TRUE
|
||||
if(!.)
|
||||
return
|
||||
if(active)
|
||||
if(saber)
|
||||
icon_state = "esaber[sword_color]"
|
||||
else
|
||||
icon_state = "sword[sword_color]"
|
||||
switch(current_skin)
|
||||
if("Sword")
|
||||
icon_state = "sword[sword_color]"
|
||||
if("Saber")
|
||||
icon_state = "esaber[sword_color]"
|
||||
|
||||
/obj/item/melee/transforming/energy/sword/saber/set_sword_color(var/color_forced)
|
||||
if(color_forced) // wow i really do not like this at fucking all holy SHIT
|
||||
|
||||
@@ -349,24 +349,31 @@
|
||||
reskin_obj(user)
|
||||
return TRUE
|
||||
|
||||
/// Reskins an object according to M's choice, modified to be overridable and supports different icons
|
||||
/obj/proc/reskin_obj(mob/M)
|
||||
if(!LAZYLEN(unique_reskin))
|
||||
return
|
||||
return FALSE
|
||||
|
||||
var/list/items = list()
|
||||
for(var/reskin_option in unique_reskin)
|
||||
var/image/item_image = image(icon = src.icon, icon_state = unique_reskin[reskin_option])
|
||||
var/image/item_image = image(
|
||||
icon = unique_reskin[reskin_option]["icon"] ? unique_reskin[reskin_option]["icon"] : icon,
|
||||
icon_state = unique_reskin[reskin_option]["icon_state"])
|
||||
items += list("[reskin_option]" = item_image)
|
||||
sortList(items)
|
||||
|
||||
var/pick = show_radial_menu(M, src, items, custom_check = CALLBACK(src, .proc/check_reskin_menu, M), radius = 38, require_near = TRUE)
|
||||
if(!pick)
|
||||
return
|
||||
if(!unique_reskin[pick])
|
||||
return
|
||||
return FALSE
|
||||
if(!unique_reskin[pick]["icon_state"])
|
||||
return FALSE
|
||||
current_skin = pick
|
||||
icon_state = unique_reskin[pick]
|
||||
var/has_icon = unique_reskin[pick]["icon"]
|
||||
if(has_icon)
|
||||
icon = has_icon
|
||||
icon_state = unique_reskin[pick]["icon_state"]
|
||||
to_chat(M, "[src] is now skinned as '[pick].'")
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* Checks if we are allowed to interact with a radial menu for reskins
|
||||
|
||||
Reference in New Issue
Block a user