Skip to content

Commit c63cf09

Browse files
committed
Merge branch 'browncoat-mission' of https://github.com/cortex-command-community/Cortex-Command-Community-Project into browncoat-mission
2 parents 3dac8ad + 7bb7f07 commit c63cf09

File tree

44 files changed

+655
-111
lines changed

Some content is hidden

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

44 files changed

+655
-111
lines changed

Data/Base.rte/Devices/Explosives/RemoteExplosive/RemoteExplosiveDetonator.lua

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ function Create(self)
1010
end
1111

1212
function ThreadedUpdate(self)
13-
if self.ID ~= self.RootID then
14-
local actor = MovableMan:GetMOFromID(self.RootID);
15-
if MovableMan:IsActor(actor) then
16-
self.alliedTeam = ToActor(actor).Team;
17-
end
13+
local parent = self:GetRootParent();
14+
if MovableMan:IsActor(parent) then
15+
self.alliedTeam = ToActor(parent).Team;
1816
end
1917
if self.Magazine then
2018
if self:IsActivated() then
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
///////////////////////////////////////////////////////////////////////
2+
// Generic Info Console
3+
4+
AddActor = MOSRotating
5+
PresetName = Generic Info Console
6+
AddToGroup = Bunker Systems
7+
Description = Generic info console. Displays text. Copy it and fill in the below variables yourself.
8+
PinStrength = 11000
9+
Mass = 0
10+
Buyable = 1
11+
GoldValue = 200
12+
RestThreshold = 0
13+
HitsMOs = 0
14+
GetsHitByMOs = 0
15+
SpriteFile = ContentFile
16+
FilePath = Base.rte/Scenes/Objects/Bunkers/BunkerSystems/GenericInfoConsole/GenericInfoConsole.png
17+
FrameCount = 2
18+
SpriteOffset = Vector
19+
X = -23
20+
Y = -35
21+
SpriteAnimMode = 0
22+
SpriteAnimDuration = 0
23+
ScriptPath = Base.rte/Scenes/Objects/Bunkers/BunkerSystems/GenericInfoConsole/GenericInfoConsole.lua
24+
AddCustomValue = NumberValue // Range at which the text will display. Will use own diameter if not present.
25+
Range = 45
26+
AddCustomValue = StringValue // Optional, will use an Area instead of the above Range. Delete if unused.
27+
SceneInfoArea = InfoArea_GenericInfoConsole
28+
AddCustomValue = StringValue // Message to listen for that deactivates this info console.
29+
DeactivationMessage = DeactivateInfoConsole_GenericInfoConsole
30+
AddCustomValue = StringValue // Message to listen for that activates this capturable.
31+
ActivationMessage = ActivateInfoConsole_GenericInfoConsole
32+
AddCustomValue = NumberValue // Whether to display for all teams or only for this info console's team.
33+
DisplayToAllTeams = 1
34+
AddCustomValue = StringValue // The message to display. Use /n for a new line.
35+
MessageToDisplay = This is the generic info console info message./nThis is a new line.
36+
AtomGroup = AtomGroup
37+
AutoGenerate = 1
38+
39+
AddActor = MOSRotating
40+
CopyOf = Generic Info Console
41+
PresetName = Generic Info Console FX Demo
42+
ScriptPath = Base.rte/Scenes/Objects/Bunkers/BunkerSystems/GenericInfoConsole/GenericInfoConsoleFX.lua
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
function OnGlobalMessage(self, message, object)
2+
if message == self.deactivationMessage or message == "DEACTIVATEALLINFOCONSOLES" then
3+
self.Deactivated = true;
4+
elseif message == self.activationMessage or message == "ACTIVATEALLINFOCONSOLES" then
5+
self.Deactivated = false;
6+
end
7+
end
8+
9+
function OnMessage(self, message, object)
10+
if message == self.deactivationMessage or message == "DEACTIVATEALLINFOCONSOLES" then
11+
self.Deactivated = true;
12+
elseif message == self.activationMessage or message == "ACTIVATEALLINFOCONSOLES" then
13+
self.Deactivated = false;
14+
end
15+
end
16+
17+
function Create(self)
18+
self.Team = self:NumberValueExists("StartTeam") and self:GetNumberValue("StartTeam") or 0;
19+
20+
self.deactivationMessage = self:GetStringValue("DeactivationMessage");
21+
self.activationMessage = self:GetStringValue("ActivationMessage");
22+
23+
if self:GetNumberValue("Deactivated") == 1 then
24+
self.Deactivated = true;
25+
end
26+
27+
self:RemoveNumberValue("Deactivated");
28+
29+
self.actorCheckTimer = Timer();
30+
self.actorCheckDelay = 250;
31+
32+
self.Activity = ToGameActivity(ActivityMan:GetActivity());
33+
self.Scene = SceneMan.Scene;
34+
if self:StringValueExists("SceneInfoArea") then
35+
if self.Scene:HasArea(self:GetStringValue("SceneInfoArea")) then
36+
self.infoArea = self.Scene:GetArea(self:GetStringValue("SceneInfoArea"));
37+
end
38+
end
39+
40+
if self:NumberValueExists("Range") then
41+
self.Range = self:GetNumberValue("Range");
42+
end
43+
self.displayToAllTeams = self:GetNumberValue("DisplayToAllTeams") == 1 and true or false;
44+
self.messageString = self:GetStringValue("MessageToDisplay");
45+
46+
self.newLines = 0;
47+
local stringIndex = 1;
48+
while true do
49+
if string.find(self.messageString, "/n", stringIndex) then
50+
stringIndex = string.find(self.messageString, "/n", stringIndex) + 2;
51+
self.newLines = self.newLines + 1;
52+
else
53+
break;
54+
end
55+
end
56+
-- Now replace all /n with real newlines
57+
self.messageToDisplay = string.gsub(self.messageString, [[/n]],
58+
[[
59+
60+
]])
61+
62+
end
63+
64+
function ThreadedUpdate(self)
65+
if self.actorCheckTimer:IsPastSimMS(self.actorCheckDelay) then
66+
self.actorCheckTimer:Reset();
67+
68+
local validDetection = false;
69+
70+
if self.infoArea then
71+
for box in self.infoArea.Boxes do
72+
for actor in MovableMan:GetMOsInBox(box, -1, true) do
73+
if IsActor(actor) then
74+
if ToActor(actor):IsPlayerControlled() then
75+
if self.displayToAllTeams then
76+
validDetection = true;
77+
elseif actor.Team == self.Team then
78+
validDetection = true;
79+
end
80+
end
81+
end
82+
end
83+
end
84+
else -- range
85+
local actorList = MovableMan:GetMOsInRadius(self.Pos, self.Range or self.Diameter, -1, true);
86+
for actor in actorList do
87+
if IsActor(actor) then
88+
if ToActor(actor):IsPlayerControlled() then
89+
if self.displayToAllTeams then
90+
validDetection = true;
91+
elseif actor.Team == self.Team then
92+
validDetection = true;
93+
end
94+
end
95+
end
96+
end
97+
end
98+
99+
if validDetection then
100+
self.shouldDisplayMessage = true;
101+
else
102+
self.shouldDisplayMessage = false;
103+
end
104+
105+
-- Also check how many newlines we have
106+
self.newLines = 0;
107+
local stringIndex = 1;
108+
while true do
109+
if string.find(self.messageString, "/n", stringIndex) then
110+
stringIndex = string.find(self.messageString, "/n", stringIndex) + 2;
111+
self.newLines = self.newLines + 1;
112+
else
113+
break;
114+
end
115+
end
116+
-- Now replace all /n with real newlines
117+
self.messageToDisplay = string.gsub(self.messageString, [[/n]],
118+
[[
119+
120+
]])
121+
end
122+
123+
if self.shouldDisplayMessage then
124+
PrimitiveMan:DrawTextPrimitive(self.Pos + Vector(0, -40) + Vector(0, -9 * self.newLines), self.messageToDisplay, true, 1);
125+
end
126+
127+
end
128+
129+
function OnSave(self)
130+
self:SetNumberValue("Deactivated", self.Deactivated and 1 or 0);
131+
end
1.46 KB
Loading
1.5 KB
Loading
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
function Create(self)
2+
self.FXTimer = Timer();
3+
self.FXDelay = 1000;
4+
end
5+
6+
function ThreadedUpdate(self)
7+
if self.shouldDisplayMessage then
8+
self.Frame = 1;
9+
else
10+
if self.FXTimer:IsPastSimMS(self.FXDelay) then
11+
self.FXTimer:Reset();
12+
self.Frame = (self.Frame + 1) % 2;
13+
end
14+
end
15+
end

