Clockwork component icons for tgui will only be generated once (#1995)

This commit is contained in:
CitadelStationBot
2017-07-14 05:21:13 -05:00
committed by kevinz000
parent 03618e7aa4
commit 7c4b887551
6 changed files with 25 additions and 19 deletions
+2 -2
View File
@@ -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: <b>[uppertext(gate_area.map_name)]</b><br>"
if(G.still_needs_components())
textlist += "Ark Components required: "
textlist += "Ark Components required:<br>"
for(var/i in G.required_components)
if(G.required_components[i])
textlist += "<b><font color=[get_component_color_bright(i)]>[G.required_components[i]]</font></b> "
textlist += "[get_component_icon(i)] <b><font color=[get_component_color_bright(i)]>[G.required_components[i]]</font></b> "
textlist += "<br>"
else
textlist += "Seconds until Ratvar's arrival: <b>[G.get_arrival_text(TRUE)]</b><br>"
@@ -64,7 +64,13 @@
//returns a component icon from a component id
/proc/get_component_icon(id)
return "<img style='width:14px; height:14px' src='data:image/png;base64,[icon2base64(icon('icons/obj/tgui_components.dmi', id))]'/>"
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 "<img style='width:14px; height:14px' src='data:image/png;base64,[tgui_component_icons[id]]'/>"
//returns a component id from a component name
/proc/get_component_id(name)
@@ -151,12 +151,12 @@
if(GLOB.clockwork_caches) //show components on examine
to_chat(user, "<b>Stored components (with global cache):</b>")
for(var/i in stored_components)
to_chat(user, "<span class='[get_component_span(i)]_small'><i>[get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]:</i> <b>[stored_components[i]]</b> \
to_chat(user, "[get_component_icon(i)] <span class='[get_component_span(i)]_small'><i>[get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]:</i> <b>[stored_components[i]]</b> \
(<b>[stored_components[i] + GLOB.clockwork_component_cache[i]]</b>)</span>")
else
to_chat(user, "<b>Stored components:</b>")
for(var/i in stored_components)
to_chat(user, "<span class='[get_component_span(i)]_small'><i>[get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]:</i> <b>[stored_components[i]]</b></span>")
to_chat(user, "[get_component_icon(i)] <span class='[get_component_span(i)]_small'><i>[get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]:</i> <b>[stored_components[i]]</b></span>")
//Component Transferal
/obj/item/clockwork/slab/attack(mob/living/target, mob/living/carbon/human/user)
@@ -395,11 +395,11 @@
dat += "<font color=#BE8700><b>Cache:</b></font> A <i>Tinkerer's Cache</i>, which is a structure that stores and creates components.<br>"
dat += "<font color=#BE8700><b>CV:</b></font> Construction Value. All clockwork structures, floors, and walls increase this number.<br>"
dat += "<font color=#BE8700><b>Geis:</b></font> An important scripture used to make normal crew and robots into Servants of Ratvar.<br>"
dat += "<font color=#BE8700><b>BE [get_component_icon(BELLIGERENT_EYE)]:</b></font> Belligerent Eye, a component type used in offensive scriptures.<br>"
dat += "<font color=#BE8700><b>VG [get_component_icon(VANGUARD_COGWHEEL)]:</b></font> Vanguard Cogwheel, a component type used in defensive scriptures.<br>"
dat += "<font color=#BE8700><b>GC [get_component_icon(GEIS_CAPACITOR)]:</b></font> Geis Capacitor, a component type used in mind-related scriptures.<br>"
dat += "<font color=#BE8700><b>RA [get_component_icon(REPLICANT_ALLOY)]:</b></font> Replicant Alloy, a component type used in construction scriptures.<br>"
dat += "<font color=#BE8700><b>HA [get_component_icon(HIEROPHANT_ANSIBLE)]:</b></font> Hierophant Ansible, a component type used in energy scriptures.<br>"
dat += "<font color=#6E001A><b>[get_component_icon(BELLIGERENT_EYE)]BE:</b></font> Belligerent Eye, a component type used in offensive scriptures.<br>"
dat += "<font color=#1E8CE1><b>[get_component_icon(VANGUARD_COGWHEEL)]VC:</b></font> Vanguard Cogwheel, a component type used in defensive scriptures.<br>"
dat += "<font color=#AF0AAF><b>[get_component_icon(GEIS_CAPACITOR)]GC:</b></font> Geis Capacitor, a component type used in mind-related scriptures.<br>"
dat += "<font color=#5A6068><b>[get_component_icon(REPLICANT_ALLOY)]RA:</b></font> Replicant Alloy, a component type used in construction scriptures.<br>"
dat += "<font color=#DAAA18><b>[get_component_icon(HIEROPHANT_ANSIBLE)]HA:</b></font> Hierophant Ansible, a component type used in energy scriptures.<br>"
dat += "<font color=#BE8700><b>Ark:</b></font> The cult's win condition, a huge structure that needs to be defended.<br><br>"
dat += "<font color=#BE8700 size=3>Items</font><br>"
dat += "<font color=#BE8700><b>Slab:</b></font> A clockwork slab, a Servant's most important tool. You're holding one! Keep it safe and hidden.<br>"
@@ -455,11 +455,11 @@
production_text = production_text.Join()
dat += "<font color=#BE8700 size=3>Components & Their Uses</font><br><br>"
dat += "<b>Components</b> are your primary resource as a Servant. There are five types of component, with each one being used in different roles:<br><br>"
dat += "<font color=#6E001A>Belligerent Eyes [get_component_icon(BELLIGERENT_EYE)]</font> are aggressive and judgemental, and are used in offensive scripture;<br>"
dat += "<font color=#1E8CE1>Vanguard Cogwheels [get_component_icon(VANGUARD_COGWHEEL)]</font> are defensive and repairing, and are used in defensive scripture;<br>"
dat += "<font color=#AF0AAF>Geis Capacitors [get_component_icon(GEIS_CAPACITOR)]</font> are for conversion and control, and are used in mind-related scripture;<br>" //References the old name
dat += "<font color=#5A6068>Replicant Alloy [get_component_icon(REPLICANT_ALLOY)]</font> is a strong, malleable metal and is used for construction and creation;<br>"
dat += "<font color=#DAAA18>Hierophant Ansibles [get_component_icon(HIEROPHANT_ANSIBLE)]</font> are for transmission and power, and are used in power and teleportation scripture<br><br>"
dat += "<font color=#6E001A>[get_component_icon(BELLIGERENT_EYE)]BE</font> Belligerent Eyes are aggressive and judgemental, and are used in offensive scripture;<br>"
dat += "<font color=#1E8CE1>[get_component_icon(VANGUARD_COGWHEEL)]VC</font> Vanguard Cogwheels are defensive and repairing, and are used in defensive scripture;<br>"
dat += "<font color=#AF0AAF>[get_component_icon(GEIS_CAPACITOR)]GC</font> Geis Capacitors are for conversion and control, and are used in mind-related scripture;<br>" //References the old name
dat += "<font color=#5A6068>[get_component_icon(REPLICANT_ALLOY)]RA</font> Replicant Alloy is a strong, malleable metal and is used for construction and creation;<br>"
dat += "<font color=#DAAA18>[get_component_icon(HIEROPHANT_ANSIBLE)]HA</font> Hierophant Ansibles are for transmission and power, and are used in power and teleportation scripture<br><br>"
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.<br><br>"
dat += "Components' primary use is fueling <b>scripture</b> (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 += "<font color=[get_component_color_bright(c)]>[get_component_acronym(c)] <b>[quickbind_slot.consumed_components[c]]</b></font> "
temp_desc += "<font color=[get_component_color_bright(c)]>[get_component_icon(c)] <b>[quickbind_slot.consumed_components[c]]</b></font> "
if(LAZYLEN(temp_desc))
temp_desc += "<br>"
temp_desc += "[quickbind_slot.quickbind_desc]"
@@ -159,7 +159,7 @@
to_chat(user, "<span class='big'><b>Components required until activation:</b></span>")
for(var/i in required_components)
if(required_components[i])
to_chat(user, "<span class='[get_component_span(i)]'>[get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]:</span> \
to_chat(user, "[get_component_icon(i)] <span class='[get_component_span(i)]'>[get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]:</span> \
<span class='[get_component_span(i)]_large'>[required_components[i]]</span>")
else
to_chat(user, "<span class='big'><b>Seconds until Ratvar's arrival:</b> [get_arrival_text(TRUE)]</span>")
@@ -110,7 +110,7 @@
to_chat(user, "<span class='alloy'>It is unlinked! Construct a Clockwork Wall nearby to generate components!</span>")
to_chat(user, "<b>Stored components:</b>")
for(var/i in GLOB.clockwork_component_cache)
to_chat(user, "<span class='[get_component_span(i)]_small'><i>[get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]:</i> <b>[GLOB.clockwork_component_cache[i]]</b></span>")
to_chat(user, "[get_component_icon(i)] <span class='[get_component_span(i)]_small'><i>[get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]:</i> <b>[GLOB.clockwork_component_cache[i]]</b></span>")
/obj/structure/destructible/clockwork/cache/proc/get_production_time()
return (CACHE_PRODUCTION_TIME + (ACTIVE_CACHE_SLOWDOWN * linked_caches)) * get_efficiency_mod(TRUE)
@@ -33,7 +33,7 @@
to_chat(user, "<span class='brass'>It is currently producing random components.</span>")
to_chat(user, "<span class='nezbere_small'>It will produce a component every <b>[round((production_cooldown*0.1) * get_efficiency_mod(TRUE), 0.1)]</b> seconds and requires at least the following power for each component type:</span>")
for(var/i in GLOB.clockwork_component_cache)
to_chat(user, "<span class='[get_component_span(i)]_small'><i>[get_component_name(i)]:</i> <b>[get_component_cost(i)]W</b> <i>([GLOB.clockwork_component_cache[i]] exist[GLOB.clockwork_component_cache[i] == 1 ? "s" : ""])</i></span>")
to_chat(user, "[get_component_icon(i)] <span class='[get_component_span(i)]_small'><i>[get_component_name(i)]:</i> <b>[get_component_cost(i)]W</b> <i>([GLOB.clockwork_component_cache[i]] exist[GLOB.clockwork_component_cache[i] == 1 ? "s" : ""])</i></span>")
/obj/structure/destructible/clockwork/powered/tinkerers_daemon/forced_disable(bad_effects)
if(active)