From f89932bb382a2ecb257465f89cd38f435fc9ad04 Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Thu, 24 Nov 2016 21:59:36 -0500 Subject: [PATCH] You can now quickbind up to 5 scriptures --- .../clock_cult/clock_items/clockwork_slab.dm | 76 ++++++++++++------- .../clock_scriptures/scripture_scripts.dm | 16 ++-- code/modules/mob/mob.dm | 2 +- 3 files changed, 56 insertions(+), 38 deletions(-) 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 0221bb650fa..c315c952eb7 100644 --- a/code/game/gamemodes/clock_cult/clock_items/clockwork_slab.dm +++ b/code/game/gamemodes/clock_cult/clock_items/clockwork_slab.dm @@ -18,7 +18,7 @@ var/list/shown_scripture = list(SCRIPTURE_DRIVER = TRUE, SCRIPTURE_SCRIPT = FALSE, SCRIPTURE_APPLICATION = FALSE, SCRIPTURE_REVENANT = FALSE, SCRIPTURE_JUDGEMENT = FALSE) var/compact_scripture = TRUE var/obj/effect/proc_holder/slab/slab_ability //the slab's current bound ability, for certain scripture - var/list/quickbound = list(/datum/clockwork_scripture/ranged_ability/geis_prep, /datum/clockwork_scripture/vanguard) //quickbound scripture, accessed by index + var/list/quickbound = list(/datum/clockwork_scripture/ranged_ability/geis_prep) //quickbound scripture, accessed by index actions_types = list(/datum/action/item_action/clock/hierophant) /obj/item/clockwork/slab/starter @@ -26,6 +26,7 @@ /obj/item/clockwork/slab/internal //an internal motor for mobs running scripture name = "scripture motor" + quickbound = list() no_cost = TRUE produces_components = FALSE @@ -135,6 +136,8 @@ if(is_servant_of_ratvar(user) || isobserver(user)) if(LAZYLEN(quickbound)) for(var/i in 1 to quickbound.len) + if(!quickbound[i]) + continue var/datum/clockwork_scripture/quickbind_slot = quickbound[i] user << "Quickbind button: [initial(quickbind_slot.name)]." if(clockwork_caches) @@ -273,16 +276,16 @@ Key:" for(var/i in clockwork_component_cache) text += " [get_component_name(i)][i != REPLICANT_ALLOY ? "s":""]" - text += "


[compact_scripture ? "Dec":"C"]ompress Scripture Information

" + text += "

[compact_scripture ? "Dec":"C"]ompress Scripture Information
" var/text_to_add = "" - var/drivers = "
[SCRIPTURE_DRIVER]
These scriptures are always unlocked.
" - var/scripts = "
[SCRIPTURE_SCRIPT]
These scriptures require at least [SCRIPT_SERVANT_REQ] Servants and \ - [SCRIPT_CACHE_REQ] Tinkerer's Cache.
" - var/applications = "
[SCRIPTURE_APPLICATION]
These scriptures require at least [APPLICATION_SERVANT_REQ] Servants, \ - [APPLICATION_CACHE_REQ] Tinkerer's Caches, and [APPLICATION_CV_REQ]CV.
" - var/revenant = "
[SCRIPTURE_REVENANT]
These scriptures require at least [REVENANT_SERVANT_REQ] Servants, \ - [REVENANT_CACHE_REQ] Tinkerer's Caches, and [REVENANT_CV_REQ]CV.
" - var/judgement = "
[SCRIPTURE_JUDGEMENT]
This scripture requires at least [JUDGEMENT_SERVANT_REQ] Servants, \ + var/drivers = "
[SCRIPTURE_DRIVER]
These scriptures are always unlocked." + var/scripts = "

[SCRIPTURE_SCRIPT]
These scriptures require at least [SCRIPT_SERVANT_REQ] Servants and \ + [SCRIPT_CACHE_REQ] Tinkerer's Cache." + var/applications = "

