Ejemplo n.º 1
0
 void TryToRemove(TakeDamage takedamage, RemoveHandler rplayer)
 {
     cachedStructure  = takedamage.GetComponent <StructureComponent>();
     cachedDeployable = takedamage.GetComponent <DeployableObject>();
     if (cachedStructure != null && cachedStructure._master != null)
     {
         cachedMaster = cachedStructure._master;
         if (!canRemove(rplayer, cachedMaster.ownerID.ToString()))
         {
             SendReply(rplayer.playerclient.netUser, noRemoveAccess); return;
         }
         if (rplayer.removeType == "all")
         {
             RemoveAll(cachedMaster, rplayer);
         }
         else
         {
             SimpleRemove(cachedStructure, rplayer);
         }
     }
     else if (cachedDeployable != null)
     {
         if (!canRemove(rplayer, cachedDeployable.ownerID.ToString()))
         {
             SendReply(rplayer.playerclient.netUser, noRemoveAccess); return;
         }
         DeployableRemove(cachedDeployable, rplayer);
     }
 }
Ejemplo n.º 2
0
        private void SetBuildingDeathTags(TakeDamage takedamage, DamageEvent damage, ref DeathTags tags)
        {
            var deployable = takedamage.GetComponent <DeployableObject>();
            var structure  = takedamage.GetComponent <StructureComponent>();

            if (deployable)
            {
                tags.killed   = Regex.Replace(deployable.name.Replace("(Clone)", ""), "([a-z])([A-Z])", "$1 $2");
                tags.killedId = deployable.creatorID.ToString();
            }
            else if (structure)
            {
                tags.killed   = Regex.Replace(structure.name.Replace("(Clone)", ""), "([a-z])([A-Z])", "$1 $2");
                tags.killedId = structure._master?.creatorID.ToString();
            }
            if (damage.attacker.id.GetComponent <TimedExplosive>())
            {
                tags.weapon = "Explosive Charge";
            }
            else if (damage.attacker.id.GetComponent <TimedGrenade>())
            {
                tags.weapon = "F1 Grenade";
            }
            else if (damage.attacker.id.GetComponent <EnvDecay>())
            {
                tags.weapon = "Decay";
            }
        }
Ejemplo n.º 3
0
    void Shoot()
    {
        if (Gstatus.GameSituation == false)
        {
            return;
        }
        RaycastHit hit;

        if (Physics.Raycast(mainCamera.transform.position, mainCamera.transform.forward, out hit))
        {
            if (hit.collider.CompareTag("EnemyHead"))
            {
                //GoldenKill
                if (1 == 1)
                {
                    goldenBullet.goldenBullet();
                    GoldenBulletBool = true;
                }
                else
                {
                    enemyDamageScript.GetComponent <TakeDamage>().takeDamage(damage * 2, true);
                }
            }
            if (hit.collider.CompareTag("EnemyBody"))
            {
                enemyDamageScript.GetComponent <TakeDamage>().takeDamage(damage, false);
            }
        }
        MuzzleParticle.Play();
        SceneManager.GetComponent <AmmoCount>().AmmoDecrease();
        CrossHair.SetActive(false);
        //Random Aim
        mainCamera.GetComponent <swiper>().Recoil();
    }
Ejemplo n.º 4
0
        void OnKilled(TakeDamage takedamage, DamageEvent damage)
        {
            if (!useAutoRemover)
            {
                return;
            }
            if (takedamage.GetComponent <HumanController>() == null)
            {
                return;
            }

            takedamage.GetComponent <Character>().transform.GetGroundInfo(out cachedVector1, out cachedVector2);
            timer.Once(0.01f, () => FindSack(cachedVector1));
        }
Ejemplo n.º 5
0
        public BowShootEvent(BowWeaponDataBlock bw, ItemRepresentation ir, uLink.NetworkMessageInfo ui, IBowWeaponItem ibw)
        {
            TakeDamage local = ibw.inventory.GetLocal <TakeDamage>();

            _player = Fougerite.Server.Cache[local.GetComponent <Character>().netUser.userID];
            _bw     = bw;
            _ibw    = ibw;
            _ir     = ir;
            _unmi   = ui;
        }
Ejemplo n.º 6
0
        public ShotgunShootEvent(ShotgunDataBlock bw, ItemRepresentation ir, uLink.NetworkMessageInfo ui, IBulletWeaponItem ibw)
        {
            TakeDamage local = ibw.inventory.GetLocal <TakeDamage>();

            _player = Fougerite.Server.GetServer().FindPlayer(local.GetComponent <Character>().netUser.userID);
            _bw     = bw;
            _ir     = ir;
            _ibw    = ibw;
            _unmi   = ui;
        }
