Skip to content

Commit

Permalink
Adds a "Twisted Construction" spell variant to Clock Cult Theme (MrMe…
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMelbert authored Jan 14, 2022
1 parent 59d1c40 commit 88f7d3f
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 11 deletions.
1 change: 1 addition & 0 deletions jollystation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -4222,6 +4222,7 @@
#include "jollystation_modules\code\modules\antagonists\advanced_cult\clock_cult\magic\clock_magic.dm"
#include "jollystation_modules\code\modules\antagonists\advanced_cult\clock_cult\magic\clock_magic_conceal.dm"
#include "jollystation_modules\code\modules\antagonists\advanced_cult\clock_cult\magic\clock_magic_disable.dm"
#include "jollystation_modules\code\modules\antagonists\advanced_cult\clock_cult\magic\clock_magic_item_conversion.dm"
#include "jollystation_modules\code\modules\antagonists\advanced_cult\clock_cult\magic\clock_magic_shackles.dm"
#include "jollystation_modules\code\modules\antagonists\advanced_cult\clock_cult\magic\clock_magic_slab.dm"
#include "jollystation_modules\code\modules\antagonists\advanced_cult\clock_cult\magic\clock_magic_teleport.dm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,18 @@
qdel(conversion_effect)
return

if(QDELETED(src) || QDELETED(target_turf) || QDELETED(user))
qdel(conversion_effect)
return

for(var/obj/thing in target_turf)
if(QDELETED(src) || QDELETED(user))
qdel(conversion_effect)
return

if(QDELETED(thing))
continue

// Effects can be skipped
if(iseffect(thing))
continue
Expand Down Expand Up @@ -159,11 +170,24 @@
if(!do_after(user, 1 SECONDS, thing))
qdel(conversion_effect)
return

if(QDELETED(src) || QDELETED(user))
qdel(conversion_effect)
return

if(QDELETED(thing))
continue

conversion_effect.completion_fade(200)

thing.ratvar_act()
playsound(target_turf, 'sound/machines/click.ogg', 50, TRUE)

if(QDELETED(src) || QDELETED(target_turf) || QDELETED(user))
qdel(conversion_effect)
return

target_turf.visible_message(span_brass("[target_turf] glows a bright blue as it suddenly appears encased in brass!"), ignored_mobs = user)
to_chat(user, span_brass("You use [src] to convert [target_turf] to brass."))
target_turf.ratvar_act(FALSE)
animate(conversion_effect, alpha = 0, time = 0.5 SECONDS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
return

active = TRUE
RegisterSignal(target, COMSIG_ITEM_ATTACK, .proc/try_spell_effects)
RegisterSignal(target, COMSIG_ITEM_PRE_ATTACK, .proc/try_spell_effects)
RegisterSignal(target, COMSIG_PARENT_EXAMINE, .proc/on_examine)
RegisterSignal(target, COMSIG_ITEM_EQUIPPED, .proc/on_equipped)
if(active_overlay_name)
Expand All @@ -101,7 +101,7 @@
magic_source.owner.update_icon(UPDATE_OVERLAYS)

UnregisterSignal(target, list(
COMSIG_ITEM_ATTACK,
COMSIG_ITEM_PRE_ATTACK,
COMSIG_PARENT_EXAMINE,
COMSIG_ITEM_EQUIPPED,
COMSIG_ITEM_DROPPED,
Expand Down Expand Up @@ -177,26 +177,33 @@
magic_source.owner.update_icon(UPDATE_OVERLAYS)

/*
* Signal proc for [COMSIG_ITEM_ATTACK].
* Signal proc for [COMSIG_ITEM_PRE_ATTACK].
*
* Calls do_self_spell_effects() if (user) hits themselves with (target).
* Calls do_hit_spell_effects() if (user) hits (victim) with (target).
*
* Calls do_hit_spell_effects() if (user) hits (a mob, hit) with (target).
* Calls do_atom_spell_effects() if (user) hits (a non-mob atom, hit) with (target).
* If either return TRUE, and manually_handle_charges is FALSE,
* then we call after_successful_spell().
*/
/datum/action/item_action/cult/proc/try_spell_effects(datum/source, mob/living/victim, mob/living/user)
/datum/action/item_action/cult/proc/try_spell_effects(datum/source, atom/hit, mob/user, params)
SIGNAL_HANDLER

if(!IS_CULTIST(user))
return

if(victim == user)
if(do_self_spell_effects(user))
. = COMPONENT_NO_AFTERATTACK

else
if(do_hit_spell_effects(victim, user))
if(isliving(hit))
if(hit == user)
if(do_self_spell_effects(user))
. = COMPONENT_NO_AFTERATTACK

else
if(do_hit_spell_effects(hit, user))
. = COMPONENT_NO_AFTERATTACK

else if(!ismob(hit))
if(do_atom_spell_effects(hit, user))
. = COMPONENT_NO_AFTERATTACK

if(!manually_handle_charges && . == COMPONENT_NO_AFTERATTACK)
Expand All @@ -217,6 +224,13 @@
*/
/datum/action/item_action/cult/proc/do_hit_spell_effects(mob/living/victim, mob/living/user)

/*
* Called when (user) hits (hit) with (target).
*
* Return TRUE to return COMPONENT_NO_AFTERATTACK.
*/
/datum/action/item_action/cult/proc/do_atom_spell_effects(atom/hit, mob/living/user)

/*
* Called after a spell is successfuly cast.
* Forces the user to say the invocation,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/datum/action/item_action/cult/clock_spell/item_conversion
name = "Slab: Brass Touch"
desc = "Empowers the slab to convert structures and items into brass after a channel."
examine_hint = "channels on the target structure or item, morphing it into a brass Rat'varian version if possible. Turns iron into brass sheets."
button_icon_state = "integration_cog"
invocation = "Gb-hpu bs oen'ff!"
active_overlay_name = "compromise"
active_overlay_held_name = "slab_compromise"
charges = 5
manually_handle_charges = TRUE
/// Whether this is currently being channeled
var/currently_casting = FALSE

/datum/action/item_action/cult/clock_spell/item_conversion/do_atom_spell_effects(atom/hit, mob/living/user)
if(currently_casting)
to_chat(user, span_warning("You are currently channeling [src]!"))
return TRUE

INVOKE_ASYNC(src, .proc/wrap_convert_atom, hit, user)
return TRUE

/*
* Wraps [proc/convert_atom] to ensure [var/currently_casting] is enabled and disabled correctly.
*/
/datum/action/item_action/cult/clock_spell/item_conversion/proc/wrap_convert_atom(atom/hit, mob/living/user)
currently_casting = TRUE
convert_atom(hit, user)
currently_casting = FALSE

/*
* Call ratvat_act() on [hit] after a two do-afters and some time.
*/
/datum/action/item_action/cult/clock_spell/item_conversion/proc/convert_atom(atom/hit, mob/living/user)

// We generate these phrases here, becaues ratvar_act qdel's it and it could act funky
var/end_vis_message = span_brass("[hit] glows a bright blue as it suddenly appears encased in brass!")
var/end_self_message = span_brass("In a spark of blue, you transform [hit] into brass!")

var/obj/effect/rep_fab_conversion/conversion_effect = new /obj/effect/rep_fab_conversion(isturf(hit) ? hit : hit.drop_location())
var/conversion_time = 2 SECONDS

if(isstructure(hit) || ismachinery(hit))
conversion_time *= 2
if(isturf(hit))
conversion_time *= 1.5

if(conversion_time > 2 SECONDS)
playsound(get_turf(hit), 'sound/machines/airlockforced.ogg', 50, TRUE)
do_sparks(5, TRUE, hit)

animate(conversion_effect, alpha = 200, time = conversion_time)
to_chat(user, span_brass("You begin converting [hit] to brass..."))
user.whisper(invocation, language = /datum/language/common, forced = "cult invocation")

if(!do_after(user, conversion_time * 2, hit))
qdel(conversion_effect)
return

if(QDELETED(src) || QDELETED(hit) || QDELETED(user))
qdel(conversion_effect)
return

conversion_effect.SpinAnimation(7, 1)
if(!do_after(user, conversion_time, hit))
qdel(conversion_effect)
return

if(QDELETED(src) || QDELETED(hit) || QDELETED(user))
qdel(conversion_effect)
return

conversion_effect.completion_fade(200)

// Turfs have special args
if(isturf(hit))
var/turf/hit_turf = hit
hit_turf.ratvar_act(FALSE, TRUE)

// Everything else is fine though
else
hit.ratvar_act()

hit.visible_message(end_vis_message, ignored_mobs = user)
to_chat(user, end_self_message)
animate(conversion_effect, alpha = 0, time = 0.5 SECONDS)
QDEL_IN(conversion_effect, 0.6 SECONDS)

if(--charges <= 0)
qdel(src)
return

desc = base_desc + "<br><b><u>Has [charges] use\s remaining</u></b>." // TODO: Doesn't work
Binary file modified jollystation_modules/icons/mob/actions/actions_clockcult.dmi
Binary file not shown.

0 comments on commit 88f7d3f

Please sign in to comment.