Data/Base.rte/Scenes/Objects/Bunkers/Bunkers.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ IncludeFile = Base.rte/Scenes/Objects/Bunkers/BunkerSystems/BackgroundDoors/Back
2929
IncludeFile = Base.rte/Scenes/Objects/Bunkers/BunkerSystems/BuyDoor/BuyDoor.ini
3030
IncludeFile = Base.rte/Scenes/Objects/Bunkers/BunkerSystems/ItemDispenser/ItemDispenser.ini
3131
IncludeFile = Base.rte/Scenes/Objects/Bunkers/BunkerSystems/GenericCapturable/GenericCapturable.ini
32+
IncludeFile = Base.rte/Scenes/Objects/Bunkers/BunkerSystems/GenericInfoConsole/GenericInfoConsole.ini
3233
IncludeFile = Base.rte/Scenes/Objects/Bunkers/BunkerSystems/ActorSpawner/ActorSpawner.ini
3334
IncludeFile = Base.rte/Scenes/Objects/Bunkers/BunkerSystems/BunkerSystems.ini
3435

Data/Browncoats.rte/Activities/RefineryAssault.lua

Lines changed: 59 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -412,34 +412,71 @@ function RefineryAssault:UpdateActivity()
412412
-- end
413413
-- end
414414
-- end
415+
416+
if not self.saveTable.gameFinished then
415417

