diff --git a/Client/DevTools/DevTool.cs b/Client/DevTools/DevTool.cs index 7001f77..b224192 100644 --- a/Client/DevTools/DevTool.cs +++ b/Client/DevTools/DevTool.cs @@ -130,7 +130,7 @@ namespace RageCoop.Client s=$@" // {ToMark.DisplayName} case {ToMark.Model.Hash}: - i=Main.Ticked%2==0 ? {Current} : {Secondary}; + i=BulletsShot%2==0 ? {Current} : {Secondary}; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].{dir}Vector); "; } @@ -139,7 +139,7 @@ namespace RageCoop.Client s=$@" // {ToMark.DisplayName} case {ToMark.Model.Hash}: - i=Main.Ticked%2==0 ? {Current} : {Secondary}; + i=BulletsShot%2==0 ? {Current} : {Secondary}; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].{((MuzzleDir)(dir-3)).ToString()}Vector*-1); "; } diff --git a/Client/Sync/SyncEvents.cs b/Client/Sync/SyncEvents.cs index c766cd0..462d9bf 100644 --- a/Client/Sync/SyncEvents.cs +++ b/Client/Sync/SyncEvents.cs @@ -188,7 +188,7 @@ namespace RageCoop.Client { _lastWeaponHash=weaponHash; } if (!_weaponAsset.IsLoaded) { _weaponAsset.Request(); } - World.ShootBullet(start, end, p, _weaponAsset, p.GetWeaponDamage()); + World.ShootBullet(start, end, p, _weaponAsset, p.GetWeaponDamage(weaponHash)); Prop w; if(((w = p.Weapons.CurrentWeaponObject) != null)&&(p.VehicleWeapon==VehicleWeaponHash.Invalid)) { @@ -269,10 +269,12 @@ namespace RageCoop.Client { } } } - public static int GetWeaponDamage(this Ped p) + public static int GetWeaponDamage(this Ped p,uint hash) { - if (p.VehicleWeapon!=VehicleWeaponHash.Invalid) + if(p.IsInVehicle() && (hash!=(uint)p.Weapons.Current.Hash)) { + // This is a vehicle weapon + p.VehicleWeapon=(VehicleWeaponHash)hash; return 100; } switch (p.Weapons.Current.Group) diff --git a/Client/Util/WeaponUtil.cs b/Client/Util/WeaponUtil.cs index d97bdd4..868b0ff 100644 --- a/Client/Util/WeaponUtil.cs +++ b/Client/Util/WeaponUtil.cs @@ -31,59 +31,61 @@ namespace RageCoop.Client } return p.Bones[Bone.SkelRightHand].Position; } + static long BulletsShot=0; public static MuzzleInfo GetMuzzleInfo(this Vehicle v) { + BulletsShot++; int i; switch (v.Model.Hash) { // SCRAMJET case -638562243: - i=Main.Ticked%2==0 ? 44 : 45; + i=BulletsShot%2==0 ? 44 : 45; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].ForwardVector); // VIGILANTE case -1242608589: - i=Main.Ticked%2==0 ? 42 : 43; + i=BulletsShot%2==0 ? 42 : 43; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].ForwardVector); // ZR380 case 540101442: - i=Main.Ticked%2==0 ? 57 : 63; + i=BulletsShot%2==0 ? 57 : 63; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].ForwardVector); // ZR3802 case -1106120762: - i=Main.Ticked%2==0 ? 57 : 63; + i=BulletsShot%2==0 ? 57 : 63; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].ForwardVector); // ZR3803 case -1478704292: - i=Main.Ticked%2==0 ? 53 : 59; + i=BulletsShot%2==0 ? 53 : 59; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].ForwardVector); // STROMBERG case 886810209: - i=Main.Ticked%2==0 ? 85 : 84; + i=BulletsShot%2==0 ? 85 : 84; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].ForwardVector); // SLAMVAN4 case -2061049099: - i=Main.Ticked%2==0 ? 76 : 78; + i=BulletsShot%2==0 ? 76 : 78; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].ForwardVector); // IMPERATOR case 444994115: - i=Main.Ticked%2==0 ? 88 : 86; + i=BulletsShot%2==0 ? 88 : 86; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].ForwardVector); // IMPALER2 case 1009171724: - i=Main.Ticked%2==0 ? 63 : 64; + i=BulletsShot%2==0 ? 63 : 64; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].ForwardVector); // DOMINATOR4 case -688189648: - i=Main.Ticked%2==0 ? 59 : 60; + i=BulletsShot%2==0 ? 59 : 60; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].ForwardVector); // SAVAGE @@ -92,22 +94,22 @@ namespace RageCoop.Client // BUZZARD case 788747387: - i=Main.Ticked%2==0 ? 28 : 23; + i=BulletsShot%2==0 ? 28 : 23; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].ForwardVector); // ANNIHL case 837858166: - i=(int)Main.Ticked%4+35; + i=(int)BulletsShot%4+35; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].ForwardVector); // HYDRA case 970385471: - i=Main.Ticked%2==0 ? 29 : 28; + i=BulletsShot%2==0 ? 29 : 28; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].ForwardVector); // STARLING case -1700874274: - i=Main.Ticked%2==0 ? 24 : 12; + i=BulletsShot%2==0 ? 24 : 12; return new MuzzleInfo(v.Bones[i].Position, v.Bones[i].ForwardVector); // RHINO @@ -132,25 +134,7 @@ namespace RageCoop.Client return w.Group==WeaponGroup.Thrown || ProjectileWeapons.Contains(w.Hash); } } - - public static int GetDamage(this Weapon w) - { - int damage = 0; - switch (w.Group) - { - case WeaponGroup.AssaultRifle: damage=30; break; - case WeaponGroup.Heavy: damage=30; break; - case WeaponGroup.MG: damage=30; break; - case WeaponGroup.PetrolCan: damage=0; break; - case WeaponGroup.Pistol: damage=30; break; - case WeaponGroup.Shotgun: damage=30; break; - case WeaponGroup.SMG: damage=20; break; - case WeaponGroup.Sniper: damage=100; break; - case WeaponGroup.Thrown: damage=0; break; - case WeaponGroup.Unarmed: damage=0; break; - } - return damage; - } + public static readonly Dictionary MuzzleBoneIndexes = new Dictionary { {WeaponHash.HeavySniper,6}, diff --git a/Server/Properties/PublishProfiles/FolderProfile.pubxml b/Server/Properties/PublishProfiles/FolderProfile.pubxml index f262f64..2eb4874 100644 --- a/Server/Properties/PublishProfiles/FolderProfile.pubxml +++ b/Server/Properties/PublishProfiles/FolderProfile.pubxml @@ -6,10 +6,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Release Any CPU - bin\Release\net6.0\publish\linux-x64\ + bin\Release\net6.0\publish\linux-arm\ FileSystem net6.0 - linux-x64 + linux-arm true True True diff --git a/Server/Properties/PublishProfiles/FolderProfile.pubxml.user b/Server/Properties/PublishProfiles/FolderProfile.pubxml.user index 61bab07..c9c7524 100644 --- a/Server/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/Server/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -4,6 +4,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - True|2022-06-01T10:47:39.6707493Z;True|2022-06-01T18:04:32.2932367+08:00;True|2022-06-01T18:03:17.8871227+08:00;True|2022-05-27T15:20:25.7264350+08:00;True|2022-05-27T15:20:04.2362276+08:00;True|2022-05-27T15:19:21.4852644+08:00;True|2022-05-27T15:18:36.0857345+08:00;True|2022-05-25T10:30:00.0927959+08:00;True|2022-05-25T10:26:50.6739643+08:00;True|2022-05-25T10:20:36.6658425+08:00;True|2022-05-25T10:19:47.8333108+08:00;True|2022-05-24T11:00:13.3617113+08:00;True|2022-05-22T16:56:31.0481188+08:00;True|2022-05-18T13:35:57.1402751+08:00;True|2022-05-18T13:10:28.4995253+08:00;True|2022-05-01T18:35:01.9624101+08:00;True|2022-05-01T12:32:20.8671319+08:00;False|2022-05-01T12:30:25.4596227+08:00; + True|2022-06-02T05:21:10.3456459Z;True|2022-06-02T13:20:52.1088278+08:00;True|2022-06-02T13:20:25.6889167+08:00;True|2022-06-02T13:19:06.3089340+08:00;True|2022-06-01T18:47:39.6707493+08:00;True|2022-06-01T18:04:32.2932367+08:00;True|2022-06-01T18:03:17.8871227+08:00;True|2022-05-27T15:20:25.7264350+08:00;True|2022-05-27T15:20:04.2362276+08:00;True|2022-05-27T15:19:21.4852644+08:00;True|2022-05-27T15:18:36.0857345+08:00;True|2022-05-25T10:30:00.0927959+08:00;True|2022-05-25T10:26:50.6739643+08:00;True|2022-05-25T10:20:36.6658425+08:00;True|2022-05-25T10:19:47.8333108+08:00;True|2022-05-24T11:00:13.3617113+08:00;True|2022-05-22T16:56:31.0481188+08:00;True|2022-05-18T13:35:57.1402751+08:00;True|2022-05-18T13:10:28.4995253+08:00;True|2022-05-01T18:35:01.9624101+08:00;True|2022-05-01T12:32:20.8671319+08:00;False|2022-05-01T12:30:25.4596227+08:00; \ No newline at end of file