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

Commit 7b3fd87

Browse files
committed
Removed unneccessary comments
Other minor tweaks Added a tiny bit of oomph to JetpackStart.wav
1 parent 9e85693 commit 7b3fd87

File tree

7 files changed

+47
-95
lines changed

7 files changed

+47
-95
lines changed

Base.rte/AI/RocketAI.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ function UpdateAI(self)
202202

203203
-- Control up/down movement
204204
if self.DeliveryState ~= ACraft.UNLOAD then
205-
--local limit = self.Mass * -0.0157 + 29 -- Descend slower when carrying a heavy cargo
206205
local change = self.YposPID:Update(-(self.LZpos.Y - (self.Pos.Y + self.Vel.Y)), 0);
207206
if math.abs(self.RotAngle) < 0.9 then
208207
if self.DeliveryState == ACraft.LAUNCH and change > 7 then

Base.rte/Craft/DropShips/DropshipMK1.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,7 @@ AddActor = ACDropShip
15291529
Y = 28
15301530
Velocity = Vector
15311531
X = 0
1532-
Y = 4
1532+
Y = 6
15331533
Radius = 22
15341534
Range = 45
15351535
CrashSound = Sound

Base.rte/Craft/DropShips/DropshipMK1.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ function Create(self)
55
self.AI = NativeDropShipAI:Create(self);
66
self.Frame = math.random(0, self.FrameCount - 1);
77

8-
self.explTimer = Timer();
9-
self.expldelay = 3000 / math.sqrt(self.Radius + 1);
8+
self.explosionTimer = Timer();
9+
self.explosiondelay = 3000 / math.sqrt(self.Radius + 1);
1010

1111
self.height = ToMOSprite(self):GetSpriteHeight();
1212
self.width = ToMOSprite(self):GetSpriteWidth();
@@ -25,9 +25,9 @@ function Update(self)
2525
self.RotAngle = self.RotAngle + (math.pi * 2);
2626
end
2727
-- Explosion effects on scuttle
28-
if self.Status > 2 or self.AIMode == Actor.AIMODE_SCUTTLE then
29-
if self.explTimer:IsPastSimMS(self.expldelay) then
30-
self.explTimer:Reset();
28+
if self.Status > Actor.UNSTABLE or self.AIMode == Actor.AIMODE_SCUTTLE then
29+
if self.explosionTimer:IsPastSimMS(self.explosiondelay) then
30+
self.explosionTimer:Reset();
3131
local expl = CreateAEmitter("Scuttle Explosion");
3232
expl.Pos = self.Pos + Vector(self.width / 2, self.height / 2):RadRotate(self.RotAngle) * RangeRand(-0.8, 0.8);
3333
expl.Vel = self.Vel;

Base.rte/Craft/Shared/MGTurret.lua

Lines changed: 28 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,89 +6,81 @@ function Create(self)
66
-- Toggle visibility of the aim area / trace to see how the detection works
77
self.showAim = false;
88
-- Angle alteration variables (do not touch)
9-
self.rotNum = 0; -- Left / Right
10-
self.vertiNum = 0; -- Up / Down
9+
self.rotation = 0; -- Left / Right movement affecting turret angle
10+
self.verticalFactor = 0; -- How Up / Down movement affects turret angle
1111
end
12-
1312
function Update(self)
14-
15-
local mo = self:GetParent();
16-
if mo and IsActor(mo) then
13+
local parent = self:GetParent();
14+
if parent and IsActor(parent) then
1715

