From 7c4b887551262476986a08f8db23d7a454f034d0 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Fri, 14 Jul 2017 05:21:13 -0500 Subject: [PATCH] Clockwork component icons for tgui will only be generated once (#1995) --- code/_onclick/hud/alert.dm | 4 +-- .../clock_helpers/component_helpers.dm | 8 +++++- .../clock_cult/clock_items/clockwork_slab.dm | 26 +++++++++---------- .../ark_of_the_clockwork_justicar.dm | 2 +- .../clock_structures/tinkerers_cache.dm | 2 +- .../clock_structures/tinkerers_daemon.dm | 2 +- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm index c43b015447..b792f4399e 100644 --- a/code/_onclick/hud/alert.dm +++ b/code/_onclick/hud/alert.dm @@ -468,10 +468,10 @@ or shoot a gun to move around via Newton's 3rd Law of Motion." var/area/gate_area = get_area(G) textlist += "Ark Location: [uppertext(gate_area.map_name)]
" if(G.still_needs_components()) - textlist += "Ark Components required: " + textlist += "Ark Components required:
" for(var/i in G.required_components) if(G.required_components[i]) - textlist += "[G.required_components[i]] " + textlist += "[get_component_icon(i)] [G.required_components[i]] " textlist += "
" else textlist += "Seconds until Ratvar's arrival: [G.get_arrival_text(TRUE)]
" diff --git a/code/game/gamemodes/clock_cult/clock_helpers/component_helpers.dm b/code/game/gamemodes/clock_cult/clock_helpers/component_helpers.dm index bef9199496..5f6d1af61b 100644 --- a/code/game/gamemodes/clock_cult/clock_helpers/component_helpers.dm +++ b/code/game/gamemodes/clock_cult/clock_helpers/component_helpers.dm @@ -64,7 +64,13 @@ //returns a component icon from a component id /proc/get_component_icon(id) - return "" + var/static/list/tgui_component_icons = list( + BELLIGERENT_EYE = icon2base64(icon('icons/obj/tgui_components.dmi', BELLIGERENT_EYE)), + VANGUARD_COGWHEEL = icon2base64(icon('icons/obj/tgui_components.dmi', VANGUARD_COGWHEEL)), + GEIS_CAPACITOR = icon2base64(icon('icons/obj/tgui_components.dmi', GEIS_CAPACITOR)), + REPLICANT_ALLOY = icon2base64(icon('icons/obj/tgui_components.dmi', REPLICANT_ALLOY)), + HIEROPHANT_ANSIBLE = icon2base64(icon('icons/obj/tgui_components.dmi', HIEROPHANT_ANSIBLE))) + return "" //returns a component id from a component name /proc/get_component_id(name) diff --git a/code/game/gamemodes/clock_cult/clock_items/clockwork_slab.dm b/code/game/gamemodes/clock_cult/clock_items/clockwork_slab.dm index dabdb99653..15dc5bbe52 100644 --- a/code/game/gamemodes/clock_cult/clock_items/clockwork_slab.dm +++ b/code/game/gamemodes/clock_cult/clock_items/clockwork_slab.dm @@ -151,12 +151,12 @@ if(GLOB.clockwork_caches) //show components on examine to_chat(user, "Stored components (with global cache):") for(var/i in stored_components) - to_chat(user, "[get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]: [stored_components[i]] \ + to_chat(user, "[get_component_icon(i)] [get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]: [stored_components[i]] \ ([stored_components[i] + GLOB.clockwork_component_cache[i]])") else to_chat(user, "Stored components:") for(var/i in stored_components) - to_chat(user, "[get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]: [stored_components[i]]") + to_chat(user, "[get_component_icon(i)] [get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]: [stored_components[i]]") //Component Transferal /obj/item/clockwork/slab/attack(mob/living/target, mob/living/carbon/human/user) @@ -395,11 +395,11 @@ dat += "Cache: A Tinkerer's Cache, which is a structure that stores and creates components.
" dat += "CV: Construction Value. All clockwork structures, floors, and walls increase this number.
" dat += "Geis: An important scripture used to make normal crew and robots into Servants of Ratvar.
" - dat += "BE [get_component_icon(BELLIGERENT_EYE)]: Belligerent Eye, a component type used in offensive scriptures.
" - dat += "VG [get_component_icon(VANGUARD_COGWHEEL)]: Vanguard Cogwheel, a component type used in defensive scriptures.
" - dat += "GC [get_component_icon(GEIS_CAPACITOR)]: Geis Capacitor, a component type used in mind-related scriptures.
" - dat += "RA [get_component_icon(REPLICANT_ALLOY)]: Replicant Alloy, a component type used in construction scriptures.
" - dat += "HA [get_component_icon(HIEROPHANT_ANSIBLE)]: Hierophant Ansible, a component type used in energy scriptures.
" + dat += "[get_component_icon(BELLIGERENT_EYE)]BE: Belligerent Eye, a component type used in offensive scriptures.
" + dat += "[get_component_icon(VANGUARD_COGWHEEL)]VC: Vanguard Cogwheel, a component type used in defensive scriptures.
" + dat += "[get_component_icon(GEIS_CAPACITOR)]GC: Geis Capacitor, a component type used in mind-related scriptures.
" + dat += "[get_component_icon(REPLICANT_ALLOY)]RA: Replicant Alloy, a component type used in construction scriptures.
" + dat += "[get_component_icon(HIEROPHANT_ANSIBLE)]HA: Hierophant Ansible, a component type used in energy scriptures.
" dat += "Ark: The cult's win condition, a huge structure that needs to be defended.

" dat += "Items
" dat += "Slab: A clockwork slab, a Servant's most important tool. You're holding one! Keep it safe and hidden.
" @@ -455,11 +455,11 @@ production_text = production_text.Join() dat += "Components & Their Uses

" dat += "Components are your primary resource as a Servant. There are five types of component, with each one being used in different roles:

" - dat += "Belligerent Eyes [get_component_icon(BELLIGERENT_EYE)] are aggressive and judgemental, and are used in offensive scripture;
" - dat += "Vanguard Cogwheels [get_component_icon(VANGUARD_COGWHEEL)] are defensive and repairing, and are used in defensive scripture;
" - dat += "Geis Capacitors [get_component_icon(GEIS_CAPACITOR)] are for conversion and control, and are used in mind-related scripture;
" //References the old name - dat += "Replicant Alloy [get_component_icon(REPLICANT_ALLOY)] is a strong, malleable metal and is used for construction and creation;
" - dat += "Hierophant Ansibles [get_component_icon(HIEROPHANT_ANSIBLE)] are for transmission and power, and are used in power and teleportation scripture

" + dat += "[get_component_icon(BELLIGERENT_EYE)]BE Belligerent Eyes are aggressive and judgemental, and are used in offensive scripture;
" + dat += "[get_component_icon(VANGUARD_COGWHEEL)]VC Vanguard Cogwheels are defensive and repairing, and are used in defensive scripture;
" + dat += "[get_component_icon(GEIS_CAPACITOR)]GC Geis Capacitors are for conversion and control, and are used in mind-related scripture;
" //References the old name + dat += "[get_component_icon(REPLICANT_ALLOY)]RA Replicant Alloy is a strong, malleable metal and is used for construction and creation;
" + dat += "[get_component_icon(HIEROPHANT_ANSIBLE)]HA Hierophant Ansibles are for transmission and power, and are used in power and teleportation scripture

" dat += "Although this is a good rule of thumb, their effects become much more nuanced when used together. For instance, a turret might have both belligerent eyes and \ vanguard cogwheels as construction requirements, because it defends its allies by harming its enemies.

" dat += "Components' primary use is fueling scripture (covered in its own section), and they can be created through various ways. This clockwork slab, for instance, \ @@ -725,7 +725,7 @@ var/list/temp_desc = list() for(var/c in quickbind_slot.consumed_components) //show how much the bound scripture costs if(quickbind_slot.consumed_components[c]) - temp_desc += "[get_component_acronym(c)] [quickbind_slot.consumed_components[c]] " + temp_desc += "[get_component_icon(c)] [quickbind_slot.consumed_components[c]] " if(LAZYLEN(temp_desc)) temp_desc += "
" temp_desc += "[quickbind_slot.quickbind_desc]" diff --git a/code/game/gamemodes/clock_cult/clock_structures/ark_of_the_clockwork_justicar.dm b/code/game/gamemodes/clock_cult/clock_structures/ark_of_the_clockwork_justicar.dm index f5ae5d40ff..edff185140 100644 --- a/code/game/gamemodes/clock_cult/clock_structures/ark_of_the_clockwork_justicar.dm +++ b/code/game/gamemodes/clock_cult/clock_structures/ark_of_the_clockwork_justicar.dm @@ -159,7 +159,7 @@ to_chat(user, "Components required until activation:") for(var/i in required_components) if(required_components[i]) - to_chat(user, "[get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]: \ + to_chat(user, "[get_component_icon(i)] [get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]: \ [required_components[i]]") else to_chat(user, "Seconds until Ratvar's arrival: [get_arrival_text(TRUE)]") diff --git a/code/game/gamemodes/clock_cult/clock_structures/tinkerers_cache.dm b/code/game/gamemodes/clock_cult/clock_structures/tinkerers_cache.dm index 41b7aa1c59..326aa46c06 100644 --- a/code/game/gamemodes/clock_cult/clock_structures/tinkerers_cache.dm +++ b/code/game/gamemodes/clock_cult/clock_structures/tinkerers_cache.dm @@ -110,7 +110,7 @@ to_chat(user, "It is unlinked! Construct a Clockwork Wall nearby to generate components!") to_chat(user, "Stored components:") for(var/i in GLOB.clockwork_component_cache) - to_chat(user, "[get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]: [GLOB.clockwork_component_cache[i]]") + to_chat(user, "[get_component_icon(i)] [get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]: [GLOB.clockwork_component_cache[i]]") /obj/structure/destructible/clockwork/cache/proc/get_production_time() return (CACHE_PRODUCTION_TIME + (ACTIVE_CACHE_SLOWDOWN * linked_caches)) * get_efficiency_mod(TRUE) diff --git a/code/game/gamemodes/clock_cult/clock_structures/tinkerers_daemon.dm b/code/game/gamemodes/clock_cult/clock_structures/tinkerers_daemon.dm index dbfa4fe8d5..079fd081fe 100644 --- a/code/game/gamemodes/clock_cult/clock_structures/tinkerers_daemon.dm +++ b/code/game/gamemodes/clock_cult/clock_structures/tinkerers_daemon.dm @@ -33,7 +33,7 @@ to_chat(user, "It is currently producing random components.") to_chat(user, "It will produce a component every [round((production_cooldown*0.1) * get_efficiency_mod(TRUE), 0.1)] seconds and requires at least the following power for each component type:") for(var/i in GLOB.clockwork_component_cache) - to_chat(user, "[get_component_name(i)]: [get_component_cost(i)]W ([GLOB.clockwork_component_cache[i]] exist[GLOB.clockwork_component_cache[i] == 1 ? "s" : ""])") + to_chat(user, "[get_component_icon(i)] [get_component_name(i)]: [get_component_cost(i)]W ([GLOB.clockwork_component_cache[i]] exist[GLOB.clockwork_component_cache[i] == 1 ? "s" : ""])") /obj/structure/destructible/clockwork/powered/tinkerers_daemon/forced_disable(bad_effects) if(active)