416-
-- Monitor stage objectives
417-
self.stageFunc = self.stageFunctionTable[self.Stage];
418-
self:stageFunc();
418+
-- Monitor stage objectives
419+
self.stageFunc = self.stageFunctionTable[self.Stage];
420+
self:stageFunc();
419421

420-
self:UpdateFunds();
421-
422-
-- Seek tasks to create squads for
423-
-- Only human team uses docks
424-
local team, task = self.tacticsHandler:UpdateTacticsHandler();
425-
426-
if task and self:GetAIFunds(team) > 0 then
427-
--print("gottask")
428-
local squad;
429-
if team == self.aiTeam then
430-
squad = self:SendBuyDoorDelivery(team, task);
431-
else
432-
if math.random() < 0.2 then
433-
squad = self:SendDockDelivery(team, task);
434-
else
422+
self:UpdateFunds();
423+
424+
-- Seek tasks to create squads for
425+
-- Only human team uses docks
426+
local team, task = self.tacticsHandler:UpdateTacticsHandler();
427+
428+
if task and self:GetAIFunds(team) > 0 then
429+
--print("gottask")
430+
local squad;
431+
if team == self.aiTeam then
435432
squad = self:SendBuyDoorDelivery(team, task);
433+
else
434+
if math.random() < 0.2 then
435+
squad = self:SendDockDelivery(team, task);
436+
else
437+
squad = self:SendBuyDoorDelivery(team, task);
438+
end
439+
if not squad then
440+
squad = self:SendBuyDoorDelivery(team, task);
441+
end
436442
end
437-
if not squad then
438-
squad = self:SendBuyDoorDelivery(team, task);
443+
if squad then
444+
self.tacticsHandler:AddSquad(team, squad, task.Name, true);
439445
end
440446
end
441-
if squad then
442-
self.tacticsHandler:AddSquad(team, squad, task.Name, true);
447+
else
448+
if self.saveTable.finalMessageTimer and self.saveTable.finalMessageTimer:IsPastSimMS(2000) and not self.saveTable.finalMessagesQueued then
449+
self.saveTable.finalMessagesQueued = true;
450+
451+
self.HUDHandler:QueueScreenText(self.humanTeam,
452+
"The Baron's death has forced the refinery to surrender to us wholly. Brilliant job!",
453+
7000,
454+
0,
455+
true);
456+
457+
self.HUDHandler:QueueScreenText(self.humanTeam,
458+
"Aside from utterly defeating the fearsome Browncoats, this facility will be indispensable.",
459+
13000,
460+
0,
461+
true);
462+
463+
self.HUDHandler:QueueScreenText(self.humanTeam,
464+
"Oil and steel alike are available to us in great quantities - after a few repairs, anyway...",
465+
10000,
466+
0,
467+
true);
468+
469+
self.HUDHandler:QueueScreenText(self.humanTeam,
470+
"And now lacking a leader, what's left of the Browncoats may very well fight for us instead.",
471+
15000,
472+
0,
473+
true);
474+
475+
self.HUDHandler:QueueScreenText(self.humanTeam,
476+
"Today is a great victory. Your efforts will not be forgotten, commander.",
477+
20000,
478+
0,
479+
true);
443480
end
444481
end
445482

0 commit comments

Comments
 (0)