Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 90c9131

Browse files
authored
Merge pull request #105 from cortex-command-community/4zk-content
Data followup to ThrownDevice changes
2 parents 625bb6a + aed1b12 commit 90c9131

File tree

54 files changed

+154
-178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+154
-178
lines changed

Base.rte/AI/HumanBehaviors.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2754,14 +2754,21 @@ function HumanBehaviors.ThrowTarget(AI, Owner, Abort)
27542754
if Owner.ThrowableIsReady then
27552755
local Grenade = ToThrownDevice(Owner.EquippedItem)
27562756
if Grenade then
2757-
aim = HumanBehaviors.GetGrenadeAngle(AimPoint, Vector(), Grenade.MuzzlePos, Grenade.MaxThrowVel)
2757+
local maxThrowVel = Grenade.MaxThrowVel
2758+
local minThrowVel = Grenade.MinThrowVel
2759+
if maxThrowVel == 0 then
2760+
maxThrowVel = Owner.FGArm.ThrowStrength + math.abs(Owner.AngularVel * 0.5) * math.cos(Owner.RotAngle)/math.sqrt(math.abs(Grenade.Mass) + 1)
2761+
minThrowVel = maxThrowVel * 0.2
2762+
end
2763+
aim = HumanBehaviors.GetGrenadeAngle(AimPoint, Vector(), Grenade.MuzzlePos, maxThrowVel)
27582764
if aim then
2765+
aim = aim - Owner.RotAngle
27592766
ThrowTimer:Reset()
27602767
aimTime = Owner.ThrowPrepTime * RangeRand(0.9, 1.1)
27612768
local maxAim = aim
27622769

27632770
-- try again with an average throw vel
2764-
aim = HumanBehaviors.GetGrenadeAngle(AimPoint, Vector(), Grenade.MuzzlePos, (Grenade.MaxThrowVel+Grenade.MinThrowVel)/2)
2771+
aim = HumanBehaviors.GetGrenadeAngle(AimPoint, Vector(), Grenade.MuzzlePos, (maxThrowVel + minThrowVel)/2)
27652772
if aim then
27662773
aimTime = Owner.ThrowPrepTime * RangeRand(0.45, 0.55)
27672774
else

Base.rte/Actors/Brains/Brainbot/Brainbot.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ AddActor = Arm
356356
Hand = ContentFile
357357
FilePath = Base.rte/Actors/Brains/Brainbot/HandFG.png
358358
GripStrength = 100
359+
ThrowStrength = 25
359360
MaxLength = 13
360361
IdleOffset = Vector
361362
X = 7

Base.rte/Actors/Infantry/GreenDummy/GreenDummy.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ AddActor = Arm
377377
Hand = ContentFile
378378
FilePath = Base.rte/Actors/Infantry/GreenDummy/HandFGA.png
379379
GripStrength = 100
380+
ThrowStrength = 30
380381
MaxLength = 12
381382
IdleOffset = Vector
382383
X = 5

Base.rte/Devices/Explosives/AntiPersonnelMine/AntiPersonnelMine.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ AddDevice = TDExplosive
208208
Y = 4
209209
StartThrowOffset = Vector
210210
X = 9
211-
Y = -2
211+
Y = 1
212212
EndThrowOffset = Vector
213-
X = 4
214-
Y = 4
213+
X = 8
214+
Y = -1
215215
MinThrowVel = 1
216216
MaxThrowVel = 10
217217
TriggerDelay = 10000000

Base.rte/Devices/Explosives/ClusterMineBomb/ClusterMineBomb.ini

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,10 @@ AddDevice = TDExplosive
136136
Y = 4
137137
StartThrowOffset = Vector
138138
X = 6
139-
Y = -7
139+
Y = -4
140140
EndThrowOffset = Vector
141-
X = 4
142-
Y = 4
143-
MinThrowVel = 1
144-
MaxThrowVel = 8
141+
X = 6
142+
Y = -1
145143
TriggerDelay = 5000
146144
ActivatesWhenReleased = 1
147145
AddGib = Gib

Base.rte/Devices/Explosives/FragGrenade/FragGrenade.ini

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,3 @@
1-
///////////////////////////////////////////////////////////////////////
2-
// Frag Grenade Effects
3-
4-
5-
AddAmmo = MOSParticle
6-
PresetName = Frag Grenade Pin
7-
Mass = 0.05
8-
HitsMOs = 0
9-
GetsHitByMOs = 0
10-
RestThreshold = 1000
11-
SpriteFile = ContentFile
12-
FilePath = Base.rte/Devices/Explosives/FragGrenade/FragGrenadePin.png
13-
FrameCount = 8
14-
SpriteAnimMode = 7
15-
SpriteOffset = Vector
16-
X = -2
17-
Y = -2
18-
AngularVel = 6
19-
Atom = Atom
20-
Material = Material
21-
PresetName = Scrap Metal
22-
TrailLength = 0
23-
24-
251
///////////////////////////////////////////////////////////////////////
262
// Frag Grenade
273

