mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-30 11:32:20 +00:00
[MIRROR] Minebots will no longer attempt to stop you from committing suicide by killing you (#28372)
* Minebots will no longer attempt to stop you from committing suicide by killing you (#83919) ## About The Pull Request The `/datum/pet_command/protect_owner` behaviour did not have any validation for if the person who attacked you was yourself. The three mobs which used this behaviour would sometimes be capable of seeing you accidentally slap yourself with a burrito and decide that this meant that you needed to be protected from this hideous and violent aggressor (yourself), and would then start trying to kill you. If you had multiple minebots they would then start attacking each other in a fit of jealous and protective rage, which I think was quite funny but isn't supposed to be how the game works. * Minebots will no longer attempt to stop you from committing suicide by killing you --------- Co-authored-by: Jacquerel <hnevard@gmail.com>
This commit is contained in:
@@ -222,6 +222,8 @@
|
||||
var/protect_range = 9
|
||||
///the behavior we will use when he is attacked
|
||||
var/protect_behavior = /datum/ai_behavior/basic_melee_attack
|
||||
///message cooldown to prevent too many people from telling you not to commit suicide
|
||||
COOLDOWN_DECLARE(self_harm_message_cooldown)
|
||||
|
||||
/datum/pet_command/protect_owner/add_new_friend(mob/living/tamer)
|
||||
RegisterSignal(tamer, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(set_attacking_target))
|
||||
@@ -252,6 +254,13 @@
|
||||
var/mob/living/basic/owner = weak_parent.resolve()
|
||||
if(isnull(owner))
|
||||
return
|
||||
if(source == attacker)
|
||||
var/list/interventions = owner.ai_controller?.blackboard[BB_OWNER_SELF_HARM_RESPONSES] || list()
|
||||
if (length(interventions) && COOLDOWN_FINISHED(src, self_harm_message_cooldown) && prob(30))
|
||||
COOLDOWN_START(src, self_harm_message_cooldown, 5 SECONDS)
|
||||
var/chosen_statement = pick(interventions)
|
||||
INVOKE_ASYNC(owner, TYPE_PROC_REF(/atom/movable, say), chosen_statement)
|
||||
return
|
||||
var/mob/living/current_target = owner.ai_controller?.blackboard[BB_CURRENT_PET_TARGET]
|
||||
if(attacker == current_target) //we are already dealing with this target
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user