Client LuaCsForBarotrauma
CheckTraitorVoteAction.cs
1
#nullable enable
2
using
Barotrauma
.
Networking
;
3
using
System.Linq;
4
5
namespace
Barotrauma
6
{
10
class
CheckTraitorVoteAction
:
BinaryOptionAction
11
{
12
[
Serialize
(
""
,
IsPropertySaveable
.Yes, description:
"Tag of the character to check."
)]
13
public
Identifier
Target
{
get
;
set
; }
14
15
public
CheckTraitorVoteAction
(
ScriptedEvent
parentEvent,
ContentXElement
element) : base(parentEvent, element)
16
{
17
if
(parentEvent is not
TraitorEvent
)
18
{
19
DebugConsole.ThrowError($
"Error in event \"{parentEvent.Prefab.Identifier}\" - {nameof(CheckTraitorVoteAction)} can only be used in traitor events."
,
20
contentPackage: element.
ContentPackage
);
21
}
22
}
23
24
protected
override
bool
?
DetermineSuccess
()
25
{
26
var targetEntities =
ParentEvent
.
GetTargets
(
Target
);
27
#if SERVER
28
if
(
GameMain
.Server?.TraitorManager?.GetClientAccusedAsTraitor() is
Client
traitorClient)
29
{
30
return
targetEntities.Any(e => e is
Character
character && traitorClient?.
Character
== character);
31
}
32
#endif
33
return
false
;
34
}
35
36
public
override
string
ToDebugString
()
37
{
38
return
$
"{ToolBox.GetDebugSymbol(succeeded.HasValue)} {nameof(CheckTraitorVoteAction)} -> (TargetTag: {Target.ColorizeObject()}"
;
39
}
40
}
41
}
Barotrauma.BinaryOptionAction
Definition:
BinaryOptionAction.cs:8
Barotrauma.Character
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:32
Barotrauma.CheckTraitorVoteAction
Checks whether the specific target was voted as the traitor.
Definition:
CheckTraitorVoteAction.cs:11
Barotrauma.CheckTraitorVoteAction.CheckTraitorVoteAction
CheckTraitorVoteAction(ScriptedEvent parentEvent, ContentXElement element)
Definition:
CheckTraitorVoteAction.cs:15
Barotrauma.CheckTraitorVoteAction.DetermineSuccess
override? bool DetermineSuccess()
Definition:
CheckTraitorVoteAction.cs:24
Barotrauma.CheckTraitorVoteAction.Target
Identifier Target
Definition:
CheckTraitorVoteAction.cs:13
Barotrauma.CheckTraitorVoteAction.ToDebugString
override string ToDebugString()
Rich test to display in debugdraw
Definition:
CheckTraitorVoteAction.cs:36
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.ContentPackage
ContentPackage? ContentPackage
Definition:
ContentXElement.cs:14
Barotrauma.EventAction.ParentEvent
readonly ScriptedEvent ParentEvent
Definition:
EventAction.cs:106
Barotrauma.GameMain
Definition:
GameMain.cs:25
Barotrauma.Networking.Client
Definition:
LuaBarotraumaAdditions.cs:11
Barotrauma.ScriptedEvent
Definition:
ScriptedEvent.cs:9
Barotrauma.ScriptedEvent.GetTargets
IEnumerable< Entity > GetTargets(Identifier tag)
Definition:
ScriptedEvent.cs:300
Barotrauma.Serialize
Definition:
SerializableProperty.cs:23
Barotrauma.TraitorEvent
Definition:
TraitorEvent.cs:10
Barotrauma.Networking
Definition:
LuaBarotraumaAdditions.cs:9
Barotrauma
Definition:
AchievementManager.cs:12
Barotrauma.IsPropertySaveable
IsPropertySaveable
Definition:
SerializableProperty.cs:16
Barotrauma
BarotraumaShared
SharedSource
Events
EventActions
CheckTraitorVoteAction.cs
Generated by
1.9.1