From 2abe378deb534f747e1386195afc5bded7f3a4c3 Mon Sep 17 00:00:00 2001 From: InvalidArgument3 Date: Sun, 7 Jan 2024 17:25:36 -0600 Subject: [PATCH 1/4] Update SorterWeaponLogic.cs --- .../Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs b/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs index 578fe6b3..0bb84a21 100644 --- a/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs +++ b/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs @@ -60,10 +60,10 @@ public override void UpdateOnceBeforeFrame() public override void UpdateAfterSimulation() { - - ProjectileManager.I.AddProjectile(new Projectile(0, SorterWep.WorldMatrix.Translation, SorterWep.WorldMatrix.Forward, SorterWep)); - - + + if (ShootState.Value) + ProjectileManager.I.AddProjectile(new Projectile(0, SorterWep.WorldMatrix.Translation, SorterWep.WorldMatrix.Forward, SorterWep)); + } public float Terminal_ExampleFloat { get; set; } From a06dee890b2fde2df0dd672bc0f5e6414bf8b045 Mon Sep 17 00:00:00 2001 From: InvalidArgument3 Date: Sun, 7 Jan 2024 17:44:41 -0600 Subject: [PATCH 2/4] find the dummy (me) --- .../Data/CubeBlocks/CubeBlocks_TestWeapon.sbc | 111 +++++++++--------- .../HeartModule/Weapons/SorterWeaponLogic.cs | 9 ++ .../Models/Cubes/large/TestWeapon.mwm | Bin 0 -> 2476 bytes 3 files changed, 62 insertions(+), 58 deletions(-) create mode 100644 Heart Module/Models/Cubes/large/TestWeapon.mwm diff --git a/Heart Module/Data/CubeBlocks/CubeBlocks_TestWeapon.sbc b/Heart Module/Data/CubeBlocks/CubeBlocks_TestWeapon.sbc index baa5faa3..028d468b 100644 --- a/Heart Module/Data/CubeBlocks/CubeBlocks_TestWeapon.sbc +++ b/Heart Module/Data/CubeBlocks/CubeBlocks_TestWeapon.sbc @@ -1,60 +1,55 @@  - - - - - ConveyorSorter - TestWeapon - - TestWeapon - Textures\GUI\Icons\Cubes\ConveyorSorterLarge.dds - TestWeapon - Large - false - TriangleMesh - - - Models\Cubes\Large\ConveyorSorter.mwm - - - - - - - - - - - - - - - - TestWeapon - Z - Y - Light - 20 - Damage_HeavyMech_Damaged - ParticleHeavyMech - Conveyors - 0.00025 - - 1 - 1 - 1 - - Default - Damage_HeavyMech_Damaged - ParticleHeavyMech - BlockDestroyedExplosion_Large - WepSmallWarheadExpl - 25 - true - - - - - - + + + + ConveyorSorter + TestWeapon + + TestWeapon + Textures\GUI\Icons\AstronautBackpack.dds + TestWeapon + Large + false + TriangleMesh + + + Models\Cubes\large\TestWeapon.mwm + + + + + + + + + + + + + + + + TestWeapon + Light + 20 + Damage_HeavyMech_Damaged + ParticleHeavyMech + Conveyors + 0.00025 + + 1 + 1 + 1 + + Default + Damage_HeavyMech_Damaged + ParticleHeavyMech + BlockDestroyedExplosion_Large + WepSmallWarheadExpl + 25 + true + + + + \ No newline at end of file diff --git a/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs b/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs index aeceb1f6..1c2af4df 100644 --- a/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs +++ b/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs @@ -2,7 +2,9 @@ using Sandbox.Common.ObjectBuilders; using Sandbox.ModAPI; using System; +using System.Collections.Generic; using VRage.Game.Components; +using VRage.Game.ModAPI; using VRage.Game.ModAPI.Network; using VRage.ModAPI; using VRage.ObjectBuilders; @@ -27,6 +29,8 @@ public class SorterWeaponLogic : MyGameLogicComponent //the state of shoot bool shoot = false; + public Dictionary modeldummy { get; set; } = new Dictionary(); + public override void Init(MyObjectBuilder_EntityBase objectBuilder) { NeedsUpdate = MyEntityUpdateEnum.BEFORE_NEXT_FRAME; @@ -56,6 +60,10 @@ public override void UpdateOnceBeforeFrame() { NeedsUpdate = MyEntityUpdateEnum.EACH_FRAME; } + + SorterWep.Model.GetDummies(modeldummy); + MyAPIGateway.Utilities.ShowNotification($"Model Dummies: {modeldummy.Count}", 2000, "White"); + } float fireRate = 15; // per-second @@ -67,6 +75,7 @@ public override void UpdateAfterSimulation() if (ShootState.Value && lastShoot >= 60) { + ProjectileManager.I.AddProjectile(new Projectile(0, SorterWep.WorldMatrix.Translation + SorterWep.WorldMatrix.Forward, SorterWep.WorldMatrix.Forward, SorterWep)); lastShoot -= 60; } diff --git a/Heart Module/Models/Cubes/large/TestWeapon.mwm b/Heart Module/Models/Cubes/large/TestWeapon.mwm new file mode 100644 index 0000000000000000000000000000000000000000..8d9b1b9726f9a27e398a0fc336e47f704911c27b GIT binary patch literal 2476 zcmd5-O=uid9DkdSX7kaQrXLm&6f9Cu;x5EAiILrGVv@B<8nRm>5($&t*WJO{nRVVw zO>(e{2TxW!SQJk|MFRGqwtA7Uy;VfLd-5PiQ6z}oimboi%+BuYrc#f-;Wz*9H}C!5 zy#K#@R&Kh5h!A4v1!*hYGACp4_|xZNvG_w!_RPAak}lPCctqjg=sBt8J78G0?2=}v z6P-fzW#!h4W!ZTZt3d2c>85WyfE3MYWcdbum?8UGgI(N(E(njz=3oMYKPLNk0( z$(f>Nn$p0ej%!Qx8`S+N%Qf@5Sx8x1HOPa3oGBNjEg$Q~@-we#&x?ty}or1D= zNvh(CW;-eiDVmWv2Rl?(k3d+m^3q6ME`9)^*Avp_C2Ormh=G(L&3qbDVY6;Su_pCG z(NS+g(Kl`CCC!`bJ&4^Y%arOXa9F4*m$Y&jYyBuH#Hj`Cvh~W0Wf(ehJ1?!0bnNXL zFb%9|jw5X|!wmcYMc3kmS@jc`p1IVE3z{n4A-`}wOJ4Lg4}+%_Ex9{8hK$99s8pZY z|M~`W-thTKV)0<)CKbn@ublPyN|o}5J=f0W&Yiz`?eljbR}#pk7(~|X727KFfTa>g z(rVc?jIONh%9FG5lI9xDwBy+Nrt3)LMQ%l6{b>`a*PZNkSw`ZGf8#X2u`iy*Gv&Pl zx(}IppYGSGFVmZPzFTRa59Z?xz8@*Q0~(HN>isx+(N2Bf$2eL^Y4<6)so>w{UTTTj zl{O?GH=lMZl3ELaGlWsAA~uB3-SJX4A;!fs9!AB47!_jx=>*m?=3xpvF$sB6#Na#T zVH7<5$6+JEPagwVMA-p4`)&#A>V9Om=) zSWNp2EpjuHxD)NQg@5`zYD-IDiHO~5C(r?aPk>K=PqY;qP9BWHJAKJRg(p;XcvC+y z_TD}Nidra8I0bd&NjXq81WJ%Vf%14#Udn!;55UFucv2Ju@c=Lg9If-D1Hf@$7&unv zNr!+3fm6WAI!}56i1aT>M>94uMcv%y!j7R#S+=LF*WSm28och+N3}lVZc4R2ZMY@f z)ZNlXt~8R*t6{$v%o~AB28qd-&BDA1olU{bK1TOB|I z0G|Y(1fRTkH8-~kWC14iZmm}Pd7RI~xA_DKC1s+Sa3(kG!??fO;(|kB(wY3QKM#n9 z!@=CqH*9Y<6dnzK|A=@r*$H$2Ee!^?ddI0Z7%D;yh9alu;4=9+zu{0DU9~J{8LbS9 zukkO3u5J8xT^G;SkKV2BT>rJvRNi0T-FxKImqrDy1MR+THvyg3WLm#iNi@0>7ySKq zi-%TqKi$EdQq`Zdk_h)y>i(st($vyZz3#@IN=wjFzZiP`n~(o^wRdh+OaJ-Tm+7Ft bzA^g5;>_u!IP=!X-Cus+^I{nHe;WS)$^xc9 literal 0 HcmV?d00001 From 16dd8e0df3416e82d8448fc5e468ab6ceab5ccfb Mon Sep 17 00:00:00 2001 From: InvalidArgument3 Date: Sun, 7 Jan 2024 17:54:51 -0600 Subject: [PATCH 3/4] spawning from muzzle in the WRONG DIRECTION --- .../Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs b/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs index 1c2af4df..cfbf1da7 100644 --- a/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs +++ b/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs @@ -75,9 +75,13 @@ public override void UpdateAfterSimulation() if (ShootState.Value && lastShoot >= 60) { - - ProjectileManager.I.AddProjectile(new Projectile(0, SorterWep.WorldMatrix.Translation + SorterWep.WorldMatrix.Forward, SorterWep.WorldMatrix.Forward, SorterWep)); + + MatrixD matrix = SorterWep.WorldMatrix + (MatrixD)modeldummy["muzzle01"].Matrix; + ProjectileManager.I.AddProjectile(new Projectile(0, matrix.Translation, matrix.Forward, SorterWep)); lastShoot -= 60; + + + } } From 9f391cf00cba644dfe62aec4500828e994bdfeaf Mon Sep 17 00:00:00 2001 From: InvalidArgument3 Date: Sun, 7 Jan 2024 18:11:11 -0600 Subject: [PATCH 4/4] meme --- .../HeartModule/Weapons/SorterWeaponLogic.cs | 14 +++++++++----- .../Models/Cubes/large/TestWeapon.mwm | Bin 2476 -> 2476 bytes 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs b/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs index cfbf1da7..cfa61ebb 100644 --- a/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs +++ b/Heart Module/Data/Scripts/HeartModule/Weapons/SorterWeaponLogic.cs @@ -75,16 +75,20 @@ public override void UpdateAfterSimulation() if (ShootState.Value && lastShoot >= 60) { + MatrixD worldMatrix = SorterWep.WorldMatrix; // Block's world matrix + MatrixD dummyMatrix = modeldummy["muzzle01"].Matrix; // Dummy's local matrix - MatrixD matrix = SorterWep.WorldMatrix + (MatrixD)modeldummy["muzzle01"].Matrix; - ProjectileManager.I.AddProjectile(new Projectile(0, matrix.Translation, matrix.Forward, SorterWep)); - lastShoot -= 60; - - + // Combine the matrices by multiplying them to get the transformation of the dummy in world space + MatrixD combinedMatrix = dummyMatrix * worldMatrix; + // Now combinedMatrix.Translation is the muzzle position in world coordinates, + // and combinedMatrix.Forward is the forward direction in world coordinates. + ProjectileManager.I.AddProjectile(new Projectile(0, combinedMatrix.Translation, combinedMatrix.Forward, SorterWep)); + lastShoot -= 60; } } + public float Terminal_ExampleFloat { get; set; } public bool Terminal_Heart_Shoot diff --git a/Heart Module/Models/Cubes/large/TestWeapon.mwm b/Heart Module/Models/Cubes/large/TestWeapon.mwm index 8d9b1b9726f9a27e398a0fc336e47f704911c27b..cf13844ed7fdc57a1b0db907fc65d5ed4c65f17b 100644 GIT binary patch delta 100 zcmZ1@yheD#5k^gWwY|HIw+LL^!T<#Ndv|YUU}&)Sd9MfNZx*;{;{RUH1SGckEn_8{ u=>7=~%fV70XnGy6@4dHHfi)u$^(EH+HyTmt|CBqYE9 delta 84 zcmZ1@yheD#5k}4Z`g?b8W`F_+yTRV)z1|j(kg!*S287+PfAd?$N;XFO$<-V(lbbnm a1vUxPomld*kkc(F(ev|{t)7!O*8l*r-X4Dd