Ejemplo n.º 7
0
        private void OnKilled(TakeDamage takedamage, DamageEvent damage)
        {
            WeaponImpact impact = damage.extraData as WeaponImpact;
            DeathTags    tags   = new DeathTags();

            tags.killer   = damage.attacker.client?.netUser.displayName ?? UNKNOWN;
            tags.killerId = damage.attacker.client?.netUser.userID.ToString() ?? UNKNOWN;
            tags.weapon   = impact?.dataBlock.name ?? UNKNOWN;
            tags.distance = Math.Floor(Vector3.Distance(damage.attacker.id.transform.position, damage.victim.id.transform.position));
            tags.location = damage.victim.id.transform.position;

            if (takedamage is HumanBodyTakeDamage)
            {
                SetPlayerDeathTags((HumanBodyTakeDamage)takedamage, damage, ref tags);
                CheckForHuntingBow(takedamage, damage, ref tags);
                switch (tags.deathType)
                {
                case DeathTypes.entity:
                case DeathTypes.human:
                {
                    Core.Interface.CallHook("OnPlayerDeath", takedamage, damage, tags);
                    break;
                }

                case DeathTypes.suicide:
                {
                    Core.Interface.CallHook("OnPlayerSuicide", takedamage, damage, tags);
                    break;
                }

                default:
                {
                    break;
                }
                }
            }
            else if (takedamage is ProtectionTakeDamage && damage.sender.gameObject.GetComponentInChildren <BasicWildLifeAI>() && damage.attacker.client != null)
            {
                SetAnimalDeathTags(takedamage, damage, ref tags);
                CheckForHuntingBow(takedamage, damage, ref tags);
                Core.Interface.CallHook("OnAnimalDeath", takedamage, damage, tags);
            }
            else
            {
                SetBuildingDeathTags(takedamage, damage, ref tags);
                if (takedamage.GetComponent <DeployableObject>())
                {
                    Core.Interface.CallHook("OnDeployableDestroyed", takedamage, damage, tags);
                }
                else
                {
                    Core.Interface.CallHook("OnStructureDestroyed", takedamage, damage, tags);
                }
            }
        }
Ejemplo n.º 8
0
        public GrenadeThrowEvent(HandGrenadeDataBlock bw, UnityEngine.GameObject go, ItemRepresentation ir, uLink.NetworkMessageInfo ui, IHandGrenadeItem ibw)
        {
            TakeDamage local = ibw.inventory.GetLocal <TakeDamage>();

            _player = Fougerite.Server.GetServer().FindPlayer(local.GetComponent <Character>().netUser.userID);
            _bw     = bw;
            _go     = go;
            _ir     = ir;
            _ibw    = ibw;
            _unmi   = ui;
        }
Ejemplo n.º 9
0
        public ShotgunShootEvent(ShotgunDataBlock bw, ItemRepresentation ir, uLink.NetworkMessageInfo ui, IBulletWeaponItem ibw, ShotgunEventType type,
                                 IDRemoteBodyPart part, bool flag, bool flag2, bool flag3, BodyPart part2, Vector3 vector, Vector3 vector2)
        {
            TakeDamage local = ibw.inventory.GetLocal <TakeDamage>();

            _player        = Fougerite.Server.GetServer().FindPlayer(local.GetComponent <Character>().netUser.userID);
            _bw            = bw;
            _ir            = ir;
            _ibw           = ibw;
            _unmi          = ui;
            _type          = type;
            _part          = part;
            _hitnetworkobj = flag;
            _hitbodypart   = flag2;
            _isheadshot    = flag3;
            _bodypart      = part2;
            _endpos        = vector;
            _offset        = vector2;
        }
Ejemplo n.º 10
0
        public ShotgunShootEvent(ShotgunDataBlock bw, ItemRepresentation ir, uLink.NetworkMessageInfo ui, IBulletWeaponItem ibw, int pellets, ShotgunEventType type)
        {
            TakeDamage local = ibw.inventory.GetLocal <TakeDamage>();

            _player        = Fougerite.Server.GetServer().FindPlayer(local.GetComponent <Character>().netUser.userID);
            _bw            = bw;
            _ir            = ir;
            _ibw           = ibw;
            _unmi          = ui;
            _type          = type;
            _part          = null;
            _pellets       = pellets;
            _hitnetworkobj = false;
            _hitbodypart   = false;
            _isheadshot    = false;
            _bodypart      = BodyPart.Spine0;
            _endpos        = Vector3.zero;
            _offset        = Vector3.zero;
        }
Ejemplo n.º 11
0
    void FixedUpdate()
    {
        FirstAid target   = (FirstAid)FindObjectOfType(typeof(FirstAid));
        FirstAid FirstAid = target.GetComponent <FirstAid>();

        HealthSTR    = HealthINT.ToString();
        slider.value = HealthINT;
        HP.text      = HealthSTR;
        if (FirstAid.NeedAdd == true)
        {
            HealthINT        = 100;
            FirstAid.NeedAdd = false;
        }
        TakeDamage target2    = (TakeDamage)FindObjectOfType(typeof(TakeDamage));
        TakeDamage TakeDamage = target2.GetComponent <TakeDamage>();

        if (TakeDamage.TakeDamageINT >= 1)
        {
            HealthINT -= 25;
            TakeDamage.TakeDamageINT -= 1;
        }
    }
