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

Commit 577d453

Browse files
authored
Merge pull request #46 from cortex-command-community/MaximDude-Experiments
Fixes and Cleanup Followup
2 parents 4571ec0 + 3c9794d commit 577d453

File tree

20 files changed

+92
-85
lines changed

20 files changed

+92
-85
lines changed

Base.rte/AI/HumanBehaviors.lua

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ function HumanBehaviors.GetGrenadeAngle(AimPoint, TargetVel, StartPos, muzVel)
257257
Dist = SceneMan:ShortestDistance(StartPos, AimPoint, false)
258258
end
259259

260-
Dist = Dist / FrameMan.PPM -- convert from pixels to meters
260+
Dist = Dist / GetPPM() -- convert from pixels to meters
261261
local velSqr = math.pow(muzVel, 2)
262262
local gravity = SceneMan.GlobalAcc.Y * 0.67 -- underestimate gravity
263263
local root = math.sqrt(velSqr*velSqr - gravity*(gravity*Dist.X*Dist.X+2*-Dist.Y*velSqr))
@@ -1715,8 +1715,8 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
17151715
-- predict jetpack movement when jumping and there is a target (check one direction)
17161716
local jetStrength = AI.jetImpulseFactor / Owner.Mass
17171717
local t = math.min(0.4, Owner.JetTimeLeft*0.001)
1718-
local PixelVel = Owner.Vel * (FrameMan.PPM * t)
1719-
local Accel = SceneMan.GlobalAcc * FrameMan.PPM
1718+
local PixelVel = Owner.Vel * (GetPPM() * t)
1719+
local Accel = SceneMan.GlobalAcc * GetPPM()
17201720

17211721
-- a burst use 10x more fuel
17221722
if Owner.Jetpack:CanTriggerBurst() then
@@ -1779,8 +1779,8 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
17791779
-- predict jetpack movement...
17801780
local jetStrength = AI.jetImpulseFactor / Owner.Mass
17811781
local t = math.min(0.4, Owner.JetTimeLeft*0.001)
1782-
local PixelVel = Owner.Vel * (FrameMan.PPM * t)
1783-
local Accel = SceneMan.GlobalAcc * FrameMan.PPM
1782+
local PixelVel = Owner.Vel * (GetPPM() * t)
1783+
local Accel = SceneMan.GlobalAcc * GetPPM()
17841784

17851785
-- a burst use 10x more fuel
17861786
if Owner.Jetpack:CanTriggerBurst() then
@@ -2162,16 +2162,16 @@ function HumanBehaviors.GetProjectileData(Owner)
21622162
PrjDat.rng = math.huge
21632163
elseif PrjDat.drg < 1 then -- AirResistance
21642164
PrjDat.rng = 0
2165-
local threshold = PrjDat.thr * FrameMan.PPM * TimerMan.DeltaTimeSecs -- AirThreshold in pixels/frame
2166-
local vel = PrjDat.vel * FrameMan.PPM * TimerMan.DeltaTimeSecs -- muzzle velocity in pixels/frame
2165+
local threshold = PrjDat.thr * GetPPM() * TimerMan.DeltaTimeSecs -- AirThreshold in pixels/frame
2166+
local vel = PrjDat.vel * GetPPM() * TimerMan.DeltaTimeSecs -- muzzle velocity in pixels/frame
21672167
for _ = 0, math.ceil(lifeTime/TimerMan.DeltaTimeMS) do
21682168
PrjDat.rng = PrjDat.rng + vel
21692169
if vel > threshold then
21702170
vel = vel * PrjDat.drg
21712171
end
21722172
end
21732173
else -- no AirResistance
2174-
PrjDat.rng = PrjDat.vel * FrameMan.PPM * TimerMan.DeltaTimeSecs * (lifeTime / TimerMan.DeltaTimeMS)
2174+
PrjDat.rng = PrjDat.vel * GetPPM() * TimerMan.DeltaTimeSecs * (lifeTime / TimerMan.DeltaTimeMS)
21752175
end
21762176

21772177
-- Artificially decrease reported range to make sure AI
@@ -2931,7 +2931,7 @@ function HumanBehaviors.GetAngleToHit(PrjDat, Dist)
29312931
return Dist.AbsRadAngle
29322932
else -- compensate for gravity
29332933
local rootSq, muzVelSq
2934-
local D = Dist / FrameMan.PPM -- convert from pixels to meters
2934+
local D = Dist / GetPPM() -- convert from pixels to meters
29352935
if PrjDat.drg < 1 then -- compensate for air resistance
29362936
local rng = D.Magnitude
29372937
local timeToTarget = math.floor((rng / math.max(PrjDat.vel*PrjDat.drg^math.floor(rng/(PrjDat.vel+1)+0.5), PrjDat.thr)) / TimerMan.DeltaTimeSecs) -- estimate time of flight in frames

Base.rte/AI/NativeHumanAI.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ function NativeHumanAI:Create(Owner)
5656
Owner.Jetpack.Throttle = 0.15 -- increase jetpack strength slightly to compensate for AI ineptitude
5757
end
5858

