Disable speaking while unconscious/dead (#362)
* Disable speaking while unconscious/dead Fixes #359 * Add CanSpeak ActionBlocker Matches the existing technique for other actions like CanUse() and CanThrow().
This commit is contained in:
committed by
Pieter-Jan Briers
parent
3e972b501a
commit
31487c1cf1
@@ -12,6 +12,8 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
bool CanUse();
|
||||
|
||||
bool CanThrow();
|
||||
|
||||
bool CanSpeak();
|
||||
}
|
||||
|
||||
public class ActionBlockerSystem : EntitySystem
|
||||
@@ -55,5 +57,15 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
}
|
||||
return canthrow;
|
||||
}
|
||||
|
||||
public static bool CanSpeak(IEntity entity)
|
||||
{
|
||||
bool canspeak = true;
|
||||
foreach (var actionblockercomponents in entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
canspeak &= actionblockercomponents.CanSpeak();
|
||||
}
|
||||
return canspeak;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user