Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SetComputerBarrier #1684

Merged
merged 4 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 5 additions & 30 deletions data/RTTR/campaigns/roman/MISS202.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function isMapPreviewEnabled()
return false
end

local requiredFeature = 4
local requiredFeature = 5
function checkVersion()
local featureLevel = rttr:GetFeatureLevel()
if(featureLevel < requiredFeature) then
Expand All @@ -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
52 changes: 8 additions & 44 deletions data/RTTR/campaigns/roman/MISS203.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function isMapPreviewEnabled()
return false
end

local requiredFeature = 4
local requiredFeature = 5
function checkVersion()
local featureLevel = rttr:GetFeatureLevel()
if(featureLevel < requiredFeature) then
Expand All @@ -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
98 changes: 15 additions & 83 deletions data/RTTR/campaigns/roman/MISS205.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function isMapPreviewEnabled()
return false
end

local requiredFeature = 4
local requiredFeature = 5
function checkVersion()
local featureLevel = rttr:GetFeatureLevel()
if(featureLevel < requiredFeature) then
Expand All @@ -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
Loading
Loading