[SCRIPTURE_APPLICATION]
These scriptures require at least [APPLICATION_SERVANT_REQ] Servants, \ + [APPLICATION_CACHE_REQ] Tinkerer's Caches, and [APPLICATION_CV_REQ]CV." + var/revenant = "

[SCRIPTURE_REVENANT]
These scriptures require at least [REVENANT_SERVANT_REQ] Servants, \ + [REVENANT_CACHE_REQ] Tinkerer's Caches, and [REVENANT_CV_REQ]CV." + var/judgement = "

[SCRIPTURE_JUDGEMENT]
This scripture requires at least [JUDGEMENT_SERVANT_REQ] Servants, \ [JUDGEMENT_CACHE_REQ] Tinkerer's Caches, and [JUDGEMENT_CV_REQ]CV.
In addition, there may not be any active non-Servant AIs.

" for(var/V in sortList(subtypesof(/datum/clockwork_scripture), /proc/cmp_clockscripture_priority)) var/datum/clockwork_scripture/S = V @@ -298,7 +301,7 @@ [initial(S.invokers_required) > 1 ? "
Invokers Required: [initial(S.invokers_required)]":""]\
Component Requirement:" for(var/i in req_comps) - if(req_comps[i]) + if(req_comps[i]) //if we're compact, this shows up to the right of the name scripture_text += " [req_comps[i]] [get_component_acronym(i)]" if(!compact_scripture) for(var/a in cons_comps) @@ -310,12 +313,18 @@ break //we want this to only show up if the scripture has a cost of some sort scripture_text += "
Tip: [initial(S.usage_tip)]" if(initial(S.quickbind)) - var/is_bound = FALSE - if(S in quickbound) - is_bound = TRUE - scripture_text += "
[is_bound ? "Currently Quickbound":\ - "Quickbind to button One| Quickbind to button Two"]" - scripture_text += "
Recite
" + var/bound_index = quickbound.Find(S) + scripture_text += "
" + if(bound_index) + scripture_text += "Unbind from [bound_index]" + else + for(var/i in 1 to 5) + scripture_text += "Quickbind to [i]" + if(i != 5) + scripture_text += "| " + else + scripture_text += "
" + scripture_text += "
Recite" switch(initial_tier) if(SCRIPTURE_DRIVER) drivers += scripture_text @@ -329,7 +338,7 @@ judgement += scripture_text text_to_add += "[drivers]
[scripts]
[applications]
[revenant]
[judgement]" text += text_to_add - text += "

Purge all untruths and honor Ratvar.
" + text += "