59-
Members.jetImpulseFactor = Owner.Jetpack:EstimateImpulse(false) * FrameMan.PPM / TimerMan.DeltaTimeSecs
60-
Members.jetBurstFactor = (Owner.Jetpack:EstimateImpulse(true) * FrameMan.PPM / TimerMan.DeltaTimeSecs - Members.jetImpulseFactor) * math.pow(TimerMan.DeltaTimeSecs, 2) * 0.5
59+
Members.jetImpulseFactor = Owner.Jetpack:EstimateImpulse(false) * GetPPM() / TimerMan.DeltaTimeSecs
60+
Members.jetBurstFactor = (Owner.Jetpack:EstimateImpulse(true) * GetPPM() / TimerMan.DeltaTimeSecs - Members.jetImpulseFactor) * math.pow(TimerMan.DeltaTimeSecs, 2) * 0.5
6161
Members.minBurstTime = math.min(Owner.Jetpack.BurstSpacing*2, Owner.JetTimeTotal*0.99) -- in milliseconds
6262
end
6363

Base.rte/Constants.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ rte.StartingFundsScale = 1.0;
2121
rte.PassengerMax = 3; -- Deprecated. Use 'Craft.MaxPassengers' instead
2222
rte.DiggersRate = 0.4
2323
rte.MetabaseArea = "MetabaseServiceArea"
24-
rte.PxTravelledPerFrame = FrameMan.PPM * TimerMan.DeltaTimeSecs;
24+
rte.PxTravelledPerFrame = GetPPM() * TimerMan.DeltaTimeSecs;
2525

2626
-- Materials
2727
rte.airID = 0;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ AddAmmo = MOSParticle
1111
SpriteFile = ContentFile
1212
FilePath = Base.rte/Devices/Explosives/FragGrenade/FragGrenadePin.bmp
1313
FrameCount = 8
14+
SpriteAnimMode = 7
1415
SpriteOffset = Vector
1516
X = -2
1617
Y = -2
@@ -19,7 +20,6 @@ AddAmmo = MOSParticle
1920
Material = Material
2021
PresetName = Scrap Metal
2122
TrailLength = 0
22-
Framerate = 10
2323

2424

2525
///////////////////////////////////////////////////////////////////////

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ AddEffect = MOSParticle
4444
SpriteFile = ContentFile
4545
FilePath = Base.rte/Effects/Pyro/FirePuffSmall.bmp
4646
FrameCount = 6
47+
SpriteAnimMode = 7
4748
SpriteOffset = Vector
4849
X = -8
4950
Y = -8
@@ -52,7 +53,6 @@ AddEffect = MOSParticle
5253
Material = Material
5354
CopyOf = Air
5455
TrailLength = 0
55-
Framerate = 0
5656

5757

5858
AddEffect = MOSRotating

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function Update(self)
2626
local guideParPos = self.MuzzlePos;
2727
local guideParVel = Vector(self.projectileVel,0):RadRotate(actor:GetAimAngle(true));
2828
for i = 1, self.maxTrajectoryPars do
29-
guideParVel = guideParVel + Vector((SceneMan.GlobalAcc.X/FrameMan.PPM),(SceneMan.GlobalAcc.Y/FrameMan.PPM));
29+
guideParVel = guideParVel + Vector((SceneMan.GlobalAcc.X/GetPPM()),(SceneMan.GlobalAcc.Y/GetPPM()));
3030
guideParPos = guideParPos + guideParVel;
3131
-- No need to wrap the seam manually, primitives can handle out-of-scene coordinates correctly
3232
--if SceneMan.SceneWrapsX == true then

Base.rte/Devices/Special/Medikit/Medikit.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ AddEffect = MOPixel
2828
ScreenEffect = ContentFile
2929
FilePath = Base.rte/Actors/Mecha/Medic/HealEffectGlow.bmp
3030
EffectAlwaysShows = 1
31-
EffectStartTime = -1
31+
EffectStartTime = 0
3232
EffectStopTime = 200
3333
EffectStartStrength = 0.0
3434
EffectStopStrength = 0.5

Base.rte/Devices/Tools/Disarmer/Disarmer.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function Create(self)
77
self.blink = false;
88
self.fireOn = false;
99

10-
self.disarmRange = FrameMan.PPM * 5;
10+
self.disarmRange = GetPPM() * 5;
1111
self.targetTable = {};
1212
end
1313

Base.rte/Effects.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ AddEffect = MOPixel
320320
TrailLength = 2
321321
ScreenEffect = ContentFile
322322
FilePath = Base.rte/Effects/Glows/FireGlowTiny.bmp
323-
EffectStartTime = -1
323+
EffectStartTime = 0
324324

325325

326326
///////////////////////////////////////////////////////////////////////

Base.rte/Effects/Casings.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ AddAmmo = MOSParticle
1212
SpriteFile = ContentFile
1313
FilePath = Base.rte/Effects/Casings/Casing.bmp
1414
FrameCount = 8
15+
SpriteAnimMode = 8
1516
SpriteOffset = Vector
1617
X = -2
1718
Y = -2
@@ -24,7 +25,6 @@ AddAmmo = MOSParticle
2425
Friction = 0.1
2526
StructuralIntegrity = 0.5
2627
TrailLength = 0
27-
Framerate = 10
2828

2929

3030
AddAmmo = MOSParticle
@@ -108,6 +108,7 @@ AddAmmo = MOSParticle
108108
SpriteFile = ContentFile
109109
FilePath = Base.rte/Effects/Casings/Shell.bmp
110110
FrameCount = 8
111+
SpriteAnimMode = 8
111112
SpriteOffset = Vector
112113
X = -3
113114
Y = -3
@@ -116,7 +117,6 @@ AddAmmo = MOSParticle
116117
Material = Material
117118
CopyOf = Weak Casing
118119
TrailLength = 0
119-
Framerate = 10
120120

121121

122122
AddAmmo = AEmitter

0 commit comments

Comments
 (0)