the last bit

This commit is contained in:
Hatterhat
2020-10-07 17:50:21 -05:00
parent 9928a172d0
commit 96e55d6233
5 changed files with 37 additions and 19 deletions
+8 -8
View File
@@ -190,7 +190,7 @@
/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", "Sabre" = "esabre0")
unique_reskin = list("Sword" = "sword0", "saber" = "esaber0")
var/hacked = FALSE
var/saber = FALSE
@@ -200,22 +200,22 @@
if(active)
if(sword_color)
if(saber)
icon_state = "esabre[sword_color]"
icon_state = "esaber[sword_color]"
else
icon_state = "sword[sword_color]"
START_PROCESSING(SSobj, src)
set_light(brightness_on)
else
STOP_PROCESSING(SSobj, src)
set_light(0)
if(saber)
icon_state = "esaber0"
else
icon_state = "sword0"
/obj/item/melee/transforming/energy/sword/saber/reskin_obj(mob/M)
. = ..()
if(icon_state == "sabre0")
if(icon_state == "esaber0")
saber = TRUE
if(active)
if(saber)
icon_state = "esabre[sword_color]"
icon_state = "esaber[sword_color]"
else
icon_state = "sword[sword_color]"
+29 -11
View File
@@ -304,18 +304,36 @@
/obj/proc/reskin_obj(mob/M)
if(!LAZYLEN(unique_reskin))
return
var/list/skins = list()
for(var/S in unique_reskin)
skins[S] = image(icon = icon, icon_state = unique_reskin[S])
var/choice = show_radial_menu(M, src, skins, custom_check = CALLBACK(src, .proc/check_skinnable, M), radius = 40, require_near = TRUE)
if(!choice)
return FALSE
icon_state = unique_reskin[choice]
current_skin = choice
return
/obj/proc/check_skinnable(/mob/M)
if(current_skin || !always_reskinnable)
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])
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
current_skin = pick
icon_state = unique_reskin[pick]
to_chat(M, "[src] is now skinned as '[pick].'")
/**
* Checks if we are allowed to interact with a radial menu for reskins
*
* Arguments:
* * user The mob interacting with the menu
*/
/obj/proc/check_reskin_menu(mob/user)
if(QDELETED(src))
return FALSE
if(current_skin)
return FALSE
if(!istype(user))
return FALSE
if(user.incapacitated())
return FALSE
return TRUE