コード例 #1
0
ファイル: WeaponDataBlock.cs プロジェクト: sknchan/LegacyRust
 protected virtual void PlayHitNotification(Vector3 point, Character shooterOrNull)
 {
     if (WeaponDataBlock._hitNotify || Bundling.Load <AudioClip>("content/shared/sfx/hitnotification", out WeaponDataBlock._hitNotify))
     {
         WeaponDataBlock._hitNotify.PlayLocal(Camera.main.transform, Vector3.zero, 1f, 1);
     }
     if (WeaponDataBlock._hitIndicator || Bundling.Load <HUDHitIndicator>("content/hud/HUDHitIndicator", out WeaponDataBlock._hitIndicator))
     {
         HUDHitIndicator.CreateIndicator(point, (!shooterOrNull ? true : !shooterOrNull.stateFlags.aim), WeaponDataBlock._hitIndicator);
     }
 }
コード例 #2
0
 protected virtual void PlayHitNotification(Vector3 point, Character shooterOrNull)
 {
     if ((WeaponDataBlock._hitNotify != null) || Bundling.Load <AudioClip>("content/shared/sfx/hitnotification", out WeaponDataBlock._hitNotify))
     {
         WeaponDataBlock._hitNotify.PlayLocal(Camera.main.transform, Vector3.zero, 1f, 1);
     }
     if ((_hitIndicator != null) || Bundling.Load <HUDHitIndicator>("content/hud/HUDHitIndicator", out _hitIndicator))
     {
         bool followPoint = true;
         HUDHitIndicator.CreateIndicator(point, followPoint, _hitIndicator);
     }
 }
コード例 #3
0
 public void AutoWood()
 {
     if (CVars.Misc.AutoWood)
     {
         WoodBlockerTemp.numWood = -1f;
         Character component = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>();
         Inventory inventory = component.GetComponent(typeof(Inventory)) as Inventory;
         MeleeWeaponItem <MeleeWeaponDataBlock> meleeWeaponItem = inventory._activeItem as MeleeWeaponItem <MeleeWeaponDataBlock>;
         if (inventory._activeItem is MeleeWeaponItem <MeleeWeaponDataBlock> && Time.time - this.LAST_ATTACK_TIME > meleeWeaponItem.datablock.fireRate && this.AUTO_WOOD_GATHER)
         {
             this.LAST_ATTACK_TIME = Time.time;
             ItemRepresentation itemRepresentation = meleeWeaponItem.itemRepresentation;
             IMeleeWeaponItem   meleeWeaponItem2   = meleeWeaponItem.iface as IMeleeWeaponItem;
             RaycastHit2        raycastHit;
             bool    flag  = Physics2.Raycast2(component.eyesRay, out raycastHit, meleeWeaponItem.datablock.range, 406721553);
             Vector3 point = raycastHit.point;
             itemRepresentation.Action(3, uLink.RPCMode.Server);
             uLink.BitStream bitStream = new uLink.BitStream(false);
             if (flag)
             {
                 IDMain idMain = raycastHit.idMain;
                 bitStream.WriteBoolean(true);
                 bitStream.Write <NetEntityID>(NetEntityID.Get(idMain), new object[0]);
                 bitStream.WriteVector3(point);
                 bitStream.WriteBoolean(false);
                 itemRepresentation.ActionStream(1, uLink.RPCMode.Server, bitStream);
                 HUDHitIndicator hUDHitIndicator;
                 if (Facepunch.Bundling.Load <HUDHitIndicator>("content/hud/HUDHitIndicator", out hUDHitIndicator))
                 {
                     HUDHitIndicator.CreateIndicator(point, true, hUDHitIndicator);
                 }
             }
             else
             {
                 bitStream.WriteBoolean(false);
                 bitStream.WriteVector3(Vector3.zero);
                 bitStream.WriteBoolean(true);
                 itemRepresentation.ActionStream(1, uLink.RPCMode.Server, bitStream);
             }
         }
     }
 }
コード例 #4
0
 public void AutoWood()
 {
     if (CVars.Misc.AutoWood)
     {
         Character component = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>();
         Inventory inventory = component.GetComponent(typeof(Inventory)) as Inventory;
         MeleeWeaponItem <MeleeWeaponDataBlock> item = inventory._activeItem as MeleeWeaponItem <MeleeWeaponDataBlock>;
         if (((inventory._activeItem is MeleeWeaponItem <MeleeWeaponDataBlock>) && ((Time.time - this.LAST_ATTACK_TIME) > item.datablock.fireRate)) && this.AUTO_WOOD_GATHER)
         {
             RaycastHit2 hit;
             this.LAST_ATTACK_TIME = Time.time;
             ItemRepresentation itemRepresentation = item.itemRepresentation;
             IMeleeWeaponItem   iface = item.iface as IMeleeWeaponItem;
             bool    flag             = Physics2.Raycast2(component.eyesRay, out hit, item.datablock.range, 0x183e1411);
             Vector3 point            = hit.point;
             itemRepresentation.Action(3, uLink.RPCMode.Server);
             uLink.BitStream stream = new uLink.BitStream(false);
             if (flag)
             {
                 HUDHitIndicator indicator;
                 IDMain          idMain = hit.idMain;
                 stream.WriteBoolean(true);
                 stream.Write <NetEntityID>(NetEntityID.Get((UnityEngine.MonoBehaviour)idMain), new object[0]);
                 stream.WriteVector3(point);
                 stream.WriteBoolean(false);
                 itemRepresentation.ActionStream(1, uLink.RPCMode.Server, stream);
                 if (Bundling.Load <HUDHitIndicator>("content/hud/HUDHitIndicator", out indicator))
                 {
                     HUDHitIndicator.CreateIndicator(point, true, indicator);
                 }
             }
             else
             {
                 stream.WriteBoolean(false);
                 stream.WriteVector3(Vector3.zero);
                 stream.WriteBoolean(true);
                 itemRepresentation.ActionStream(1, uLink.RPCMode.Server, stream);
             }
         }
     }
 }