Beispiel #1
0
 private void Awake()
 {
     Instance = this;
     Provider.onServerDisconnected += (CSteamID r) => {
         if (r != CSteamID.Nil)
         {
             OnPlayerDisconnected.TryInvoke(UnturnedPlayer.FromCSteamID(r));
         }
     };
     Provider.onServerShutdown  += () => { onShutdown.TryInvoke(); };
     Provider.onServerConnected += (CSteamID r) => {
         if (r != CSteamID.Nil)
         {
             UnturnedPlayer p = (UnturnedPlayer)UnturnedPlayer.FromCSteamID(r);
             p.Player.gameObject.TryAddComponent <UnturnedPlayerFeatures>();
             p.Player.gameObject.TryAddComponent <UnturnedPlayerMovement>();
             p.Player.gameObject.TryAddComponent <UnturnedPlayerEvents>();
             OnBeforePlayerConnected.TryInvoke(p);
         }
     };
     DamageTool.playerDamaged += (SDG.Unturned.Player player, ref EDeathCause cause, ref ELimb limb, ref CSteamID killer, ref Vector3 direction, ref float damage, ref float times, ref bool canDamage) =>
     {
         if (OnPlayerDamaged != null)
         {
             if (player != null && killer != CSteamID.Nil && killer != null)
             {
                 UnturnedPlayer getterDamage = UnturnedPlayer.FromPlayer(player);
                 UnturnedPlayer senderDamage = UnturnedPlayer.FromCSteamID(killer);
                 OnPlayerDamaged.TryInvoke(getterDamage, cause, limb, senderDamage, direction, damage, times, canDamage);
             }
         }
     };
 }
Beispiel #2
0
 private void Awake()
 {
     Instance = this;
     Provider.onServerDisconnected += (CSteamID r) => {
         if (r != CSteamID.Nil)
         {
             OnPlayerDisconnected.TryInvoke(UnturnedPlayer.FromCSteamID(r));
         }
     };
     Provider.onServerShutdown  += () => { onShutdown.TryInvoke(); };
     Provider.onServerConnected += (CSteamID r) => {
         if (r != CSteamID.Nil)
         {
             UnturnedPlayer p = (UnturnedPlayer)UnturnedPlayer.FromCSteamID(r);
             p.Player.gameObject.TryAddComponent <UnturnedPlayerFeatures>();
             p.Player.gameObject.TryAddComponent <UnturnedPlayerMovement>();
             p.Player.gameObject.TryAddComponent <UnturnedPlayerEvents>();
             OnBeforePlayerConnected.TryInvoke(p);
         }
     };
     DamageTool.damagePlayerRequested += (ref DamagePlayerParameters parameters, ref bool shouldAllow) =>
     {
         if (OnPlayerDamaged != null)
         {
             if (parameters.player != null && parameters.killer != CSteamID.Nil && parameters.killer != null)
             {
                 UnturnedPlayer getterDamage = UnturnedPlayer.FromPlayer(parameters.player);
                 UnturnedPlayer senderDamage = UnturnedPlayer.FromCSteamID(parameters.killer);
                 OnPlayerDamaged.TryInvoke(getterDamage, parameters.cause, parameters.limb, senderDamage, parameters.direction, parameters.damage, parameters.times, shouldAllow);
             }
         }
     };
 }
 internal void Awake()
 {
     Instance = this;
     Provider.onServerDisconnected += (CSteamID r) =>
     {
         if (r != CSteamID.Nil)
         {
             OnPlayerDisconnected.TryInvoke(UnturnedPlayer.FromCSteamID(r));
         }
     };
     Provider.onServerShutdown  += () => { OnShutdown.TryInvoke(); };
     Provider.onServerConnected += (CSteamID r) =>
     {
         if (r != CSteamID.Nil)
         {
             UnturnedPlayer p  = UnturnedPlayer.FromCSteamID(r);
             var            go = p.Player.gameObject;
             go.TryAddComponent <UnturnedPlayerFeatures>();
             go.TryAddComponent <UnturnedPlayerMovement>();
             go.TryAddComponent <UnturnedPlayerEvents>();
             OnBeforePlayerConnected.TryInvoke(p);
         }
     };
     DamageTool.damagePlayerRequested += newOnDamage;
 }
 private void OnServerConnected(CSteamID steamid)
 {
     if (steamid != CSteamID.Nil)
     {
         UnturnedPlayer p = (UnturnedPlayer)UnturnedPlayer.FromCSteamID(steamid);
         p.Player.gameObject.TryAddComponent <UnturnedPlayerFeatures>();
         p.Player.gameObject.TryAddComponent <UnturnedPlayerMovement>();
         p.Player.gameObject.TryAddComponent <UnturnedPlayerEvents>();
         OnBeforePlayerConnected.TryInvoke(p);
     }
 }
Beispiel #5
0
 private void Awake()
 {
     Instance = this;
     Steam.OnServerDisconnected += (CSteamID r) => { OnPlayerDisconnected.TryInvoke(UnturnedPlayer.FromCSteamID(r)); };
     Steam.OnServerShutdown     += () => { onShutdown.TryInvoke(); };
     Steam.OnServerConnected    += (CSteamID r) => {
         UnturnedPlayer p = UnturnedPlayer.FromCSteamID(r);
         p.Player.gameObject.TryAddComponent <UnturnedPlayerFeatures>();
         p.Player.gameObject.TryAddComponent <UnturnedPlayerEvents>();
         OnBeforePlayerConnected.TryInvoke(p);
     };
 }
 private void Awake()
 {
     Instance = this;
     Provider.onServerDisconnected += (CSteamID r) => {
         if (r != CSteamID.Nil)
         {
             OnPlayerDisconnected.TryInvoke(UnturnedPlayer.FromCSteamID(r));
         }
     };
     Provider.onServerShutdown  += () => { onShutdown.TryInvoke(); };
     Provider.onServerConnected += (CSteamID r) => {
         if (r != CSteamID.Nil)
         {
             UnturnedPlayer p = (UnturnedPlayer)UnturnedPlayer.FromCSteamID(r);
             p.Player.gameObject.TryAddComponent <UnturnedPlayerFeatures>();
             p.Player.gameObject.TryAddComponent <UnturnedPlayerMovement>();
             p.Player.gameObject.TryAddComponent <UnturnedPlayerEvents>();
             OnBeforePlayerConnected.TryInvoke(p);
         }
     };
 }