Skip to content

Commit 0f9e347

Browse files
committed
add and test Info Consoles
1 parent cb3ae50 commit 0f9e347

File tree

11 files changed

+281
-5
lines changed

11 files changed

+281
-5
lines changed
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/RefineryAssaultFunctions.lua

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,21 @@ function RefineryAssault:HandleMessage(message, object)
527527
self.humanAIGoldIncreaseAmount = self.humanAIGoldIncreaseAmount + 20;
528528
self.playerGoldIncreaseAmount = self.playerGoldIncreaseAmount + 20;
529529

530+
if not self.saveTable.capturedAtLeastOneBank then
531+
self.saveTable.capturedAtLeastOneBank = true;
532+
self.HUDHandler:QueueScreenText(self.humanTeam,
533+
"You've just linked a FreeTrade account over to us!",
534+
5000,
535+
0,
536+
true);
537+
538+
self.HUDHandler:QueueScreenText(self.humanTeam,
539+
"We'll siphon the funds as fast as we can. Keep it up!",
540+
5000,
541+
0,
542+
true);
543+
end
544+
530545
elseif message == "Captured_RefineryGoldVaultCapturable" then
531546

532547
self.humanAIGoldIncreaseAmount = self.humanAIGoldIncreaseAmount + 4;
@@ -535,6 +550,21 @@ function RefineryAssault:HandleMessage(message, object)
535550
self:ChangeAIFunds(self.humanTeam, 2000);
536551
self:ChangeTeamFunds(2000, self.humanTeam); -- player, will also play gold sound
537552

553+
if not self.saveTable.capturedAtLeastOneVault then
554+
self.saveTable.capturedAtLeastOneVault = true;
555+
self.HUDHandler:QueueScreenText(self.humanTeam,
556+
"FreeTrade's just let us know some gold reserves have been transferred to us.",
557+
5000,
558+
0,
559+
true);
560+
561+
self.HUDHandler:QueueScreenText(self.humanTeam,
562+
"Whatever you did, we have more funds available now. Keep at it.",
563+
5000,
564+
0,
565+
true);
566+
end
567+
538568
elseif message == "Refinery_S4CameraServerBroken" then
539569

540570
self.saveTable.cameraServerBroken = self.saveTable.cameraServerBroken == nil and 1 or self.saveTable.cameraServerBroken + 1;
@@ -634,7 +664,13 @@ function RefineryAssault:HandleMessage(message, object)
634664
elseif message == "Captured_RefineryS9BossBankCapturable" then
635665

636666
self.humanAIGoldIncreaseAmount = self.humanAIGoldIncreaseAmount + 30;
637-
self.playerGoldIncreaseAmount = self.playerGoldIncreaseAmount + 30;
667+
self.playerGoldIncreaseAmount = self.playerGoldIncreaseAmount + 30;
668+
669+
self.HUDHandler:QueueScreenText(self.humanTeam,
670+
"Seems to be the Baron's own account... we'll drain it.",
671+
5000,
672+
0,
673+
true);
638674

639675
elseif message == "Captured_RefineryS9FinalConsole" then
640676

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
///////////////////////////////////////////////////////////////////////
2+
// Refinery info consoles
3+
4+
AddActor = MOSRotating
5+
CopyOf = Generic Info Console
6+
PresetName = Refinery LC Hack Info Console
7+
ScriptPath = Browncoats.rte/Scenes/Objects/InfoConsoles/RefineryInfoConsoleFX.lua
8+
AddCustomValue = NumberValue
9+
Range = 45
10+
AddCustomValue = StringValue
11+
SceneInfoArea = InfoArea_LCHackInfoConsole
12+
AddCustomValue = StringValue
13+
DeactivationMessage = DeactivateInfoConsole_LCHackInfoConsole
14+
AddCustomValue = StringValue
15+
ActivationMessage = ActivateInfoConsole_LCHackInfoConsole
16+
AddCustomValue = NumberValue
17+
DisplayToAllTeams = 1
18+
AddCustomValue = StringValue
19+
MessageToDisplay = Hacking the relevant consoles will unlock an area's Reinforcement Doors./nThese will periodically deliver friendly troops, as well as letting you order your own.
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/Browncoats.rte/Scenes/Objects/Objects.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
IncludeFile = Browncoats.rte/Scenes/Objects/Breakables/Breakables.ini
22
IncludeFile = Browncoats.rte/Scenes/Objects/Capturables/Capturables.ini
3+
IncludeFile = Browncoats.rte/Scenes/Objects/InfoConsoles/InfoConsoles.ini
34
IncludeFile = Browncoats.rte/Scenes/Objects/ItemDispensers/ItemDispensers.ini
45
IncludeFile = Browncoats.rte/Scenes/Objects/ActorSpawners/ActorSpawners.ini
56

0 commit comments

Comments
 (0)