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

Fix Persuasion Rack Bugs #1591

Merged
merged 5 commits into from
Apr 12, 2024
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@
var/disloyalty_confirm = FALSE
/// Prevents popup spam.
var/disloyalty_offered = FALSE
// Prevent spamming torture via spam click. Otherwise they're able to lose a lot of blood quickly
var/torture_debounce = FALSE
Bastian0930 marked this conversation as resolved.
Show resolved Hide resolved

/obj/structure/bloodsucker/vassalrack/Initialize(mapload)
. = ..()
Expand Down Expand Up @@ -282,6 +284,9 @@
balloon_alert(user, "someone else's vassal!")
return FALSE

if(isanimal_or_basicmob(target))
Bastian0930 marked this conversation as resolved.
Show resolved Hide resolved
balloon_alert(user, "you can't torture an animal or basic mob!")
return FALSE
var/disloyalty_requires = RequireDisloyalty(user, target)

if(HAS_TRAIT(target, TRAIT_MINDSHIELD))
Expand All @@ -294,44 +299,49 @@

// Conversion Process
if(convert_progress)
balloon_alert(user, "spilling blood...")
bloodsuckerdatum.AddBloodVolume(-TORTURE_BLOOD_HALF_COST)
if(!do_torture(user, target))
return FALSE
bloodsuckerdatum.AddBloodVolume(-TORTURE_BLOOD_HALF_COST)
// Prevent them from unbuckling themselves as long as we're torturing.
target.Paralyze(1 SECONDS)
convert_progress--

// We're done? Let's see if they can be Vassal.
if(convert_progress)
balloon_alert(user, "needs more persuasion...")
return

if(disloyalty_requires)
balloon_alert(user, "has external loyalties! more persuasion required!")
else
balloon_alert(user, "ready for communion!")
return

if(!disloyalty_confirm && disloyalty_requires)
if(!do_disloyalty(user, target))
//Are we currently torturing this person? If so, do not spill blood more.
if(!torture_debounce)
Bastian0930 marked this conversation as resolved.
Show resolved Hide resolved
//We're torturing. Do not start another torture on this rack.
torture_debounce = TRUE
balloon_alert(user, "spilling blood...")
bloodsuckerdatum.AddBloodVolume(-TORTURE_BLOOD_HALF_COST)
if(!do_torture(user, target))
return FALSE
bloodsuckerdatum.AddBloodVolume(-TORTURE_BLOOD_HALF_COST)
// Prevent them from unbuckling themselves as long as we're torturing.
target.Paralyze(1 SECONDS)
convert_progress--

// We're done? Let's see if they can be Vassal.
if(convert_progress)
balloon_alert(user, "needs more persuasion...")
return

if(disloyalty_requires)
balloon_alert(user, "has external loyalties! more persuasion required!")
else
balloon_alert(user, "ready for communion!")
return

if(!disloyalty_confirm && disloyalty_requires)
if(!do_disloyalty(user, target))
return
if(!disloyalty_confirm)
balloon_alert(user, "refused persuasion!")
else
balloon_alert(user, "ready for communion!")
return
//If they don't need any more torture, start converting them into a vassal!
else
user.balloon_alert_to_viewers("smears blood...", "painting bloody marks...")
if(!do_after(user, 5 SECONDS, target))
balloon_alert(user, "interrupted!")
return
if(!disloyalty_confirm)
balloon_alert(user, "refused persuasion!")
else
balloon_alert(user, "ready for communion!")
return

user.balloon_alert_to_viewers("smears blood...", "painting bloody marks...")
if(!do_after(user, 5 SECONDS, target))
balloon_alert(user, "interrupted!")
return
// Convert to Vassal!
bloodsuckerdatum.AddBloodVolume(-TORTURE_CONVERSION_COST)
if(bloodsuckerdatum.make_vassal(target))
remove_loyalties(target)
SEND_SIGNAL(bloodsuckerdatum, BLOODSUCKER_MADE_VASSAL, user, target)
// Convert to Vassal!
bloodsuckerdatum.AddBloodVolume(-TORTURE_CONVERSION_COST)
if(bloodsuckerdatum.make_vassal(target))
remove_loyalties(target)
SEND_SIGNAL(bloodsuckerdatum, BLOODSUCKER_MADE_VASSAL, user, target)

/obj/structure/bloodsucker/vassalrack/proc/do_torture(mob/living/user, mob/living/carbon/target, mult = 1)
// Fifteen seconds if you aren't using anything. Shorter with weapons and such.
Expand Down Expand Up @@ -363,6 +373,8 @@
torture_time = max(5 SECONDS, torture_time * 10)
// Now run process.
if(!do_after(user, (torture_time * mult), target))
//Torture failed. You can start again.
torture_debounce = FALSE
return FALSE

if(held_item)
Expand All @@ -374,6 +386,8 @@
INVOKE_ASYNC(target, TYPE_PROC_REF(/mob, emote), "scream")
target.set_timed_status_effect(5 SECONDS, /datum/status_effect/jitter, only_if_higher = TRUE)
target.apply_damages(brute = torture_dmg_brute, burn = torture_dmg_burn, def_zone = selected_bodypart.body_zone)
//Torture succeeded. You may torture again.
torture_debounce = FALSE
return TRUE

/// Offer them the oppertunity to join now.
Expand Down
Loading