Skip to content

Commit

Permalink
Add SetComputerBarrier
Browse files Browse the repository at this point in the history
  • Loading branch information
kubaau committed Jul 23, 2024
1 parent 15fc611 commit 784a701
Show file tree
Hide file tree
Showing 14 changed files with 147 additions and 299 deletions.
33 changes: 4 additions & 29 deletions data/RTTR/campaigns/roman/MISS202.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function checkVersion()
end
-------------------------------- mission events and texts ---------------------
-- Message-Window (mission statement and hints): 52 chars wide
eIdx = {1, 2, 3, 98, 99}
eIdx = {1, 2, 3, 99}

rttr:RegisterTranslations(
{
Expand Down Expand Up @@ -163,6 +163,9 @@ function onStart(isFirstStart)
MissionEvent(1) -- initial event / start screen
end

rttr:GetWorld():SetComputerBarrier(6, 70, 71)
rttr:GetWorld():SetComputerBarrier(6, 59, 60)

if isFirstStart then
-- type 8 == 7 in rttr
rttr:GetWorld():AddAnimal( 70, 72, SPEC_DUCK)
Expand Down Expand Up @@ -239,26 +242,6 @@ function addPlayerBld(p, onLoad)

if(p == 0) then
rttr:GetPlayer(p):DisableBuilding(BLD_LOOKOUTTOWER, false)

else
rttr:GetPlayer(p):SetRestrictedArea(
nil, nil, -- enable the whole map
0, 0,
0, 127,
127, 127,
127, 0,
nil, nil, -- R=6, X=70, Y=71 V R=6, X=59, Y=60
73, 65,
76, 71,
73, 77,
67, 77,
56, 66,
53, 60,
56, 54,
62, 54,
73, 65,
nil, nil
)
end
end

Expand Down Expand Up @@ -492,10 +475,6 @@ function onOccupied(p, x, y)

if( (x == 89) and (y == 20) ) then MissionEvent(99)
end

if(not rttr:GetPlayer(1):IsInRestrictedArea(x, y)) then
MissionEvent(98) -- for lifting restrictions
end
end

function onExplored(p, x, y, o)
Expand All @@ -515,10 +494,6 @@ function MissionEvent(e, onLoad)
-- call side effects for active events, check "eState[e] == 1" for multiple call events!
if(e == 2) then
rttr:GetPlayer(0):EnableBuilding(BLD_LOOKOUTTOWER, not onLoad)

elseif(e == 98) then
rttr:GetPlayer(1):SetRestrictedArea()
rttr:GetPlayer(2):SetRestrictedArea()

elseif(e == 99) then
-- TODO: EnableNextMissions()
Expand Down
50 changes: 7 additions & 43 deletions data/RTTR/campaigns/roman/MISS203.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function checkVersion()
end
-------------------------------- mission events and texts ---------------------
-- Message-Window (mission statement and hints): 52 chars wide
eIdx = {1, 2, 3, 98, 99}
eIdx = {1, 2, 3, 99}

rttr:RegisterTranslations(
{
Expand Down Expand Up @@ -161,7 +161,12 @@ function onStart(isFirstStart)
eHist = {["n"] = 0}
MissionEvent(1) -- initial event / start screen
end


rttr:GetWorld():SetComputerBarrier(14, 61, 75)
rttr:GetWorld():SetComputerBarrier(13, 62, 92)
rttr:GetWorld():SetComputerBarrier(12, 77, 37)
rttr:GetWorld():SetComputerBarrier(12, 79, 24)

if isFirstStart then
-- type 8 == 7 in rttr
rttr:GetWorld():AddAnimal( 8, 17, SPEC_POLARBEAR)
Expand Down Expand Up @@ -213,39 +218,6 @@ function addPlayerBld(p, onLoad)
rttr:GetPlayer(p):EnableAllBuildings()
rttr:GetPlayer(p):DisableBuilding(BLD_SHIPYARD, false)
rttr:GetPlayer(p):DisableBuilding(BLD_HARBORBUILDING, false)

if not (p == 0) then
-- set restriction area for all AIs
rttr:GetPlayer(p):SetRestrictedArea(
nil, nil, -- enable the whole map
0, 0,
0, 127,
127, 127,
127, 0,
nil, nil, -- R=12, X=77, Y=37 V R=12->8, X=79, Y=24
83, 16,
87, 24,
89, 37,
83, 49,
71, 49,
65, 37,
71, 24,
83, 16,
nil, nil, -- R=14, X=61, Y=75 V R=13, X=62, Y=92
68, 61,
75, 75,
68, 79,
75, 92,
68, 105,
55, 105,
49, 92,
54, 89,
47, 75,
54, 61,
68, 61,
nil, nil
)
end
end

-------------------------------- set resources --------------------------------
Expand Down Expand Up @@ -480,10 +452,6 @@ function onOccupied(p, x, y)
if( (x == 10) and (y == 37) ) then MissionEvent(2)
elseif( (x == 97) and (y == 68) ) then MissionEvent(99)
end

if(not rttr:GetPlayer(1):IsInRestrictedArea(x, y)) then
MissionEvent(98) -- for lifting restrictions
end
end

function onExplored(p, x, y)
Expand All @@ -508,10 +476,6 @@ function MissionEvent(e, onLoad)
rttr:GetPlayer(0):EnableBuilding(BLD_HARBORBUILDING, not onLoad)
rttr:GetPlayer(0):EnableBuilding(BLD_SHIPYARD, not onLoad)

elseif(e == 98) then
rttr:GetPlayer(1):SetRestrictedArea()
rttr:GetPlayer(2):SetRestrictedArea()

elseif(e == 99) then
-- TODO: EnableNextMissions()
-- Show opened arc
Expand Down
96 changes: 14 additions & 82 deletions data/RTTR/campaigns/roman/MISS205.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function checkVersion()
end
-------------------------------- mission events and texts --------------------
-- Message-Window (mission statement and hints): 52 chars wide
eIdx = {1, 2, 3, 98, 99}
eIdx = {1, 2, 3, 99}

rttr:RegisterTranslations(
{
Expand Down Expand Up @@ -156,6 +156,18 @@ function onStart(isFirstStart)
MissionEvent(1) -- initial event / start screen
end

rttr:GetWorld():SetComputerBarrier(16, 162, 69)
rttr:GetWorld():SetComputerBarrier(17, 148, 107)
rttr:GetWorld():SetComputerBarrier(15, 131, 71)
rttr:GetWorld():SetComputerBarrier(16, 103, 40)
rttr:GetWorld():SetComputerBarrier(13, 124, 93)
rttr:GetWorld():SetComputerBarrier(13, 103, 49)
rttr:GetWorld():SetComputerBarrier(12, 108, 66)
rttr:GetWorld():SetComputerBarrier(14, 61, 111)
rttr:GetWorld():SetComputerBarrier(13, 48, 41)
rttr:GetWorld():SetComputerBarrier(14, 40, 52)
rttr:GetWorld():SetComputerBarrier(14, 25, 45)

if isFirstStart then
-- type 8 == 7 in rttr
rttr:GetWorld():AddAnimal( 126, 48, SPEC_DUCK)
Expand Down Expand Up @@ -228,77 +240,6 @@ end
function addPlayerBld(p, onLoad)
-- set buildings for all players
rttr:GetPlayer(p):EnableAllBuildings()

if not (p == 0) then
rttr:GetPlayer(p):SetRestrictedArea(
nil, nil, -- enable the whole map
0, 0,
0, 127,
191, 127,
191, 0,
nil, nil, -- R=16, X=162, Y=69 (Choose R=10 -> Yellow can conquer mountain)
167, 59,
172, 69,
167, 79,
157, 79,
152, 69,
157, 59,
167, 59,
nil, nil, -- R=17, X=148, Y=107
157, 90,
165, 107,
157, 124,
140, 124,
131, 107,
140, 90,
157, 90,
nil, nil, -- R=15, X=131, Y=71 (Choose R=4 -> Yellow HQ!)
133, 67,
135, 71,
133, 75,
129, 75,
127, 71,
129, 67,
133, 67,
nil, nil, -- R=16, X=103, Y=40 V
87, 40, -- R=13, X=103, Y=49 V
95, 24, -- R=12, X=108, Y=66
111, 24,
119, 40,
116, 49,
120, 66,
114, 78,
102, 78,
96, 66,
90, 49,
87, 40,
nil, nil, -- R=13, X=124, Y=93
131, 80,
137, 93,
131, 106,
118, 106,
111, 93,
118, 80,
131, 80,
nil, nil, -- R=14, X=61, Y=111
68, 97,
75, 111,
68, 125,
54, 125,
47, 111,
54, 97,
68, 97,
nil, nil, -- R=13, X=48, Y=41
55, 28,
61, 41,
55, 54,
42, 54,
35, 41,
42, 28,
55, 28,
nil, nil -- ignore R=14, X=40, Y=52 and R=14, X=25, Y=45
)
end
end

-------------------------------- set resources --------------------------------
Expand Down Expand Up @@ -533,10 +474,6 @@ function onOccupied(p, x, y)
if( (x == 102) and (y == 50) ) then MissionEvent(3)
elseif( (x == 148) and (y == 50) ) then MissionEvent(99)
end

if(not rttr:GetPlayer(1):IsInRestrictedArea(x, y)) then
MissionEvent(98) -- for lifting restrictions
end
end

function onExplored(p, x, y, o)
Expand All @@ -551,14 +488,9 @@ function MissionEvent(e, onLoad)
if(eState[e] <= 0) then
return
end

if(e == 98) then
rttr:Log("liftRestrictions")
rttr:GetPlayer(1):SetRestrictedArea()
rttr:GetPlayer(2):SetRestrictedArea()

-- call side effects for active events, check "eState[e] == 1" for multiple call events!
elseif(e == 99) then
if(e == 99) then
-- TODO: EnableNextMissions()
-- Show opened arc
rttr:GetWorld():AddStaticObject(148, 50, 561, 0xFFFF, 2)
Expand Down
61 changes: 11 additions & 50 deletions data/RTTR/campaigns/roman/MISS206.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function checkVersion()
end
-------------------------------- mission events and texts --------------------
-- Message-Window (mission statement and hints): 52 chars wide
eIdx = {1, 2, 3, 98, 99}
eIdx = {1, 2, 3, 99}

rttr:RegisterTranslations(
{
Expand Down Expand Up @@ -155,6 +155,12 @@ function onStart(isFirstStart)
eHist = {["n"] = 0}
MissionEvent(1) -- initial event / start screen
end

rttr:GetWorld():SetComputerBarrier(10, 51, 22)
rttr:GetWorld():SetComputerBarrier(10, 36, 23)
rttr:GetWorld():SetComputerBarrier(8, 50, 60)
rttr:GetWorld():SetComputerBarrier(8, 49, 64)
rttr:GetWorld():SetComputerBarrier(8, 47, 68)
end

-- save callback
Expand Down Expand Up @@ -183,46 +189,9 @@ function addPlayerBld(p, onLoad)
rttr:GetPlayer(p):DisableBuilding(BLD_SHIPYARD, false)
rttr:GetPlayer(p):DisableBuilding(BLD_HARBORBUILDING, false)

--!GLOBAL_SET_COMPUTER_BARRIER 10 51 22
--!GLOBAL_SET_COMPUTER_BARRIER 10 36 23
--!GLOBAL_SET_COMPUTER_BARRIER 08 50 60
--!GLOBAL_SET_COMPUTER_BARRIER 08 49 64
--!GLOBAL_SET_COMPUTER_BARRIER 08 47 68

if not(p == 0) then
rttr:GetPlayer(p):SetRestrictedArea(
nil, nil, -- enable the whole map
0, 0,
0, 127,
143, 127,
143, 0,
nil, nil, -- R=10, X=51, Y=22 V
56, 13, -- R=10, X=36, Y=23
61, 23,
56, 33,
48, 32,
50, 26,
26, 23,
31, 13,
56, 13,
nil, nil, -- R=08, X=50, Y=60 V (-> R=6, X=52, Y=60)
46, 60, -- R=08, X=49, Y=64 V
49, 54, -- R=08, X=47, Y=68 (-> R=6, X=47, Y=68)
55, 54,
58, 60,
53, 68,
50, 74,
44, 74,
41, 68,
46, 60,
nil, nil
)

if(p == 2) then
if onLoad then return end

rttr:GetPlayer(p):AIConstructionOrder(43, 59, BLD_FORTRESS)
end
if(p == 2) then
if onLoad then return end
rttr:GetPlayer(p):AIConstructionOrder(43, 59, BLD_FORTRESS)
end
end

Expand Down Expand Up @@ -457,10 +426,6 @@ function onOccupied(p, x, y)

if( (x == 13) and (y == 66) ) then MissionEvent(99)
end

if(not rttr:GetPlayer(1):IsInRestrictedArea(x, y)) then
MissionEvent(98) -- for lifting restrictions
end
end

function onExplored(p, x, y, o)
Expand All @@ -484,12 +449,8 @@ function MissionEvent(e, onLoad)
return
end

if(e == 98) then
rttr:GetPlayer(1):SetRestrictedArea()
rttr:GetPlayer(2):SetRestrictedArea()

-- call side effects for active events, check "eState[e] == 1" for multiple call events!
elseif(e == 99) then
if(e == 99) then
-- TODO: EnableNextMissions()
-- Show opened arc
rttr:GetWorld():AddStaticObject(13, 66, 561, 0xFFFF, 2)
Expand Down
Loading

0 comments on commit 784a701

Please sign in to comment.