Skip to content

Commit

Permalink
Add Intercept Group squad
Browse files Browse the repository at this point in the history
  • Loading branch information
tos-x committed Nov 19, 2024
1 parent 935ca77 commit bd9e809
Show file tree
Hide file tree
Showing 51 changed files with 1,027 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions mods/squads/mods/Intercept Group/scripts/achievementTriggers.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

local path = mod_loader.mods[modApi.currentMod].scriptPath

local this = {}

function this:load()
modApi:addPreEnvironmentHook(function(mission)
local edgecount = 0

local edge = {0,0,0,0} --x0,x7,y0,y7
local mechs = extract_table(Board:GetPawns(TEAM_PLAYER))
for i,id in pairs(mechs) do
local p = Board:GetPawn(id):GetSpace()
if Board:IsValid(p) and p.x == 0 or p.x == 7 or p.y == 0 or p.y == 7 then
if (p.x == 0 or p.x == 7) and (p.y == 0 or p.y == 7) then --corner; skip
elseif p.x == 0 then
edge[1]=1
elseif p.x == 7 then
edge[2]=1
elseif p.y == 0 then
edge[3]=1
elseif p.y == 7 then
edge[4]=1
end
end
end

for i,v in pairs(edge) do
edgecount = edgecount + v
end

if edgecount >= 3 then
tosx_interceptsquad_Chievo("tosx_intercept_wide")
end
end)
end

return this
94 changes: 94 additions & 0 deletions mods/squads/mods/Intercept Group/scripts/achievements.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@

local this = {}

local path = mod_loader.mods[modApi.currentMod].resourcePath
local modid = "tosx_InterceptGroup" -- Also the squad id

function tosx_interceptsquad_Chievo(id)
-- exit if not our squad
if GAME.additionalSquadData.squad ~= modid then return end
if IsTestMechScenario() then return end
-- exit if current one is unlocked
if modApi.achievements:getProgress(modid,id) then return end
modApi.achievements:trigger(modid,id)
if id == "tosx_intercept_peak" then
modApi.achievements:trigger(modid,"tosx_intercept_secret", {aa = true})
elseif id == "tosx_intercept_throttle" then
modApi.achievements:trigger(modid,"tosx_intercept_secret", {bb = true})
elseif id == "tosx_intercept_wide" then
modApi.achievements:trigger(modid,"tosx_intercept_secret", {cc = true})
end
if modApi.achievements:isProgress(modid,"tosx_intercept_secret", {reward = true }) then return end
if modApi.achievements:isProgress(modid,"tosx_intercept_secret", {aa = true, bb = true, cc = true,}) then
-- Suppress the toast for the secret achievement
local oldtoastadd = modApi.toasts.add
modApi.toasts.add = function() end
modApi.achievements:trigger(modid,"tosx_intercept_secret", {reward = true })
modApi.toasts.add = oldtoastadd

modApi.toasts:add(tosx_interceptUnlock())
end
end

local imgs = {
"peak",
"throttle",
"wide",
"secret",
}

local achname = "tosx_intercept_"
for _, img in ipairs(imgs) do
modApi:appendAsset("img/achievements/".. achname..img ..".png", path .."img/achievements/".. img ..".png")
end

modApi.achievements:add{
id = "tosx_intercept_peak",
name = "Peak Efficiency",
tip = "Shoot the Focused Beam 4 times in a single battle at exactly range 3",
img = "img/achievements/tosx_intercept_peak.png",
squad = "tosx_InterceptGroup",
}

modApi.achievements:add{
id = "tosx_intercept_throttle",
name = "Full Throttle",
tip = "Kill 2 enemies with a single use of the Shockwave Engines after traveling 6 tiles",
img = "img/achievements/tosx_intercept_throttle.png",
squad = "tosx_InterceptGroup",
}

modApi.achievements:add{
id = "tosx_intercept_wide",
name = "Far and Wide",
tip = "End a turn with Mechs on 3 different edges of the map (excluding corners)",
img = "img/achievements/tosx_intercept_wide.png",
squad = "tosx_InterceptGroup",
}

modApi.achievements:add{
id = "tosx_intercept_secret",
name = "Intercept Group Secret Reward",
tip = "Complete all 3 Intercept Group achievements\n\nPeak Efficiency: $aa\nFull Throttle: $bb\nFar and Wide: $cc\n\nReward: $reward",
img = "img/achievements/tosx_intercept_secret.png",
squad = "tosx_InterceptGroup",
global = "Secret Rewards",
secret = true,
objective = {
aa = true,
bb = true,
cc = true,
reward = "?|Secret Structure"
}
}

function tosx_interceptUnlock()
return {
unlockTitle = 'Structure Unlocked!',
name = 'Garage',
tip = 'Garage. This structure can now appear in future missions on R.S.T.',
img = 'img/achievements/'..achname..'secret.png',
}
end

return this
29 changes: 29 additions & 0 deletions mods/squads/mods/Intercept Group/scripts/animations.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-- ANIMS.tosx_liquidmetal = Animation:new{
-- Image = "effects/tosx_liquidmetal.png",
-- NumFrames = 10,
-- Time = 0.05,
-- PosX = -33,
-- PosY = -14,
-- Loop = false,
-- }

ANIMS.tosx_firepush_0 = ANIMS.airpush_0:new{
Image = "effects/tosx_firepush_U.png",
}

ANIMS.tosx_firepush_1 = ANIMS.airpush_1:new{
Image = "effects/tosx_firepush_R.png",
}

ANIMS.tosx_firepush_2 = ANIMS.airpush_2:new{
Image = "effects/tosx_firepush_D.png",
}

ANIMS.tosx_firepush_3 = ANIMS.airpush_3:new{
Image = "effects/tosx_firepush_L.png",
}