18-
local parent = ToActor(mo);
19-
20-
local ctrl = parent:GetController();
21-
22-
if ctrl:IsState(Controller.MOVE_RIGHT) then
23-
self.rotNum = self.rotNum + self.turnSpeed;
16+
local parent = ToActor(parent);
17+
local controller = parent:GetController();
18+
19+
if controller:IsState(Controller.MOVE_RIGHT) then
20+
self.rotation = self.rotation + self.turnSpeed;
2421
end
25-
if ctrl:IsState(Controller.MOVE_LEFT) then
26-
self.rotNum = self.rotNum - self.turnSpeed;
22+
if controller:IsState(Controller.MOVE_LEFT) then
23+
self.rotation = self.rotation - self.turnSpeed;
2724
end
2825
-- Spread / tighten aim when moving up / down
29-
if ctrl:IsState(Controller.MOVE_DOWN) then
30-
self.vertiNum = self.vertiNum - self.turnSpeed;
26+
if controller:IsState(Controller.MOVE_DOWN) then
27+
self.verticalFactor = self.verticalFactor - self.turnSpeed;
3128
end
32-
if math.abs(self.rotNum) > 0.001 then
33-
self.rotNum = self.rotNum / (1 + self.turnSpeed * 2);
29+
if math.abs(self.rotation) > 0.001 then
30+
self.rotation = self.rotation / (1 + self.turnSpeed * 2);
3431
else
35-
self.rotNum = 0;
32+
self.rotation = 0;
3633
end
37-
if math.abs(self.vertiNum) > 0.001 then
38-
self.vertiNum = self.vertiNum / (1 + self.turnSpeed * 4);
34+
if math.abs(self.verticalFactor) > 0.001 then
35+
self.verticalFactor = self.verticalFactor / (1 + self.turnSpeed * 4);
3936
else
40-
self.vertiNum = 0;
37+
self.verticalFactor = 0;
4138
end
4239
-- Aim directly away from parent ship
4340
local posTrace = SceneMan:ShortestDistance(parent.Pos, self.Pos, SceneMan.SceneWrapsX):SetMagnitude(self.searchRange / 2);
44-
self.RotAngle = (1.57 * self.vertiNum + posTrace.AbsRadAngle) / (1 + self.vertiNum) - self.rotNum;
41+
self.RotAngle = (1.57 * self.verticalFactor + posTrace.AbsRadAngle) / (1 + self.verticalFactor) - self.rotation;
4542
if self.areaMode then -- Area Mode
4643
local aimPos = self.Pos + Vector((self.searchRange / 2), 0):RadRotate(self.RotAngle);
47-
4844
-- Debug: visualize aim area
4945
if self.showAim then
5046
FrameMan:DrawCirclePrimitive(self.Team, aimPos, (self.searchRange / 2), 13);
5147
end
52-
5348
local aimTarget = MovableMan:GetClosestEnemyActor(self.Team, aimPos, (self.searchRange / 2), Vector());
5449
if aimTarget then
55-
5650
-- Debug: visualize search trace
5751
if self.showAim then
5852
FrameMan:DrawLinePrimitive(self.Team, aimPos, aimTarget.Pos, 13);
5953
end
60-
6154
-- Check that the target isn't obscured by terrain
6255
local aimTrace = SceneMan:ShortestDistance(self.Pos, aimTarget.Pos, SceneMan.SceneWrapsX);
6356
local terrCheck = SceneMan:CastStrengthRay(self.Pos, aimTrace, 30, Vector(), 5, 0, SceneMan.SceneWrapsX);
64-
6557
if terrCheck == false then
6658
self.RotAngle = aimTrace.AbsRadAngle;
6759
-- Debug: visualize aim trace
6860
if self.showAim then
6961
FrameMan:DrawLinePrimitive(self.Team, self.Pos, aimTarget.Pos, 254);
7062
end
7163
self:EnableEmission(true);
72-
self:TriggerBurst(); -- Fire!
64+
self:TriggerBurst();
7365
end
7466
end
7567
else -- Default Mode
7668
local target;
7769
local aimTrace = Vector(self.searchRange, 0):RadRotate(self.RotAngle);
7870
-- Search for MOs directly in line of sight of two rays
79-
local mocheck1 = SceneMan:CastMORay(self.Pos, aimTrace:RadRotate(1 / math.sqrt(self.searchRange)), parent.ID, self.Team, 0, false, 5);
80-
if mocheck1 ~= 255 then
81-
target = MovableMan:GetMOFromID(MovableMan:GetMOFromID(mocheck1).RootID);
71+
local moCheck1 = SceneMan:CastMORay(self.Pos, aimTrace:RadRotate(1 / math.sqrt(self.searchRange)), parent.ID, self.Team, 0, false, 5);
72+
if moCheck1 ~= rte.NoMOID then
73+
target = MovableMan:GetMOFromID(MovableMan:GetMOFromID(moCheck1).RootID);
8274
else
83-
local mocheck2 = SceneMan:CastMORay(self.Pos, aimTrace:RadRotate(-1 / math.sqrt(self.searchRange)), parent.ID, self.Team, 0, false, 5);
84-
if mocheck2 ~= 255 then
85-
target = MovableMan:GetMOFromID(MovableMan:GetMOFromID(mocheck2).RootID);
75+
local moCheck2 = SceneMan:CastMORay(self.Pos, aimTrace:RadRotate(-1 / math.sqrt(self.searchRange)), parent.ID, self.Team, 0, false, 5);
76+
if moCheck2 ~= rte.NoMOID then
77+
target = MovableMan:GetMOFromID(MovableMan:GetMOFromID(moCheck2).RootID);
8678
end
8779
end
8880
local color = 13; -- Debug trace color: red
8981
if target and IsActor(target) then
9082
self:EnableEmission(true);
91-
self:TriggerBurst(); -- Fire!
83+
self:TriggerBurst();
9284

