From 78b173b50aad0b3963141821cae95fd0e6e18e2e Mon Sep 17 00:00:00 2001 From: Mechoid Date: Sun, 30 Sep 2018 14:49:34 -0700 Subject: [PATCH 1/2] Custom RIG Framework (#5613) * Framework for Custom RIG sprites. * Fixfix --- code/game/objects/items/paintkit.dm | 46 ++++++++++++++++++++ code/modules/clothing/spacesuits/rig/rig.dm | 11 +++-- html/changelogs/Mechoid - Custom Rigs.yml | 37 ++++++++++++++++ icons/mob/custom_items_rig_boots.dmi | Bin 0 -> 182 bytes icons/mob/custom_items_rig_gloves.dmi | Bin 0 -> 182 bytes icons/mob/custom_items_rig_helmet.dmi | Bin 0 -> 182 bytes icons/mob/custom_items_rig_suit.dmi | Bin 0 -> 182 bytes 7 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 html/changelogs/Mechoid - Custom Rigs.yml create mode 100644 icons/mob/custom_items_rig_boots.dmi create mode 100644 icons/mob/custom_items_rig_gloves.dmi create mode 100644 icons/mob/custom_items_rig_helmet.dmi create mode 100644 icons/mob/custom_items_rig_suit.dmi diff --git a/code/game/objects/items/paintkit.dm b/code/game/objects/items/paintkit.dm index 87b7566b60b..4b3bd408d24 100644 --- a/code/game/objects/items/paintkit.dm +++ b/code/game/objects/items/paintkit.dm @@ -149,6 +149,52 @@ return return ..() +/obj/item/device/kit/suit/rig + name = "rig modification kit" + desc = "A kit for modifying a rigsuit." + uses = 1 + +/obj/item/device/kit/suit/rig/customize(var/obj/item/I, var/mob/user) + var/obj/item/weapon/rig/RIG = I + RIG.suit_state = new_icon + RIG.suit_type = "customized [initial(RIG.suit_type)]" + RIG.name = "[new_name]" + RIG.desc = new_desc + RIG.icon = new_icon_file + RIG.icon_state = new_icon + RIG.icon_override = new_icon_override_file + for(var/obj/item/piece in list(RIG.gloves,RIG.helmet,RIG.boots,RIG.chest)) + if(!istype(piece)) + continue + piece.name = "[RIG.suit_type] [initial(piece.name)]" + piece.desc = "It seems to be part of a [RIG.name]." + piece.icon_state = "[RIG.suit_state]" + if(istype(piece, /obj/item/clothing/shoes)) + icon = 'icons/mob/custom_items_rig_boots.dmi' + icon_override = 'icons/mob/custom_items_rig_boots.dmi' + if(istype(piece, /obj/item/clothing/suit)) + icon = 'icons/mob/custom_items_rig_suit.dmi' + icon_override = 'icons/mob/custom_items_rig_suit.dmi' + if(istype(piece, /obj/item/clothing/head)) + icon = 'icons/mob/custom_items_rig_helmet.dmi' + icon_override = 'icons/mob/custom_items_rig_helmet.dmi' + if(istype(piece, /obj/item/clothing/gloves)) + icon = 'icons/mob/custom_items_rig_gloves.dmi' + icon_override = 'icons/mob/custom_items_rig_gloves.dmi' + if(RIG.helmet && istype(RIG.helmet, /obj/item/clothing/head/helmet) && new_light_overlay) + var/obj/item/clothing/head/helmet/H = RIG.helmet + H.light_overlay = new_light_overlay + use(1,user) + +/obj/item/device/kit/suit/rig/can_customize(var/obj/item/I) + return istype(I, /obj/item/weapon/rig) + +/obj/item/weapon/rig/attackby(var/obj/item/O, var/mob/user) + if(istype(O,/obj/item/device/kit/suit)) + var/obj/item/device/kit/suit/rig/kit = O + kit.customize(src, user) + return + return ..() /obj/item/device/kit/paint name = "mecha customisation kit" diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm index df610f3407c..d8001d11834 100644 --- a/code/modules/clothing/spacesuits/rig/rig.dm +++ b/code/modules/clothing/spacesuits/rig/rig.dm @@ -26,6 +26,8 @@ unacidable = 1 preserve_item = 1 + var/suit_state //The string used for the suit's icon_state. + var/interface_path = "hardsuit.tmpl" var/ai_interface_path = "hardsuit.tmpl" var/interface_title = "Hardsuit Controller" @@ -111,6 +113,7 @@ /obj/item/weapon/rig/New() ..() + suit_state = icon_state item_state = icon_state wires = new(src) @@ -155,7 +158,7 @@ piece.canremove = 0 piece.name = "[suit_type] [initial(piece.name)]" piece.desc = "It seems to be part of a [src.name]." - piece.icon_state = "[initial(icon_state)]" + piece.icon_state = "[suit_state]" piece.min_cold_protection_temperature = min_cold_protection_temperature piece.max_heat_protection_temperature = max_heat_protection_temperature if(piece.siemens_coefficient > siemens_coefficient) //So that insulated gloves keep their insulation. @@ -207,7 +210,7 @@ canremove = 1 for(var/obj/item/piece in list(helmet,boots,gloves,chest)) if(!piece) continue - piece.icon_state = "[initial(icon_state)]" + piece.icon_state = "[suit_state]" if(airtight) piece.item_flags &= ~(STOPPRESSUREDAMAGE|AIRTIGHT) update_icon(1) @@ -272,7 +275,7 @@ if(seal_delay && !instant && !do_after(M,seal_delay,needhand=0)) failed_to_seal = 1 - piece.icon_state = "[initial(icon_state)][!seal_target ? "_sealed" : ""]" + piece.icon_state = "[suit_state][!seal_target ? "_sealed" : ""]" switch(msg_type) if("boots") M << "\The [piece] [!seal_target ? "seal around your feet" : "relax their grip on your legs"]." @@ -310,7 +313,7 @@ qdel(booting_R) for(var/obj/item/piece in list(helmet,boots,gloves,chest)) if(!piece) continue - piece.icon_state = "[initial(icon_state)][!seal_target ? "" : "_sealed"]" + piece.icon_state = "[suit_state][!seal_target ? "" : "_sealed"]" canremove = !seal_target if(airtight) update_component_sealed() diff --git a/html/changelogs/Mechoid - Custom Rigs.yml b/html/changelogs/Mechoid - Custom Rigs.yml new file mode 100644 index 00000000000..54ce0704cc7 --- /dev/null +++ b/html/changelogs/Mechoid - Custom Rigs.yml @@ -0,0 +1,37 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +################################# + +# Your name. +author: Mechoid + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Added a RIG customization kit." + - tweak: "RIGs now use a var called suit_state to determine the basis for their component icons, rather than the rig's icon state." diff --git a/icons/mob/custom_items_rig_boots.dmi b/icons/mob/custom_items_rig_boots.dmi new file mode 100644 index 0000000000000000000000000000000000000000..cf74d73796c8c6121c0818fdac74e4a7f0ab9a5f GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnL3?x0byx0z;m;-!5T!HlRD%)E?im@cfFPOpM z*^M-ilB$r15|`BC)e_1!5cyiE*d|0 zq;uX!^CUx2Pwx&3;~?Y9#$F0CsjT7l;v3i)KHlcf^{%~V4K$R;)5S4_V`g%K#2p}S W0R!VxY5#RV7K5j&pUXO@geCygCOLEf literal 0 HcmV?d00001 diff --git a/icons/mob/custom_items_rig_gloves.dmi b/icons/mob/custom_items_rig_gloves.dmi new file mode 100644 index 0000000000000000000000000000000000000000..cf74d73796c8c6121c0818fdac74e4a7f0ab9a5f GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnL3?x0byx0z;m;-!5T!HlRD%)E?im@cfFPOpM z*^M-ilB$r15|`BC)e_1!5cyiE*d|0 zq;uX!^CUx2Pwx&3;~?Y9#$F0CsjT7l;v3i)KHlcf^{%~V4K$R;)5S4_V`g%K#2p}S W0R!VxY5#RV7K5j&pUXO@geCygCOLEf literal 0 HcmV?d00001 diff --git a/icons/mob/custom_items_rig_helmet.dmi b/icons/mob/custom_items_rig_helmet.dmi new file mode 100644 index 0000000000000000000000000000000000000000..cf74d73796c8c6121c0818fdac74e4a7f0ab9a5f GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnL3?x0byx0z;m;-!5T!HlRD%)E?im@cfFPOpM z*^M-ilB$r15|`BC)e_1!5cyiE*d|0 zq;uX!^CUx2Pwx&3;~?Y9#$F0CsjT7l;v3i)KHlcf^{%~V4K$R;)5S4_V`g%K#2p}S W0R!VxY5#RV7K5j&pUXO@geCygCOLEf literal 0 HcmV?d00001 diff --git a/icons/mob/custom_items_rig_suit.dmi b/icons/mob/custom_items_rig_suit.dmi new file mode 100644 index 0000000000000000000000000000000000000000..cf74d73796c8c6121c0818fdac74e4a7f0ab9a5f GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnL3?x0byx0z;m;-!5T!HlRD%)E?im@cfFPOpM z*^M-ilB$r15|`BC)e_1!5cyiE*d|0 zq;uX!^CUx2Pwx&3;~?Y9#$F0CsjT7l;v3i)KHlcf^{%~V4K$R;)5S4_V`g%K#2p}S W0R!VxY5#RV7K5j&pUXO@geCygCOLEf literal 0 HcmV?d00001