Ejemplo n.º 12
0
        private void SetAnimalDeathTags(TakeDamage takedamage, DamageEvent damage, ref DeathTags tags)
        {
            tags.deathType = tags.killer.Equals(UNKNOWN) ? DeathTypes.unknown : DeathTypes.human;
            var mutant = takedamage.ToString().Contains("Mutant");

            if (takedamage.GetComponent <BearAI>())
            {
                tags.killed = (mutant) ? "Mutant Bear" : "Bear";
                return;
            }
            if (takedamage.GetComponent <WolfAI>())
            {
                tags.killed = (mutant) ? "Mutant Wolf" : "Wolf";
                return;
            }
            if (takedamage.GetComponent <StagAI>())
            {
                tags.killed = "Stag";
                return;
            }
            if (takedamage.GetComponent <ChickenAI>())
            {
                tags.killed = "Chicken";
                return;
            }
            if (takedamage.GetComponent <RabbitAI>())
            {
                tags.killed = "Rabbit";
                return;
            }
            if (takedamage.GetComponent <BoarAI>())
            {
                tags.killed = "Boar";
                return;
            }
        }
Ejemplo n.º 13
0
 /////////////////////////
 // ModifyDamage(TakeDamage takedamage, DamageEvent damage)
 // Called when any damage was made
 /////////////////////////
 object ModifyDamage(TakeDamage takedamage, ref DamageEvent damage)
 {
     /*if (antiMassRadiation && (damage.damageTypes == 0 || damage.damageTypes == DamageTypeFlags.damage_radiation) )
      * {
      *  if (takedamage.GetComponent<Controllable>() == null) return null;
      *  if (damage.victim.character == null) return null;
      *  if (float.IsInfinity(damage.amount)) return null;
      *  if (damage.amount > 12f) { AntiCheatBroadcastAdmins(string.Format("{0} is receiving too much damage from the radiation, ignoring the damage", takedamage.GetComponent<Controllable>().playerClient.userName.ToString())); damage.amount = 0f; return damage; }
      * }
      * else */
     if (antiWallhack)
     {
         if (damage.status != LifeStatus.WasKilled)
         {
             return(null);
         }
         if (!(damage.extraData is BulletWeaponImpact))
         {
             return(null);
         }
         cachedBulletWeapon = damage.extraData as BulletWeaponImpact;
         if (!MeshBatchPhysics.Linecast(damage.attacker.character.eyesOrigin, cachedBulletWeapon.worldPoint, out cachedRaycast, out cachedBoolean, out cachedhitInstance))
         {
             return(null);
         }
         if (cachedhitInstance == null)
         {
             return(null);
         }
         cachedCollider = cachedhitInstance.physicalColliderReferenceOnly;
         if (cachedCollider == null)
         {
             return(null);
         }
         if (!(cachedCollider.gameObject.name.Contains("Wall") || cachedCollider.gameObject.name.Contains("Ceiling")))
         {
             return(null);
         }
         Debug.Log(string.Format("Wallhack detection on {0} from: {1} to: {2}", damage.attacker.client.userName, damage.attacker.character.eyesOrigin.ToString(), cachedBulletWeapon.worldPoint.ToString()));
         AntiCheatBroadcastAdmins(string.Format("Wallhack detection on {0} from: {1} to: {2}", damage.attacker.client.userName, damage.attacker.character.eyesOrigin.ToString(), cachedBulletWeapon.worldPoint.ToString()));
         damage.status = LifeStatus.IsAlive;
         damage.amount = 0f;
         takedamage.SetGodMode(false);
         takedamage.health = 10f;
         if (takedamage.GetComponent <HumanBodyTakeDamage>() != null)
         {
             takedamage.GetComponent <HumanBodyTakeDamage>().SetBleedingLevel(0f);
         }
         if (wallhackPunish)
         {
             if (wallhackLogs[damage.attacker.client] == null)
             {
                 wallhackLogs[damage.attacker.client] = Time.realtimeSinceStartup;
             }
             if ((wallhackLogs[damage.attacker.client] - Time.realtimeSinceStartup) > 3)
             {
                 wallhackLogs[damage.attacker.client] = Time.realtimeSinceStartup;
             }
             if (wallhackLogs[damage.attacker.client] - Time.realtimeSinceStartup > 0.1)
             {
                 Punish(damage.attacker.client, "rWallhack");
             }
         }
         return(damage);
     }
     return(null);
 }