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

Commit 329d644

Browse files
committed
Minor Docks tweaks
To-do: disable collisions properly
1 parent c0d33c4 commit 329d644

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

Base.rte/Scenes/Objects/Bunkers/BunkerSystems/Conveyors/Conveyors.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ AddActor = MOSRotating
6969
Offset = Vector
7070
X = 0
7171
Y = -32
72+
GibSound = Sound
73+
CopyOf = Robot Death
7274

7375

7476
///////////////////////////////////////////////////////////////////////

Base.rte/Scenes/Objects/Bunkers/BunkerSystems/Docks/Docks.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ AddEffect = MOSRotating
88
HitsMOs = 1
99
GetsHitByMOs = 0
1010
SpriteFile = ContentFile
11-
FilePath = Base.rte/Scenes/Objects/Bunkers/BunkerSystems/Docks/DropshipDockGib.bmp
11+
FilePath = Base.rte/Scenes/Objects/Bunkers/BunkerSystems/Docks/Gibs/DropshipDockGib.bmp
1212
FrameCount = 1
1313
SpriteOffset = Vector
1414
X = -13
@@ -40,7 +40,7 @@ AddEffect = MOSRotating
4040
HitsMOs = 1
4141
GetsHitByMOs = 0
4242
SpriteFile = ContentFile
43-
FilePath = Base.rte/Scenes/Objects/Bunkers/BunkerSystems/Docks/RocketDockGib.bmp
43+
FilePath = Base.rte/Scenes/Objects/Bunkers/BunkerSystems/Docks/Gibs/RocketDockGib.bmp
4444
FrameCount = 1
4545
SpriteOffset = Vector
4646
X = -6
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
function Create(self)
2+
self.updateTimer = Timer();
23
self.healTimer = Timer();
4+
self.detectionRange = 50;
35
end
46

57
function Update(self)
6-
78
--Settle into terrain instead of gibbing
89
if self.WoundCount > (self.GibWoundLimit * 0.9) then
910
self.ToSettle = true;
1011
end
11-
1212
if self.craft and IsActor(self.craft) and self.craft.AIMode == Actor.AIMODE_STAY then
1313
--Disable collisions with the ship
1414
self.craft:SetWhichMOToNotHit(self, 100);
15-
1615
--Pin the ship and pull it nicely into the docking unit.
1716
local dist = SceneMan:ShortestDistance(self.craft.Pos, self.Pos + Vector(0, self.craft.Radius / 2), SceneMan.SceneWrapsX);
1817
self.craft.Vel = self.craft.Vel * 0.9 + dist / (3 + self.craft.Vel.Magnitude);
1918
self.craft.AngularVel = self.craft.AngularVel * 0.9 - self.craft.RotAngle * 3;
2019

21-
if self.craft.Status < 3 then
22-
self.craft.Status = 1; --Deactivated
20+
if self.craft.Status < Actor.DYING then
21+
self.craft.Status = Actor.UNSTABLE; --Deactivated
2322
end
24-
2523
--Heal the craft.
2624
if self.healTimer:IsPastSimMS(self.craft.Mass) then
2725
self.healTimer:Reset();
@@ -31,13 +29,14 @@ function Update(self)
3129
self.craft.Health = math.min(self.craft.Health + 1, self.craft.MaxHealth);
3230
end
3331
end
34-
else
32+
elseif self.updateTimer:IsPastSimMS(200) then
3533
self.craft = nil;
3634
for actor in MovableMan.Actors do
3735
--See if a live dropship is within 50 pixel range of the docking unit and if it has the AI mode set to "Stay".
38-
if (actor.ClassName == "ACDropShip") and (actor.AIMode == Actor.AIMODE_STAY) and actor.Health > 0 and (math.abs(actor.Pos.X - self.Pos.X) < 50) and (math.abs(actor.Pos.Y - self.Pos.Y) < 50) then
39-
self.craft = ToActor(actor);
36+
if (actor.ClassName == "ACDropShip") and (actor.AIMode == Actor.AIMODE_STAY) and actor.Health > 0 and (math.abs(actor.Pos.X - self.Pos.X) < self.detectionRange) and (math.abs(actor.Pos.Y - self.Pos.Y) < self.detectionRange) then
37+
self.craft = ToACDropShip(actor);
4038
end
4139
end
40+
self.updateTimer:Reset();
4241
end
4342
end
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
function Create(self)
2+
self.updateTimer = Timer();
23
self.healTimer = Timer();
4+
self.detectionRange = 40;
35
end
46

57
function Update(self)
6-
78
--Settle into terrain instead of gibbing
89
if self.WoundCount > (self.GibWoundLimit * 0.9) then
910
self.ToSettle = true;
1011
end
11-
1212
if self.craft and IsActor(self.craft) and self.craft.AIMode == Actor.AIMODE_STAY then
1313
--Disable collisions with the ship
1414
self.craft:SetWhichMOToNotHit(self, 100);
15-
1615
--Pin the ship and pull it nicely into the docking unit.
1716
local dist = SceneMan:ShortestDistance(self.craft.Pos, self.Pos + Vector(0, -self.craft.Radius / 2), SceneMan.SceneWrapsX);
1817
self.craft.Vel = self.craft.Vel * 0.9 + dist / (3 + self.craft.Vel.Magnitude);
1918
self.craft.AngularVel = self.craft.AngularVel * 0.9 - self.craft.RotAngle * 3;
2019

21-
if self.craft.Status < 3 then
22-
self.craft.Status = 1; --Deactivated
20+
if self.craft.Status < Actor.DYING then
21+
self.craft.Status = Actor.UNSTABLE; --Deactivated
2322
end
24-
2523
--Heal the craft
2624
if self.healTimer:IsPastSimMS(self.craft.Mass) then
2725
self.healTimer:Reset();
@@ -31,13 +29,14 @@ function Update(self)
3129
self.craft.Health = math.min(self.craft.Health + 1, self.craft.MaxHealth);
3230
end
3331
end
34-
else
32+
elseif self.updateTimer:IsPastSimMS(200) then
3533
self.craft = nil;
3634
for actor in MovableMan.Actors do
3735
--See if a live rocket is within 40 pixel range of the docking unit and if it has the AI mode set to "Stay".
38-
if (actor.ClassName == "ACRocket") and (actor.AIMode == Actor.AIMODE_STAY) and actor.Health > 0 and (math.abs(actor.Pos.X - self.Pos.X) < 40) and (math.abs(actor.Pos.Y - self.Pos.Y) < 40) then
36+
if (actor.ClassName == "ACRocket") and (actor.AIMode == Actor.AIMODE_STAY) and actor.Health > 0 and (math.abs(actor.Pos.X - self.Pos.X) < self.detectionRange) and (math.abs(actor.Pos.Y - self.Pos.Y) < self.detectionRange) then
3937
self.craft = ToActor(actor);
4038
end
4139
end
40+
self.updateTimer:Reset();
4241
end
4342
end

0 commit comments

Comments
 (0)