Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Guardian Creator item code; Fix Timestop Guardian to not overwrite Standard Guardian #685

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions code/modules/mob/living/basic/guardian/guardian_creator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,27 @@ GLOBAL_LIST_INIT(guardian_radial_images, setup_guardian_radial())
mob_name = using_theme.name

/obj/item/guardian_creator/attack_self(mob/living/user)
if(allowed_to_get_new_guardian(user))
show_guardian_type_selector(user)

/obj/item/guardian_creator/proc/allowed_to_get_new_guardian(mob/living/user)
if(isguardian(user) && !allow_guardian)
balloon_alert(user, "can't do that!")
return
return FALSE
var/list/guardians = user.get_all_linked_holoparasites()
if(length(guardians) && !allow_multiple)
balloon_alert(user, "already have one!")
return
return FALSE
if(user.mind && user.mind.has_antag_datum(/datum/antagonist/changeling) && !allow_changeling)
to_chat(user, ling_failure)
return
return FALSE
if(used)
to_chat(user, used_message)
return
return FALSE

return TRUE

/obj/item/guardian_creator/proc/show_guardian_type_selector(mob/living/user)
var/list/radial_options = GLOB.guardian_radial_images.Copy()
for(var/possible_guardian in radial_options)
if(possible_guardian in possible_guardians)
Expand All @@ -84,6 +92,10 @@ GLOBAL_LIST_INIT(guardian_radial_images, setup_guardian_radial())
guardian_path = show_radial_menu(user, src, radial_options, custom_check = CALLBACK(src, PROC_REF(check_menu), user), radius = 42, require_near = TRUE)
if(isnull(guardian_path))
return

poll_for_guardian_player(user, guardian_path)

/obj/item/guardian_creator/proc/poll_for_guardian_player(mob/living/user, mob/living/basic/guardian/guardian_path)
used = TRUE
to_chat(user, use_message)
var/guardian_type_name = random ? "Random" : capitalize(initial(guardian_path.creator_name))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
///Bloodsuckers spawning a Guardian will get the Bloodsucker one instead.
/obj/item/guardian_creator/spawn_guardian(mob/living/user, mob/dead/candidate)
var/list/guardians = user.get_all_linked_holoparasites()
if(length(guardians))
to_chat(user, span_holoparasite("You already have a [mob_name]!"))
used = FALSE
return
if(IS_BLOODSUCKER(user))
var/mob/living/basic/guardian/standard/bloodsucker_guardian = new(user, GUARDIAN_THEME_MAGIC)

bloodsucker_guardian.set_summoner(user, different_person = TRUE)
bloodsucker_guardian.key = candidate.key
user.log_message("has summoned [key_name(bloodsucker_guardian)], a [bloodsucker_guardian.creator_name] holoparasite.", LOG_GAME)
bloodsucker_guardian.log_message("was summoned as a [bloodsucker_guardian.creator_name] holoparasite.", LOG_GAME)
to_chat(user, replacetext(success_message, "%GUARDIAN", mob_name))
bloodsucker_guardian.client?.init_verbs()
/obj/item/guardian_creator/attack_self(mob/living/user)
if(allowed_to_get_new_guardian(user) && IS_BLOODSUCKER(user))
poll_for_guardian_player(user, /mob/living/basic/guardian/standard/timestop)
return

// Call parent to deal with everyone else
Expand All @@ -22,15 +10,15 @@
/**
* The Guardian itself
*/
/mob/living/basic/guardian/standard
/mob/living/basic/guardian/standard/timestop
// Like Bloodsuckers do, you will take more damage to Burn and less to Brute
damage_coeff = list(BRUTE = 0.5, BURN = 2.5, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0)

creator_name = "Timestop"
creator_desc = "Devastating close combat attacks and high damage resistance. Can smash through weak walls and stop time."
creator_icon = "standard"

/mob/living/basic/guardian/standard/Initialize(mapload, theme)
/mob/living/basic/guardian/standard/timestop/Initialize(mapload, theme)
//Wizard Holoparasite theme, just to be more visibly stronger than regular ones
theme = GLOB.guardian_themes[GUARDIAN_THEME_TECH]
. = ..()
Expand All @@ -40,8 +28,9 @@
///Guardian Timestop ability
/datum/action/cooldown/spell/timestop/guardian
name = "Guardian Timestop"
desc = "This spell stops time for everyone except for you and your master, \
allowing you to move freely while your enemies and even projectiles are frozen."
desc = "This spell stops time for everyone (including your master) in a \
small radius around you, allowing you to move freely while your \
enemies and even projectiles are frozen."
cooldown_time = 60 SECONDS
spell_requirements = NONE
invocation_type = INVOCATION_NONE
Expand Down
Loading