[MIRROR] Converts screwdrivers to GAS (#5058)

* Converts screwdrivers to GAS (#58453)

* Basic GAS setup

* Compile fix

* Fixes, inhands, belt icons

* New procs

* New version of GAGS

* Inhand for subtypes

* Typo fix

* Converts screwdrivers to GAS

Co-authored-by: Arkatos1 <43862960+Arkatos1@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-04-21 05:53:17 +01:00
committed by GitHub
co-authored by Arkatos1
parent 3455857e55
commit d5bf2b0b4e
4 changed files with 67 additions and 33 deletions
@@ -24,3 +24,19 @@
/datum/greyscale_config/wirecutters
icon_file = 'icons/obj/tools.dmi'
json_config = 'code/datums/greyscale/json_configs/wirecutters.json'
/datum/greyscale_config/screwdriver
icon_file = 'icons/obj/tools.dmi'
json_config = 'code/datums/greyscale/json_configs/screwdriver.json'
/datum/greyscale_config/screwdriver_inhand_left
icon_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
json_config = 'code/datums/greyscale/json_configs/screwdriver_worn.json'
/datum/greyscale_config/screwdriver_inhand_right
icon_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
json_config = 'code/datums/greyscale/json_configs/screwdriver_worn.json'
/datum/greyscale_config/screwdriver_belt
icon_file = 'icons/obj/clothing/belt_overlays.dmi'
json_config = 'code/datums/greyscale/json_configs/screwdriver_worn.json'
@@ -0,0 +1,15 @@
{
"": [
{
"type": "icon_state",
"icon_state": "screwdriver",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "screwdriver_screwybits",
"blend_mode": "overlay"
}
]
}
@@ -0,0 +1,15 @@
{
"": [
{
"type": "icon_state",
"icon_state": "screwdriver",
"blend_mode": "overlay",
"color_ids": [ 1 ]
},
{
"type": "icon_state",
"icon_state": "screwdriver_head",
"blend_mode": "overlay"
}
]
}
+21 -33
View File
@@ -25,54 +25,42 @@
drop_sound = 'sound/items/handling/screwdriver_drop.ogg'
pickup_sound = 'sound/items/handling/screwdriver_pickup.ogg'
sharpness = SHARP_POINTY
var/random_color = TRUE //if the screwdriver uses random coloring
/// If the item should be assigned a random color
var/random_color = TRUE
/// List of possible random colors
var/static/list/screwdriver_colors = list(
"blue" = rgb(24, 97, 213),
"red" = rgb(255, 0, 0),
"pink" = rgb(213, 24, 141),
"brown" = rgb(160, 82, 18),
"green" = rgb(14, 127, 27),
"cyan" = rgb(24, 162, 213),
"yellow" = rgb(255, 165, 0)
"blue" = "#1861d5",
"red" = "#ff0000",
"pink" = "#d5188d",
"brown" = "#a05212",
"green" = "#0e7f1b",
"cyan" = "#18a2d5",
"yellow" = "#ffa500"
)
/// Colored belt appearance for adding it as a belt overlay
var/mutable_appearance/colored_belt_appearance
/obj/item/screwdriver/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is stabbing [src] into [user.p_their()] [pick("temple", "heart")]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return(BRUTELOSS)
/obj/item/screwdriver/Initialize()
if(random_color)
set_greyscale_config(/datum/greyscale_config/screwdriver)
var/our_color = pick(screwdriver_colors)
set_greyscale_colors(list(screwdriver_colors[our_color]))
inhand_icon_state = null
lefthand_file = SSgreyscale.GetColoredIconByType(/datum/greyscale_config/screwdriver_inhand_left, greyscale_colors)
righthand_file = SSgreyscale.GetColoredIconByType(/datum/greyscale_config/screwdriver_inhand_right, greyscale_colors)
colored_belt_appearance = mutable_appearance(SSgreyscale.GetColoredIconByType(/datum/greyscale_config/screwdriver_belt, greyscale_colors))
. = ..()
AddElement(/datum/element/eyestab)
if(random_color) //random colors!
icon_state = "screwdriver"
var/our_color = pick(screwdriver_colors)
add_atom_colour(screwdriver_colors[our_color], FIXED_COLOUR_PRIORITY)
update_appearance()
if(prob(75))
pixel_y = rand(0, 16)
/obj/item/screwdriver/update_overlays()
. = ..()
if(!random_color) //icon override
return
var/mutable_appearance/base_overlay = mutable_appearance(icon, "screwdriver_screwybits")
base_overlay.appearance_flags = RESET_COLOR
. += base_overlay
/obj/item/screwdriver/worn_overlays(isinhands = FALSE, icon_file)
. = list()
if(isinhands && random_color)
var/mutable_appearance/M = mutable_appearance(icon_file, "screwdriver_head")
M.appearance_flags = RESET_COLOR
. += M
/obj/item/screwdriver/get_belt_overlay()
if(random_color)
var/mutable_appearance/body = mutable_appearance('icons/obj/clothing/belt_overlays.dmi', "screwdriver")
var/mutable_appearance/head = mutable_appearance('icons/obj/clothing/belt_overlays.dmi', "screwdriver_head")
body.color = color
head.add_overlay(body)
return head
return colored_belt_appearance
else
return mutable_appearance('icons/obj/clothing/belt_overlays.dmi', icon_state)