From 7841d851f685517d325c8bfa91a70ed990e88ccb Mon Sep 17 00:00:00 2001 From: Mars Date: Sat, 1 Dec 2018 13:42:38 +0100 Subject: [PATCH] Item_action customizing icon + custom icons for arm implants --- code/datums/action.dm | 6 +++++- code/game/objects/items.dm | 6 ++++-- code/modules/surgery/organs/augments_arms.dm | 12 ++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/code/datums/action.dm b/code/datums/action.dm index a9c895f3482..4a4504ac17a 100644 --- a/code/datums/action.dm +++ b/code/datums/action.dm @@ -102,10 +102,14 @@ /datum/action/item_action check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUNNED|AB_CHECK_LYING|AB_CHECK_CONSCIOUS var/use_itemicon = TRUE -/datum/action/item_action/New(Target) +/datum/action/item_action/New(Target, custom_icon, custom_icon_state) ..() var/obj/item/I = target I.actions += src + if(custom_icon && custom_icon_state) + use_itemicon = FALSE + icon_icon = custom_icon + button_icon_state = custom_icon_state /datum/action/item_action/Destroy() var/obj/item/I = target diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index f8798d77c5d..c6f36d581a2 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -35,6 +35,8 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d var/list/actions = list() //list of /datum/action's that this item has. var/list/actions_types = list() //list of paths of action datums to give to the item on New(). + var/list/action_icon = list() //list of icons-sheets for a given action to override the icon. + var/list/action_icon_state = list() //list of icon states for a given action to override the icon_state. var/list/materials = list() //Since any item can now be a piece of clothing, this has to be put here so all items share it. @@ -100,7 +102,7 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d /obj/item/New() ..() for(var/path in actions_types) - new path(src) + new path(src, action_icon[path], action_icon_state[path]) if(!hitsound) if(damtype == "fire") @@ -569,4 +571,4 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d target.visible_message("[target.name] blocks [src] and twists [user]'s arm behind [user.p_their()] back!", "You block the attack!") user.Stun(2) - return TRUE \ No newline at end of file + return TRUE diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm index 02c8005793b..10263cce153 100644 --- a/code/modules/surgery/organs/augments_arms.dm +++ b/code/modules/surgery/organs/augments_arms.dm @@ -199,6 +199,8 @@ origin_tech = "materials=3;engineering=4;biotech=3;powerstorage=4" contents = newlist(/obj/item/screwdriver/cyborg, /obj/item/wrench/cyborg, /obj/item/weldingtool/largetank/cyborg, /obj/item/crowbar/cyborg, /obj/item/wirecutters/cyborg, /obj/item/multitool/cyborg) + action_icon = list(/datum/action/item_action/organ_action/toggle = 'icons/obj/clothing/belts.dmi') + action_icon_state = list(/datum/action/item_action/organ_action/toggle = "utilitybelt") /obj/item/organ/internal/cyberimp/arm/toolset/l parent_organ = "l_arm" @@ -221,12 +223,16 @@ desc = "A cybernetic implant that allows the user to project a healing beam from their hand." contents = newlist(/obj/item/gun/medbeam) origin_tech = "materials=5;combat=2;biotech=5;powerstorage=4;syndicate=1" + action_icon = list(/datum/action/item_action/organ_action/toggle = 'icons/obj/chronos.dmi') + action_icon_state = list(/datum/action/item_action/organ_action/toggle = "chronogun") /obj/item/organ/internal/cyberimp/arm/flash name = "integrated high-intensity photon projector" //Why not desc = "An integrated projector mounted onto a user's arm, that is able to be used as a powerful flash." contents = newlist(/obj/item/flash/armimplant) origin_tech = "materials=4;combat=3;biotech=4;magnets=4;powerstorage=3" + action_icon = list(/datum/action/item_action/organ_action/toggle = 'icons/obj/device.dmi') + action_icon_state = list(/datum/action/item_action/organ_action/toggle = "flash") /obj/item/organ/internal/cyberimp/arm/flash/New() ..() @@ -265,6 +271,8 @@ desc = "A set of surgical tools hidden behind a concealed panel on the user's arm" contents = newlist(/obj/item/retractor/augment, /obj/item/hemostat/augment, /obj/item/cautery/augment, /obj/item/surgicaldrill/augment, /obj/item/scalpel/augment, /obj/item/circular_saw/augment, /obj/item/bonegel/augment, /obj/item/FixOVein/augment, /obj/item/bonesetter/augment) origin_tech = "materials=3;engineering=3;biotech=3;programming=2;magnets=3" + action_icon = list(/datum/action/item_action/organ_action/toggle = 'icons/obj/storage.dmi') + action_icon_state = list(/datum/action/item_action/organ_action/toggle = "duffel-med") /obj/item/organ/internal/cyberimp/arm/surgery/l parent_organ = "l_arm" @@ -348,9 +356,13 @@ desc = "Telescopic baton implant. Does what it says on the tin" // A better description contents = newlist(/obj/item/melee/classic_baton) + action_icon = list(/datum/action/item_action/organ_action/toggle = 'icons/obj/items.dmi') + action_icon_state = list(/datum/action/item_action/organ_action/toggle = "baton") /obj/item/organ/internal/cyberimp/arm/advmop name = "advanced mop implant" desc = "Advanced mop implant. Does what it says on the tin" // A better description contents = newlist(/obj/item/mop/advanced) + action_icon = list(/datum/action/item_action/organ_action/toggle = 'icons/obj/janitor.dmi') + action_icon_state = list(/datum/action/item_action/organ_action/toggle = "advmop")