Upload from upload_mods.ps1
This commit is contained in:
54
Scripts/MinEvents/MinEventActionPushRebirth.cs
Normal file
54
Scripts/MinEvents/MinEventActionPushRebirth.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System.Globalization;
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class MinEventActionPushRebirth : MinEventActionTargetedBase
|
||||
{
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
//Log.Out("MinEventActionPushRebirth-Execute 1");
|
||||
DamageResponse dmResponse = DamageResponse.New(false);
|
||||
dmResponse.StunDuration = this.duration;
|
||||
dmResponse.Strength = (int)this.force;
|
||||
Vector3 vector = _params.StartPosition;
|
||||
if (vector.y == 0f)
|
||||
{
|
||||
//Log.Out("MinEventActionPushRebirth-Execute 2");
|
||||
vector = _params.Self.position;
|
||||
}
|
||||
for (int i = 0; i < this.targets.Count; i++)
|
||||
{
|
||||
//Log.Out("MinEventActionPushRebirth-Execute 3");
|
||||
EntityAlive entityAlive = this.targets[i];
|
||||
Vector3 vector2 = entityAlive.position - vector;
|
||||
vector2.y = 0f;
|
||||
dmResponse.Source = new DamageSource(EnumDamageSource.External, EnumDamageTypes.Bashing, vector2.normalized);
|
||||
entityAlive.DoRagdoll(dmResponse);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ParseXmlAttribute(XAttribute _attribute)
|
||||
{
|
||||
bool flag = base.ParseXmlAttribute(_attribute);
|
||||
if (!flag)
|
||||
{
|
||||
string name = _attribute.Name.LocalName;
|
||||
if (name != null)
|
||||
{
|
||||
if (name == "duration")
|
||||
{
|
||||
this.duration = StringParsers.ParseFloat(_attribute.Value, 0, -1, NumberStyles.Any);
|
||||
return true;
|
||||
}
|
||||
if (name == "force")
|
||||
{
|
||||
this.force = StringParsers.ParseFloat(_attribute.Value, 0, -1, NumberStyles.Any);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private float duration = 2.5f;
|
||||
private float force;
|
||||
}
|
||||
Reference in New Issue
Block a user