From f52625b18c1ff0e37aaab13f0151d11cb0b3a79a Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Mon, 15 May 2017 17:54:16 -0500 Subject: [PATCH] Refactors supply talismans to be less shitcode --- code/game/gamemodes/cult/supply.dm | 124 ++++++++++++++++++ code/game/gamemodes/cult/talisman.dm | 68 ---------- .../items/stacks/sheets/sheet_types.dm | 9 +- tgstation.dme | 1 + 4 files changed, 131 insertions(+), 71 deletions(-) create mode 100644 code/game/gamemodes/cult/supply.dm diff --git a/code/game/gamemodes/cult/supply.dm b/code/game/gamemodes/cult/supply.dm new file mode 100644 index 0000000000..71b8c941b1 --- /dev/null +++ b/code/game/gamemodes/cult/supply.dm @@ -0,0 +1,124 @@ +//Supply Talisman: Has a few unique effects. Granted only to starter cultists. +/obj/item/weapon/paper/talisman/supply + cultist_name = "Supply Talisman" + cultist_desc = "A multi-use talisman that can create various objects. Intended to increase the cult's strength early on." + invocation = null + uses = 3 + var/list/possible_summons = list( + /datum/cult_supply/tome, + /datum/cult_supply/metal, + /datum/cult_supply/talisman/teleport, + /datum/cult_supply/talisman/emp, + /datum/cult_supply/talisman/stun, + /datum/cult_supply/talisman/veil, + /datum/cult_supply/soulstone, + /datum/cult_supply/construct_shell + ) + +/obj/item/weapon/paper/talisman/supply/invoke(mob/living/user, successfuluse = 1) + var/list/dat = list() + dat += "There are [uses] bloody runes on the parchment.
" + dat += "Please choose the chant to be imbued into the fabric of reality.
" + dat += "
" + for(var/s in possible_summons) + var/datum/cult_supply/S = s + dat += "[initial(S.invocation)] - [initial(S.desc)]
" + var/datum/browser/popup = new(user, "talisman", "", 400, 400) + popup.set_content(dat.Join("")) + popup.open() + return 0 + +/obj/item/weapon/paper/talisman/supply/Topic(href, href_list) + world.log << "[usr], [href], [href_list]" + if(QDELETED(src) || usr.incapacitated() || !in_range(src, usr)) + return + + var/id = href_list["id"] + var/datum/cult_supply/match + + for(var/s in possible_summons) + var/datum/cult_supply/S = s + if(initial(S.id) == id) + match = S + break + + if(!match) + to_chat(usr, "The fabric of reality quivers in agony.") + return + + var/turf/T = get_turf(src) + var/summon_type = initial(match.summon_type) + + + var/atom/movable/AM = new summon_type(T) + if(istype(AM, /obj/item)) + usr.put_in_hands(AM) + + uses-- + if(uses <= 0) + to_chat(usr, "[src] crumbles to dust.") + burn() + +/obj/item/weapon/paper/talisman/supply/weak + cultist_name = "Lesser Supply Talisman" + uses = 2 + +/obj/item/weapon/paper/talisman/supply/weak/Initialize(mapload) + . = ..() + // no runed metal from lesser talismans. + possible_summons -= /datum/cult_supply/metal + +/datum/cult_supply + var/id = "used_popcorn" + var/invocation = "Pla'ceho'lder." + var/desc = "Summons a generic supply item, to aid the cult." + var/summon_type = /obj/item/trash/popcorn // wait this isn't useful + +/datum/cult_supply/tome + id = "arcane_tome" + invocation = "N'ath reth sh'yro eth d'raggathnor!" + desc = "Summons an arcane tome, used to scribe runes." + summon_type = /obj/item/weapon/tome + +/datum/cult_supply/metal + id = "runed_metal" + invocation = "Bar'tea eas!" + desc = "Provides 5 runed metal, which can build a variety of cult structures." + summon_type = /obj/item/stack/sheet/runed_metal/five + +/datum/cult_supply/talisman/teleport + id = "teleport_talisman" + invocation = "Sas'so c'arta forbici!" + desc = "Allows you to move to a selected teleportation rune." + summon_type = /obj/item/weapon/paper/talisman/teleport + +/datum/cult_supply/talisman/emp + id = "emp_talisman" + invocation = "Ta'gh fara'qha fel d'amar det!" + desc = "Allows you to destroy technology in a short range." + summon_type = /obj/item/weapon/paper/talisman/emp + +/datum/cult_supply/talisman/stun + id = "stun_talisman" + invocation = "Fuu ma'jin!" + desc = "Allows you to stun a person by attacking them with the talisman. Does not work on people holding a holy weapon!" + summon_type = /obj/item/weapon/paper/talisman/stun + +/datum/cult_supply/talisman/veil + id = "veil_talisman" + invocation = "Kla'atu barada nikt'o!" + desc = "Two use talisman, first use makes all nearby runes invisible, secnd use reveals nearby hidden runes." + summon_type = /obj/item/weapon/paper/talisman/true_sight + +/datum/cult_supply/soulstone + id = "soulstone" + invocation = "Kal'om neth!" + desc = "Summons a soul stone, used to capture the spirits of dead or dying humans." + summon_type = /obj/item/device/soulstone + +/datum/cult_supply/construct_shell + id = "construct_shell" + invocation = "Daa'ig osk!" + desc = "Summons a construct shell for use with soulstone-captured souls. It is too large to carry on your person." + summon_type = /obj/structure/constructshell + diff --git a/code/game/gamemodes/cult/talisman.dm b/code/game/gamemodes/cult/talisman.dm index 166cb6f528..15b850eb33 100644 --- a/code/game/gamemodes/cult/talisman.dm +++ b/code/game/gamemodes/cult/talisman.dm @@ -45,74 +45,6 @@ var/mob/living/carbon/C = user C.apply_damage(10, BRUTE, "head") -//Supply Talisman: Has a few unique effects. Granted only to starter cultists. -/obj/item/weapon/paper/talisman/supply - cultist_name = "Supply Talisman" - cultist_desc = "A multi-use talisman that can create various objects. Intended to increase the cult's strength early on." - invocation = null - uses = 3 - -/obj/item/weapon/paper/talisman/supply/invoke(mob/living/user, successfuluse = 1) - var/dat = "There are [uses] bloody runes on the parchment.
" - dat += "Please choose the chant to be imbued into the fabric of reality.
" - dat += "
" - dat += "N'ath reth sh'yro eth d'raggathnor! - Summons an arcane tome, used to scribe runes and communicate with other cultists.
" - dat += "Bar'tea eas! - Provides 5 runed metal.
" - dat += "Sas'so c'arta forbici! - Allows you to move to a selected teleportation rune.
" - dat += "Ta'gh fara'qha fel d'amar det! - Allows you to destroy technology in a short range.
" - dat += "Fuu ma'jin! - Allows you to stun a person by attacking them with the talisman.
" - dat += "Kla'atu barada nikt'o! - Two use talisman, first use makes all nearby runes invisible, second use reveals nearby hidden runes.
" - dat += "Kal'om neth! - Summons a soul stone, used to capure the spirits of dead or dying humans.
" - dat += "Daa'ig osk! - Summons a construct shell for use with soulstone-captured souls. It is too large to carry on your person.
" - var/datum/browser/popup = new(user, "talisman", "", 400, 400) - popup.set_content(dat) - popup.open() - return 0 - -/obj/item/weapon/paper/talisman/supply/Topic(href, href_list) - if(src) - if(usr.stat || usr.restrained() || !in_range(src, usr)) - return - if(href_list["rune"]) - switch(href_list["rune"]) - if("newtome") - var/obj/item/weapon/tome/T = new(usr) - usr.put_in_hands(T) - if("metal") - if(istype(src, /obj/item/weapon/paper/talisman/supply/weak)) - usr.visible_message("Lesser supply talismans lack the strength to materialize runed metal!") - return - var/obj/item/stack/sheet/runed_metal/R = new(usr,5) - usr.put_in_hands(R) - if("teleport") - var/obj/item/weapon/paper/talisman/teleport/T = new(usr) - usr.put_in_hands(T) - if("emp") - var/obj/item/weapon/paper/talisman/emp/T = new(usr) - usr.put_in_hands(T) - if("runestun") - var/obj/item/weapon/paper/talisman/stun/T = new(usr) - usr.put_in_hands(T) - if("soulstone") - var/obj/item/device/soulstone/T = new(usr) - usr.put_in_hands(T) - if("construct") - new /obj/structure/constructshell(get_turf(usr)) - if("veiling") - var/obj/item/weapon/paper/talisman/true_sight/T = new(usr) - usr.put_in_hands(T) - src.uses-- - if(src.uses <= 0) - if(iscarbon(usr)) - var/mob/living/carbon/C = usr - C.drop_item() - visible_message("[src] crumbles to dust.") - qdel(src) - -/obj/item/weapon/paper/talisman/supply/weak - cultist_name = "Lesser Supply Talisman" - uses = 2 - //Rite of Translocation: Same as rune /obj/item/weapon/paper/talisman/teleport cultist_name = "Talisman of Teleportation" diff --git a/code/game/objects/items/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm index 4700f81d82..9657c7d888 100644 --- a/code/game/objects/items/stacks/sheets/sheet_types.dm +++ b/code/game/objects/items/stacks/sheets/sheet_types.dm @@ -286,13 +286,16 @@ GLOBAL_LIST_INIT(runed_metal_recipes, list ( \ return ..() -/obj/item/stack/sheet/runed_metal/fifty - amount = 50 - /obj/item/stack/sheet/runed_metal/Initialize(mapload, new_amount, merge = TRUE) recipes = GLOB.runed_metal_recipes return ..() +/obj/item/stack/sheet/runed_metal/fifty + amount = 50 + +/obj/item/stack/sheet/runed_metal/five + amount = 5 + /* * Brass */ diff --git a/tgstation.dme b/tgstation.dme index 5558002155..01889129a2 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -468,6 +468,7 @@ #include "code\game\gamemodes\cult\cult_structures.dm" #include "code\game\gamemodes\cult\ritual.dm" #include "code\game\gamemodes\cult\runes.dm" +#include "code\game\gamemodes\cult\supply.dm" #include "code\game\gamemodes\cult\talisman.dm" #include "code\game\gamemodes\devil\devil.dm" #include "code\game\gamemodes\devil\devil_game_mode.dm"