Permalink
Browse files

Added events for trails

  • Loading branch information...
SDPlugins committed Jun 11, 2017
1 parent 458eb3f commit 50eecb85c0940e6b5fb364f7c316e8f56f308b08
@@ -78,8 +78,86 @@ private void playedDisconnected (UnturnedPlayer player)
private void PlayerMoved (UnturnedPlayer player, UnityEngine.Vector3 position)
{
if (trails.ContainsKey (player.CSteamID))
EffectManager.sendEffect (trails [player.CSteamID], 80, position);
if (!trails.ContainsKey (player.CSteamID))
return;
var trail = Configuration.Instance.customTrails.Where (t => t.id == trails [player.CSteamID]).FirstOrDefault ();
string [] showOn = trail.type.Split (',');
foreach (var show in showOn)
{
switch (show.Split ('.') [0].ToLower ())
{
case "always":
break;
case "grounded":
if (!player.Player.movement.isGrounded)
return;
break;
case "notgrounded":
if (player.Player.movement.isGrounded)
return;
break;
case "jump":
if (!player.Player.movement.jump)
return;
break;
case "bleeding":
if (!player.Bleeding)
return;
break;
case "brokenbones":
if (!player.Broken)
return;
break;
case "zombiefollowing":
if (!player.Player.life.isAggressor)
return;
break;
case "equipedgun":
if (player.Player.equipment.asset == null)
return;
ushort [] guns = show.Split ('.').Select (g => ushort.Parse (g)).ToArray ();
if (!guns.Contains (player.Player.equipment.asset.id))
return;
break;
case "inwater":
if (!player.Player.stance.isSubmerged)
return;
break;
case "running":
if (!player.Player.stance.sprint)
return;
break;
case "walking":
if (player.Player.stance.sprint || player.Player.stance.crouch || player.Player.stance.prone)
return;
break;
case "prone":
if (!player.Player.stance.prone)
return;
break;
case "crouch":
if (!player.Player.stance.crouch)
return;
break;
case "talking":
if (!player.Player.voice.isTalking)
return;
break;
case "invehicle":
if (!player.IsInVehicle)
return;
ushort [] vehicles = show.Split ('.').Select (v => ushort.Parse (v)).ToArray ();
if (!vehicles.Contains (player.CurrentVehicle.id))
return;
break;
default:
break;
}
}
EffectManager.sendEffect (trails [player.CSteamID], 80, position);
}
protected override void Unload ()
@@ -41,43 +41,50 @@ public void LoadDefaults ()
{
name = "electric",
id = 61,
permission = "trail.electric"
permission = "trail.electric",
type = "ALWAYS"
},
new customTrail ()
{
name = "fire",
id = 139,
permission = "trail.fire"
permission = "trail.fire",
type = "GROUNDED"
},
new customTrail ()
{
name = "water",
id = 129,
permission = "trail.water"
permission = "trail.water",
type = "NOTGROUNDED"
},
new customTrail ()
{
name = "red",
id = 124,
permission = "trail.red"
permission = "trail.red",
type = "INWATER,VEHICLE.140.106"
},
new customTrail ()
{
name = "orange",
id = 130,
permission= "trail.orange"
permission= "trail.orange",
type = "INWATER"
},
new customTrail ()
{
name = "purple",
id = 132,
permission = "trail.purple"
permission = "trail.purple",
type = "INVEHICLE.106.104"
},
new customTrail ()
{
name = "green",
id = 134,
permission = "trail.green"
permission = "trail.green",
type = "INVEHICLE.54.52"
}
};
}
@@ -91,6 +98,8 @@ public class customTrail
public ushort id;
[XmlElement ("Permission")]
public string permission;
[XmlElement ("Type")]
public string type;
public customTrail () { }
}
BIN +3.5 KB (130%) bin/Release/Trails.dll
Binary file not shown.
BIN +2 KB (110%) bin/Release/Trails.pdb
Binary file not shown.
BIN +3.5 KB (130%) obj/Release/Trails.dll
Binary file not shown.
BIN +2 KB (110%) obj/Release/Trails.pdb
Binary file not shown.

0 comments on commit 50eecb8

Please sign in to comment.