Skip to content

Commit

Permalink
Add Masking for 6x3 to 3x3 for Maps Menu
Browse files Browse the repository at this point in the history
  • Loading branch information
dicewrench committed Nov 28, 2023
1 parent f475b6b commit fb6a661
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 9 deletions.
85 changes: 83 additions & 2 deletions mod/src/StarWarsLegion/GAME_CONTROLLER.623b03.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require('!/Analytics')
require('!/Deck')

existingMasks = {}

function onload(save_state)
_G.Deck = Deck:create()

Expand Down Expand Up @@ -68,7 +70,7 @@ end

function homeScreen()
screen.createButton({click_function = "dud", function_owner = self, label = "", position = {0.9, 0.25, 0}, rotation = {0, -90, 90}, scale = {0.5, 0.5, 0.5}, width = 0, height = 0, font_size = 100, font_color = {0.8867, 0.7804, 0, 1}, alignment = 1})
printToScreen("STAR WARS LEGION TTS MOD\n by Tieren\n\nSelect an option below to start", 80, 3)
printToScreen("STAR WARS LEGION TTS MOD\n by SWL Dev Foundation\n\nThe home of BLITZ!\nSelect an option below to start", 80, 3)
end


Expand All @@ -77,7 +79,7 @@ end
function mainMenu()
timerScreen = false

printToScreen("STAR WARS LEGION TTS MOD\n by SWL Dev Foundation\n\nSelect an option below to start", 80, 3)
printToScreen("STAR WARS LEGION TTS MOD\n by SWL Dev Foundation\n\nThe home of BLITZ!\nSelect an option below to start", 80, 3)

clearAllButtons()
local menuEntries = {}
Expand Down Expand Up @@ -264,6 +266,9 @@ function mapMenu()
menuEntries[5] = {functionName = "customMapMenu", label = "Custom Maps", tooltip = "Create a Custom Map", buttonTint = {0,0.913,1}}
menuEntries[6] = {functionName = "clearZones", label = "Clear Map", tooltip = "Clears everything from current Battlefield area", buttonTint = {0,0.913,1}}
menuEntries[7] = {functionName = "saveConditions", label = "Save Battlefield Tokens", tooltip = "Saves Objects from the Objective/Deployment/Conditions", buttonTint = {0,0.913,1}}
menuEntries[8] = {functionName = "toggleMaskMid", label = "Toggle Masks : Mid", tooltip = "Toggles Masking Objects for the middle of the Battlefield", buttonTint = {0,0.913,1}}
menuEntries[9] = {functionName = "toggleMaskLeft", label = "Toggle Masks : Left", tooltip = "Toggles Masking Objects for the left of the Battlefield", buttonTint = {0,0.913,1}}
menuEntries[10] = {functionName = "toggleMaskRight", label = "Toggle Masks : Right", tooltip = "Toggles Masking Objects for the right of the Battlefield", buttonTint = {0,0.913,1}}
createMenu(menuEntries, 1)
end

Expand Down Expand Up @@ -1009,3 +1014,79 @@ function enableExperimentalFeatures()
ga_event("Global", "enableExperimentalFeatures")
Global.UI.show("legionDisplay")
end

function getExistingMaskLength()
local length = 0
if existingMasks != nil then
for i, obj in pairs(existingMasks) do
length = length + 1
end
end
return length
end

function toggleMaskMid()
local length = getExistingMaskLength()
if length > 0 then
clearMasks()
else
placeMask(35,9)
placeMask(-19,9)
placeMask(35,-9)
placeMask(-19,-9)
end
end

function toggleMaskRight()
local length = getExistingMaskLength()
if length > 0 then
clearMasks()
else
placeMask(35,9)
placeMask(17,9)
placeMask(35,-9)
placeMask(17,-9)
end
end

function toggleMaskLeft()
local length = getExistingMaskLength()
if length > 0 then
clearMasks()
else
placeMask(-1,9)
placeMask(-19,9)
placeMask(-1,-9)
placeMask(-19,-9)
end
end

function clearMasks()
if existingMasks != nil then
for i, obj in pairs(existingMasks) do
if obj != nil then
destroyObject(obj)
end
end
existingMasks = {}
end
end

function placeMask(x, z)
local projector = spawnObject({
type = "Custom_AssetBundle",
position = {
x,
75,
z,
},
scale = {0, 0, 0},
})
local asset = "http://cloud-3.steamusercontent.com/ugc/2264809616949875099/DB2BBB502F11E04185A603B8A4FD0F2391B905C6/"
projector.setName("Masking Boundary")
projector.setLock(true)
projector.setCustomObject({
assetbundle = asset,
})
table.insert(existingMasks, projector)
end
2 changes: 1 addition & 1 deletion mod/src/StarWarsLegion/TABLE.3a3ed9.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"HideWhenFaceDown": false,
"Hands": false,
"CustomAssetbundle": {
"AssetbundleURL": "http://cloud-3.steamusercontent.com/ugc/1744555589998518180/70BD19FBE4D4D8B319F6A4A2ACCE401C25D94656/",
"AssetbundleURL": "http://cloud-3.steamusercontent.com/ugc/2259180117394918498/97BE48DA78615BE3ED08933C1E08328D6E5BBE7C/",
"AssetbundleSecondaryURL": "",
"MaterialIndex": 0,
"TypeIndex": 0,
Expand Down
12 changes: 6 additions & 6 deletions mod/src/includes/ui/Welcome.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@
<VerticalScrollView id="welcomeTab1" active="true" color="40404080">
<VerticalLayout padding="5">
<Text alignment="UpperLeft" color="#ffffff" fontSize="12">
<!--Welcome to Star Wars: Legion for TTS, <b>v7.4.1</b>.-->
Welcome to Star Wars: Legion for TTS, <b>v7.7.3-beta</b>.
Welcome to Star Wars: Legion for TTS, <b>v7.8.0</b>.
<!--Welcome to Star Wars: Legion for TTS, <b>v7.8.0-beta</b>.
This is a <b>beta release</b>, and is <textcolor color="#f03333"><b>not suitable for tournament play</b></textcolor>.
To access the stable version of the mod visit <i>https://go.swlegion.dev/mod</i>.
To access the stable version of the mod visit <i>https://go.swlegion.dev/mod</i>.-->

<b>CHANGELOG</b>
(Since last <i>Beta</i>)
<!--(Since last <i>Stable</i>)-->
- Fix: Some More Asset rehost
<!--(Since last <i>Beta</i>)-->
(Since last <i>Stable</i>)
- Add: Masking for 6x3 Maps to make 3x3 Maps
</Text>
</VerticalLayout>
</VerticalScrollView>
Expand Down

0 comments on commit fb6a661

Please sign in to comment.