Purge all untruths and honor Ratvar.
" var/datum/browser/popup = new(user, "recital", "", 600, 500) popup.set_content(text) popup.open() @@ -403,6 +412,8 @@ Hierophant Network, which allows communication to other Servants.
" if(LAZYLEN(quickbound)) for(var/i in 1 to quickbound.len) + if(!quickbound[i]) + continue var/datum/clockwork_scripture/quickbind_slot = quickbound[i] text += "A Quickbind slot, currently set to [initial(quickbind_slot.name)].
" text += "
\ @@ -427,11 +438,20 @@ addtimer(src, "recite_scripture", 0, FALSE, href_list["Recite"], usr, FALSE) return - if(href_list["Quickbindone"]) - quickbind_to_slot(href_list["Quickbindone"], 1) - - if(href_list["Quickbindtwo"]) - quickbind_to_slot(href_list["Quickbindtwo"], 2) + if(href_list["task"]) + if(href_list["task"] == "unbind") + var/remove_path = text2path(href_list["quickbind"]) //we need a path and not a string + var/found_index = quickbound.Find(remove_path) + if(found_index) + if(LAZYLEN(quickbound) == found_index) //if it's the last scripture, remove it instead of leaving a null + quickbound -= remove_path + else + quickbound[found_index] = null //otherwise, leave it as a null so the scripture maintains position + update_quickbind() + else + var/number = text2num(href_list["task"]) + if(isnum(number) && number > 0 && number < 6) + quickbind_to_slot(text2path(href_list["quickbind"]), number) //same here if(href_list["compactscripture"]) compact_scripture = !compact_scripture @@ -443,10 +463,10 @@ interact(usr) /obj/item/clockwork/slab/proc/quickbind_to_slot(datum/clockwork_scripture/scripture, index) //takes a typepath(typecast for initial()) and binds it to a slot - if(!ispath(scripture) && istext(scripture)) - scripture = text2path(scripture) //if given as a href, the scripture will be a string and not a path. obviously, we need a path and not a string - if(!scripture || (scripture in quickbound)) + if(!ispath(scripture) || !scripture || (scripture in quickbound)) return + while(LAZYLEN(quickbound) < index) + quickbound += null quickbound[index] = scripture update_quickbind() @@ -455,10 +475,12 @@ qdel(Q) if(LAZYLEN(quickbound)) for(var/i in 1 to quickbound.len) + if(!quickbound[i]) + continue var/datum/action/item_action/clock/quickbind/Q = new /datum/action/item_action/clock/quickbind(src) Q.scripture_index = i var/datum/clockwork_scripture/quickbind_slot = quickbound[i] - Q.name = initial(quickbind_slot.name) + Q.name = "[initial(quickbind_slot.name)] ([Q.scripture_index])" Q.desc = initial(quickbind_slot.quickbind_desc) Q.button_icon_state = initial(quickbind_slot.name) Q.UpdateButtonIcon() diff --git a/code/game/gamemodes/clock_cult/clock_scriptures/scripture_scripts.dm b/code/game/gamemodes/clock_cult/clock_scriptures/scripture_scripts.dm index df0251fac1c..6d78ea5f64b 100644 --- a/code/game/gamemodes/clock_cult/clock_scriptures/scripture_scripts.dm +++ b/code/game/gamemodes/clock_cult/clock_scriptures/scripture_scripts.dm @@ -80,18 +80,14 @@ for(var/mob/living/L in range(1, invoker)) if(!is_servant_of_ratvar(L)) continue - var/do_message = FALSE - if(L.equip_to_slot_or_del(new/obj/item/clothing/head/helmet/clockwork(null), slot_head)) - do_message = TRUE - if(L.equip_to_slot_or_del(new/obj/item/clothing/suit/armor/clockwork(null), slot_wear_suit)) - do_message = TRUE - if(L.equip_to_slot_or_del(new/obj/item/clothing/gloves/clockwork(null), slot_gloves)) - do_message = TRUE - if(L.equip_to_slot_or_del(new/obj/item/clothing/shoes/clockwork(null), slot_shoes)) - do_message = TRUE + var/do_message = 0 + do_message += L.equip_to_slot_or_del(new/obj/item/clothing/head/helmet/clockwork(null), slot_head) + do_message += L.equip_to_slot_or_del(new/obj/item/clothing/suit/armor/clockwork(null), slot_wear_suit) + do_message += L.equip_to_slot_or_del(new/obj/item/clothing/gloves/clockwork(null), slot_gloves) + do_message += L.equip_to_slot_or_del(new/obj/item/clothing/shoes/clockwork(null), slot_shoes) if(do_message) L.visible_message("Strange armor appears on [L]!", "A bright shimmer runs down your body, equipping you with Ratvarian armor.") - playsound(L, 'sound/magic/clockwork/fellowship_armory.ogg', 50, 1) + playsound(L, 'sound/magic/clockwork/fellowship_armory.ogg', 15*do_message, 1) //get sound loudness based on how much we equipped affected++ return affected diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 243baf7fdc4..53796ff7a5c 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -208,7 +208,7 @@ var/next_mob_id = 0 //This is just a commonly used configuration for the equip_to_slot_if_possible() proc, used to equip people when the rounds tarts and when events happen and such. /mob/proc/equip_to_slot_or_del(obj/item/W, slot) - equip_to_slot_if_possible(W, slot, 1, 1, 0) + return equip_to_slot_if_possible(W, slot, 1, 1, 0) //puts the item "W" into an appropriate slot in a human's inventory //returns 0 if it cannot, 1 if successful