Hack together correct positioning of grenades from attached items

This commit is contained in:
2025-06-28 22:32:12 +01:00
parent 6af2a8cc36
commit d88aed10c7
12 changed files with 225 additions and 178 deletions
+5 -3
View File
@@ -21,6 +21,7 @@ data PJStabiliser
| StabSpinIncrease
-- assumes the mscreen is in your inventory
-- TODO take into account creature aimstance positioning
createShell ::
(Point3, Q.Quaternion Float) ->
Maybe (NewInt ItmInt) ->
@@ -41,9 +42,9 @@ createShell (p,q) mdetonator mscreen stab pjtype payload muz cr w =
{ _pjPos = pos
, _pjZ = 20
, _pjZVel = 5
, _pjVel = rotateV dir (V2 speed 0) + crvelcomponent
, _pjVel = rotateV dir' (V2 speed 0) + crvelcomponent
, _pjID = i
, _pjDir = dir
, _pjDir = dir'
, _pjSpin = 0
, _pjSpinFactor = spinfactor
, _pjPayload = payload
@@ -93,4 +94,5 @@ createShell (p,q) mdetonator mscreen stab pjtype payload muz cr w =
.:~ i
i = IM.newKey $ w ^. cWorld . lWorld . projectiles
dir = _crDir cr + _mzRot muz
pos = _crPos cr + xyV3 p + rotateV dir (_mzPos muz)
pos = _crPos cr + rotateV dir (xyV3 p + rotateV (argV (Q.qToV2 q)) (_mzPos muz))
dir' = dir + argV (Q.qToV2 q)