@@ -30,14 +6,14 @@ AddDevice = TDExplosive
306
PresetName = Frag Grenade
317
AddToGroup = Bombs - Grenades
328
AddToGroup = Bombs
33-
Mass = 1
9+
Mass = 1.3
3410
RestThreshold = -500
3511
HitsMOs = 1
3612
GetsHitByMOs = 1
37-
ScriptPath = Base.rte/Devices/Explosives/FragGrenade/FragGrenade.lua
3813
SpriteFile = ContentFile
3914
FilePath = Base.rte/Devices/Explosives/FragGrenade/FragGrenade.png
4015
FrameCount = 2
16+
SpriteAnimMode = 0
4117
SpriteOffset = Vector
4218
X = -3
4319
Y = -4
@@ -75,15 +51,15 @@ AddDevice = TDExplosive
7551
X = -12
7652
Y = -5
7753
StartThrowOffset = Vector
78-
X = -12
79-
Y = -5
54+
X = -11
55+
Y = -3
8056
EndThrowOffset = Vector
81-
X = -12
82-
Y = -5
83-
MinThrowVel = 5
84-
MaxThrowVel = 20
57+
X = 11
58+
Y = -3
8559
TriggerDelay = 2500
8660
ActivatesWhenReleased = 1
61+
StrikerLever = MOSParticle
62+
CopyOf = Grenade Pin
8763
AddGib = Gib
8864
GibParticle = MOPixel
8965
CopyOf = Glow Explosion Big

Base.rte/Devices/Explosives/FragGrenade/FragGrenade.lua

Lines changed: 0 additions & 11 deletions
This file was deleted.

Base.rte/Devices/Explosives/NapalmBomb/NapalmBomb.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,6 @@ AddDevice = TDExplosive
173173
EndThrowOffset = Vector
174174
X = 4
175175
Y = 4
176-
MinThrowVel = 1
177-
MaxThrowVel = 8
178176
TriggerDelay = 5000
179177
ActivatesWhenReleased = 1
180178
AddGib = Gib

Base.rte/Devices/Explosives/StandardBomb/StandardBomb.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ AddDevice = TDExplosive
5656
EndThrowOffset = Vector
5757
X = 4
5858
Y = 4
59-
MinThrowVel = 1
60-
MaxThrowVel = 10
6159
TriggerDelay = 5000
6260
ActivatesWhenReleased = 1
6361
AddGib = Gib

Base.rte/Devices/Shared/Scripts/TrajectoryGuide.lua

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ function Create(self)
44
self.laserTimer:SetSimTimeLimitMS(10);
55
self.guideTable = {};
66

7-
self.projectileVel = 30;
8-
97
if IsThrownDevice(self) then
108
self.isThrownDevice = true;
11-
self.projectileVel = self.MaxThrowVel;
12-
self.projectileVelMin = self.MinThrowVel;
9+
if self.MaxThrowVel > 0 then
10+
self.projectileVelMax = self.MaxThrowVel;
11+
self.projectileVelMin = self.MinThrowVel;
12+
end
1313
self.projectileGravity = self.GlobalAccScalar;
1414
self.projectileAirResistance = self.AirResistance;
1515
self.projectileAirThreshold = self.AirThreshold;
@@ -46,18 +46,21 @@ function Update(self)
4646
if controller:IsState(Controller.AIM_SHARP) or self.isThrownDevice and controller:IsState(Controller.WEAPON_FIRE) then
4747
if self.laserTimer:IsPastSimTimeLimit() then
4848

49-
local guideParPos, gudeParVel;
49+
local guideParPos, guideParVel;
5050

5151
if self.isThrownDevice and IsAHuman(actor) then
5252
--Display detonation point if a scripted fuze is active
5353
if self.fuze and self.fuzeDelay then
5454
self.maxTrajectoryPars = (self.fuzeDelay - self.fuze.ElapsedSimTimeMS - self.laserTimer.ElapsedSimTimeMS)/TimerMan.DeltaTimeMS * rte.PxTravelledPerFrame;
5555
end
5656
actor = ToAHuman(actor);
57+
local rotationThisFrame = actor.AngularVel * TimerMan.DeltaTimeSecs;
58+
local maxVel = self.projectileVelMax or (actor.FGArm.ThrowStrength + math.abs(actor.AngularVel * 0.5))/math.sqrt(math.abs(self.Mass) + 1);
59+
local minVel = self.projectileVelMin or maxVel * 0.2;
5760
--The following offset is as found in the source code (To-do: expose and utilize EndThrowOffset properly instead)
58-
guideParPos = actor.Pos + Vector((actor.FGArm.ParentOffset.X + 15) * actor.FlipFactor, actor.FGArm.ParentOffset.Y - 8);
59-
local projectileVel = self.throwTimer and self.projectileVelMin + (self.projectileVel - self.projectileVelMin) * math.min(self.throwTimer.ElapsedSimTimeMS, actor.ThrowPrepTime)/actor.ThrowPrepTime or self.projectileVel;
60-
guideParVel = Vector(projectileVel, 0):RadRotate(actor.RotAngle + actor:GetAimAngle(true));
61+
guideParPos = actor.Pos + actor.Vel * rte.PxTravelledPerFrame + Vector((actor.FGArm.ParentOffset.X + actor.FGArm.MaxLength) * actor.FlipFactor, actor.FGArm.ParentOffset.Y - actor.FGArm.MaxLength * 0.5):RadRotate(actor:GetAimAngle(false) * actor.FlipFactor);
62+
local projectileVel = self.throwTimer and minVel + (maxVel - minVel) * math.min(self.throwTimer.ElapsedSimTimeMS, actor.ThrowPrepTime)/actor.ThrowPrepTime or maxVel;
63+
guideParVel = Vector(projectileVel, 0):RadRotate(actor.RotAngle + actor:GetAimAngle(true) + rotationThisFrame);
6164
else
6265
guideParPos = self.MuzzlePos;
6366
guideParVel = Vector(self.projectileVel, 0):RadRotate(actor:GetAimAngle(true));

0 commit comments

Comments
 (0)