Files
Bubberstation/code/datums/components/spin2win.dm
SkyratBot 1eab5a8364 [MIRROR] Heretics cannot be converted, and are immune to cult stun hands. Instead, the cult is rewarded for sacrificing them with the bloody bastard sword, an oversized SPIN2WIN funblade. + Soul Stealing Fantasy Affix [MDB IGNORE] (#16486)
* Heretics cannot be converted, and are immune to cult stun hands. Instead, the cult is rewarded for sacrificing them with the bloody bastard sword, an oversized SPIN2WIN funblade. + Soul Stealing Fantasy Affix (#69725)

About The Pull Request

Heretics can no longer be converted to a cult, as they follow their own Forgotten Gods.
Instead, Nar'Sie will reward the cult for managing to sacrifice one, with the bastard sword.
The bloody bastard sword has been cleaned up codewise and all that. Because it is a free reward instead of a (removed) progression mechanic of cult, it swings just a bit slower during the spin and doesn't have a jaunt. It's still a !fun! swinging sword of hilarity and death.
BLOODY BASTARD https://www.youtube.com/watch?v=ukznXQ3MgN0
Fantasy weapons can now roll "soul-stealing" weapons. They, on killing something, capture its soul inside the item.

    Add fail conditions that instantly end a spin2win, ala how

    Mimes can now hold a baguette like a sword by right clicking it #69592 works

Why It's Good For The Game

Bloody bastard sword was fun, it made no sense that heretics were valid converts when they're already worshipping a DIFFERENT evil god granting them powers. Should be in a good spot as a nice little antag to antag special interaction. I fucking love antag to antag special interactions, we should have more of 'em

Fantasy affixes are always a neat thing to throw a new component into
Changelog

cl
add: Heretics can no longer be converted to cult. But sacrificing them is very valuable to Nar'Sie, and she will grant special weapons if you manage to do so.
add: Fantasy affixes can also include soul-stealing items!
/cl

* Heretics cannot be converted, and are immune to cult stun hands. Instead, the cult is rewarded for sacrificing them with the bloody bastard sword, an oversized SPIN2WIN funblade. + Soul Stealing Fantasy Affix

Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com>
Co-authored-by: Tastyfish <crazychris32@gmail.com>
2022-09-28 11:21:35 +01:00

126 lines
4.3 KiB
Plaintext

/**
* ### Spin 2 Win component!
*
* Component that attaches to items, making their attack_self begin a spin 2 win
*/
/datum/component/spin2win
///the cooldown for spinning to winning
COOLDOWN_DECLARE(spin_cooldown)
///how long a spin2win takes to recharge.
var/spin_cooldown_time
///whether we are currently spin2winning or not.
var/spinning = FALSE
///Timer id for when we should stop spinning.
var/stop_spinning_timer_id
var/datum/callback/on_spin_callback
var/datum/callback/on_unspin_callback
var/start_spin_message
var/end_spin_message
/datum/component/spin2win/Initialize(
spin_cooldown_time = 10 SECONDS,
on_spin_callback = null,
on_unspin_callback = null,
start_spin_message = "",
end_spin_message = ""
)
if(!isitem(parent))
return COMPONENT_INCOMPATIBLE
src.spin_cooldown_time = spin_cooldown_time
src.on_spin_callback = on_spin_callback
src.on_unspin_callback = on_unspin_callback
src.start_spin_message = start_spin_message
src.end_spin_message = end_spin_message
/datum/component/spin2win/Destroy(force, silent)
QDEL_NULL(on_spin_callback)
QDEL_NULL(on_unspin_callback)
return ..()
/datum/component/spin2win/RegisterWithParent()
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/on_examine)
RegisterSignal(parent, COMSIG_ITEM_ATTACK_SELF, .proc/on_attack_self)
/datum/component/spin2win/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_PARENT_EXAMINE, COMSIG_ITEM_ATTACK_SECONDARY))
///signal called on parent being examined
/datum/component/spin2win/proc/on_examine(datum/source, mob/user, list/examine_list)
SIGNAL_HANDLER
examine_list += span_notice("Using [parent] in your hands will make you spin your weapon around for a few moments, attacking everyone near you repeatedly!")
if(spinning)
examine_list += span_warning("...Of which you are currently doing right now!")
return
if(COOLDOWN_FINISHED(src, spin_cooldown))
examine_list += span_notice("It has a cooldown of [DisplayTimeText(spin_cooldown_time)].")
else
examine_list += span_notice("It will be ready to spin again in [DisplayTimeText(COOLDOWN_TIMELEFT(src, spin_cooldown))].")
/datum/component/spin2win/proc/on_attack_self(datum/source, mob/user, location, direction)
SIGNAL_HANDLER
if(spinning)
user.balloon_alert(user, "already active!")
return
if(!COOLDOWN_FINISHED(src, spin_cooldown))
user.balloon_alert(user, "on cooldown!")
return
start_spinning(user)
/datum/component/spin2win/proc/start_spinning(mob/living/spinning_user)
//user will always exist for the start
spinning = TRUE
spinning_user.changeNext_move(5 SECONDS)
if(on_spin_callback)
on_spin_callback.Invoke(spinning_user)
if(start_spin_message)
var/message = replacetext(start_spin_message, "%USER", spinning_user)
spinning_user.visible_message(message)
playsound(spinning_user, 'sound/weapons/fwoosh.ogg', 75, FALSE)
stop_spinning_timer_id = addtimer(CALLBACK(src, .proc/stop_spinning, spinning_user), 5 SECONDS, TIMER_STOPPABLE|TIMER_DELETE_ME)
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, .proc/on_spin_equipped)
RegisterSignal(parent, COMSIG_ITEM_DROPPED, .proc/on_spin_dropped)
START_PROCESSING(SSprocessing, src)
/datum/component/spin2win/proc/stop_spinning(mob/living/user)
//user might not exist for the end
STOP_PROCESSING(SSprocessing, src)
UnregisterSignal(parent, list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED))
deltimer(stop_spinning_timer_id)
playsound(user, 'sound/weapons/fwoosh.ogg', 75, FALSE)
if(user && end_spin_message)
var/message = replacetext(end_spin_message, "%USER", user)
user.visible_message(message)
if(on_unspin_callback)
on_unspin_callback.Invoke(user, 5 SECONDS)
COOLDOWN_START(src, spin_cooldown, spin_cooldown_time)
spinning = FALSE
/datum/component/spin2win/process(delta_time)
var/obj/item/spinning_item = parent
if(!isliving(spinning_item.loc))
stop_spinning()
return PROCESS_KILL
var/mob/living/item_owner = spinning_item.loc
item_owner.emote("spin")
playsound(item_owner, 'sound/weapons/fwoosh.ogg', 75, FALSE)
for(var/mob/living/victim in orange(1, item_owner))
spinning_item.attack(victim, item_owner)
/datum/component/spin2win/proc/on_spin_dropped(datum/source, mob/user)
SIGNAL_HANDLER
stop_spinning(user)
/datum/component/spin2win/proc/on_spin_equipped(datum/source, mob/equipper, slot)
SIGNAL_HANDLER
if(slot != ITEM_SLOT_HANDS)
stop_spinning(equipper)