9385
if self:IsSetToBurst() then
9486
color = 254; -- Debug trace color: white

Base.rte/Craft/StorageCrate/Crate.ini

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -159,45 +159,13 @@ AddActor = ACRocket
159159
Y = 0
160160
// ExitInterval = 1000
161161
RaisedGearLimbPath = LimbPath
162-
PresetName = Rocket Gear Raised Path
163-
StartOffset = Vector
164-
X = 0
165-
Y = 0
166-
StartSegCount = 0
167-
SlowTravelSpeed = 0
168-
NormalTravelSpeed = 0
169-
FastTravelSpeed = 0
170-
PushForce = 0
162+
CopyOf = Null Path
171163
LoweredGearLimbPath = LimbPath
172-
PresetName = Rocket Gear Lowered Path
173-
StartOffset = Vector
174-
X = 0
175-
Y = 0
176-
StartSegCount = 0
177-
SlowTravelSpeed = 0
178-
NormalTravelSpeed = 0
179-
FastTravelSpeed = 0
180-
PushForce = 0
164+
CopyOf = Null Path
181165
LoweringGearLimbPath = LimbPath
182-
PresetName = Rocket Gear Lowering Path
183-
StartOffset = Vector
184-
X = 0
185-
Y = 0
186-
StartSegCount = 0
187-
SlowTravelSpeed = 0
188-
NormalTravelSpeed = 0
189-
FastTravelSpeed = 0
190-
PushForce = 0
166+
CopyOf = Null Path
191167
RaisingGearLimbPath = LimbPath
192-
PresetName = Rocket Gear Raising Path
193-
StartOffset = Vector
194-
X = 0
195-
Y = 0
196-
StartSegCount = 0
197-
SlowTravelSpeed = 0
198-
NormalTravelSpeed = 0
199-
FastTravelSpeed = 0
200-
PushForce = 0
168+
CopyOf = Null Path
201169
CrashSound = Sound
202170
CopyOf = Metal Body Blunt Hit Large
203171
// GibImpulseLimit = 14000

Base.rte/Craft/StorageCrate/DropCrate.lua

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,29 @@
11
function Create(self)
22
self.GibTimer = Timer();
3-
-- Choose horizontal direction
4-
local dir = 1;
5-
if math.random() > 0.5 then
6-
dir = -1;
7-
end
3+
self.GibTimer:SetSimTimeLimitMS(1000 + self.InventorySize * 100);
4+
-- Choose a random horizontal direction
5+
local randomDirection = math.random() > 0.5 and 1 or -1;
86
-- Randomize velocities
9-
self.AngularVel = -dir * math.random(1, 5);
10-
self.Vel = Vector(dir * math.random(5, 20), 30);
7+
self.AngularVel = -randomDirection * math.random(1, 5);
8+
self.Vel = Vector(randomDirection * math.random(5, 20), 30);
119
end
1210
function Update(self)
1311
-- Apply damage to the actors inside based on impulse forces
1412
if self.TravelImpulse.Magnitude > self.Mass then
15-
-- Take crate damage to account?
1613
for i = 1, self.InventorySize do
1714
local actor = self:Inventory();
18-
if actor and IsActor(actor) then
15+
if actor and IsActor(actor) and string.find(actor.Material.PresetName, "Flesh") then
1916
actor = ToActor(actor);
2017
-- The following method is a slightly revised version of the hardcoded impulse damage system
2118
local impulse = self.TravelImpulse.Magnitude - actor.ImpulseDamageThreshold;
2219
local damage = impulse / (actor.GibImpulseLimit * 0.1 + actor.Material.StructuralIntegrity * 10);
23-
if damage > 0 then
24-
actor.Health = actor.Health - damage;
25-
end
26-
if actor.Status < 3 then
27-
actor.Status = 1;
28-
end
20+
actor.Health = damage > 0 and actor.Health - damage or actor.Health;
21+
actor.Status = actor.Status < Actor.DYING and Actor.UNSTABLE or actor.Status;
2922
end
3023
self:SwapNextInventory(actor, true);
3124
end
3225
end
33-
if self.GibTimer:IsPastSimMS(2000) then
26+
if self.GibTimer:IsPastSimTimeLimit() then
3427
self:GibThis();
3528
elseif self.Vel.Largest > 5 or self.AIMode == Actor.AIMODE_STAY then
3629
self.GibTimer:Reset();
-48 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)