ANIMS.tosx_ExploRepulse3 = ANIMS.ExploRepulse3:new{
Frames = {7,6,5,4,3,2,1,0},
}
108 changes: 108 additions & 0 deletions mods/squads/mods/Intercept Group/scripts/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
local descriptiontext = "These industrial Mechs use targeted shockwaves to disrupt Vek formations."

local mod = {
id = "tosx_InterceptGroup",
name = "Intercept Group",
version = "0.01",
modApiVersion = "2.8.2",
icon = "img/icons/mod_icon.png",
description = descriptiontext,
}

-- Helper function to load mod scripts
function mod:loadScript(path)
return require(self.scriptPath..path)
end

function mod:init()
local sprites = self:loadScript("libs/sprites")
sprites.addMechs(
{
Name = "tosx_mech_burn1",
Default = { PosX = -23, PosY = 0 },
Animated = { PosX = -23, PosY = 0, NumFrames = 4},--[ -37, -18 ]
Broken = { PosX = -24, PosY = -2 },
Submerged = { PosX = -18, PosY = 12 },
SubmergedBroken = { PosX = -18, PosY = 11 },
Icon = {},
},
{
Name = "tosx_mech_burn2",
Default = { PosX = -19, PosY = 7 },
Animated = { PosX = -19, PosY = 7, NumFrames = 4},
Broken = { PosX = -16, PosY = 11 },
Submerged = { PosX = -13, PosY = 16 },
SubmergedBroken = { PosX = -16, PosY = 16 },
Icon = {},
},
{
Name = "tosx_mech_burn3",
Default = { PosX = -24, PosY = -4 },
Animated = { PosX = -24, PosY = -4, NumFrames = 4},
Broken = { PosX = -21, PosY = 1 },
Submerged = { PosX = -19, PosY = 7 },
SubmergedBroken = { PosX = -20, PosY = 10 },
Icon = {},
}
)

local palette = {
id = self.id,
name = "Intercept Red",
image = "img/units/player/tosx_mech_burn1.png",
colorMap = {

lights = { 250, 192, 17 },
main_highlight = { 211, 77, 70 },
main_light = { 111, 29, 32 },
main_mid = { 55, 20, 26 },
main_dark = { 26, 12, 14 },
metal_light = { 110, 101, 118 },
metal_mid = { 54, 46, 61 },
metal_dark = { 32, 25, 38 },
},
}
modApi:addPalette(palette)

modApi:appendAsset("img/weapons/tosx_weapon_focusbeam.png",self.resourcePath.."img/weapons/tosx_weapon_focusbeam.png")
modApi:appendAsset("img/weapons/tosx_weapon_concussion.png",self.resourcePath.."img/weapons/tosx_weapon_concussion.png")
modApi:appendAsset("img/weapons/tosx_weapon_shockwave.png",self.resourcePath.."img/weapons/tosx_weapon_shockwave.png")

modApi:appendAsset("img/effects/tosx_shotup_seeker.png",self.resourcePath.."img/effects/tosx_shotup_seeker.png")

modApi:appendAsset("img/effects/tosx_heatlaser_start.png",self.resourcePath.."img/effects/tosx_heatlaser_start.png")
modApi:appendAsset("img/effects/tosx_heatlaser_U.png",self.resourcePath.."img/effects/tosx_heatlaser_U.png")
modApi:appendAsset("img/effects/tosx_heatlaser_U1.png",self.resourcePath.."img/effects/tosx_heatlaser_U1.png")
modApi:appendAsset("img/effects/tosx_heatlaser_U2.png",self.resourcePath.."img/effects/tosx_heatlaser_U2.png")
modApi:appendAsset("img/effects/tosx_heatlaser_R.png",self.resourcePath.."img/effects/tosx_heatlaser_R.png")
modApi:appendAsset("img/effects/tosx_heatlaser_R1.png",self.resourcePath.."img/effects/tosx_heatlaser_R1.png")
modApi:appendAsset("img/effects/tosx_heatlaser_R2.png",self.resourcePath.."img/effects/tosx_heatlaser_R2.png")
modApi:appendAsset("img/effects/tosx_heatlaser_hit.png",self.resourcePath.."img/effects/tosx_heatlaser_hit.png")
local laser_loc = Point(-12,3)
Location["effects/tosx_heatlaser_start.png"] = laser_loc
Location["effects/tosx_heatlaser_U.png"] = laser_loc
Location["effects/tosx_heatlaser_U1.png"] = laser_loc
Location["effects/tosx_heatlaser_U2.png"] = laser_loc
Location["effects/tosx_heatlaser_R.png"] = laser_loc
Location["effects/tosx_heatlaser_R1.png"] = laser_loc
Location["effects/tosx_heatlaser_R2.png"] = laser_loc
Location["effects/tosx_heatlaser_hit.png"] = laser_loc

require(self.scriptPath.."pawns")
require(self.scriptPath.."weapons")
require(self.scriptPath.."animations")

require(self.scriptPath .."achievements")
if modApi.achievements:getProgress(self.id,"tosx_intercept_secret") and --without this check, will error if no profile
modApi.achievements:getProgress(self.id,"tosx_intercept_secret").reward then
require(self.scriptPath .."side_objectives")
end
end

function mod:load(options, version)
modApi:addSquad({"Intercept Group","tosx_Burn1Mech", "tosx_Burn2Mech", "tosx_Burn3Mech", id = "tosx_InterceptGroup",}, "Intercept Group", descriptiontext, self.resourcePath .. "img/icons/squad_icon.png")

require(self.scriptPath .."achievementTriggers"):load()
end

return mod
Loading

0 comments on commit bd9e809

Please sign in to comment.