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

Smoke fx #1

Merged
merged 5 commits into from
Mar 27, 2019
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
1 change: 1 addition & 0 deletions Desert F14 89/DEBUG_FirstMission.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
start "Generate First Mission" cmd /k "..\..\..\..\..\..\bin\luae.exe Scripts/BAT_FirstMission.lua & exit"
1 change: 1 addition & 0 deletions Desert F14 89/DEBUG_SkipMission.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
start "Skip Mission" cmd /k "..\..\..\..\..\..\bin\luae.exe Scripts/BAT_SkipMission.lua"
42 changes: 42 additions & 0 deletions Desert F14 89/Init/targetlist_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -395,41 +395,57 @@ targetlist = {
name = "Fuel Tank",
x = -360824.28125,
y = -75955.8125,
burnTime = 24*60*60,
burnEffectPreset = 3,
},
[2] = {
name = "Fuel Tank",
x = -360822.90625,
y = -75977.703125,
burnTime = 24*60*60,
burnEffectPreset = 3,
},
[3] = {
name = "Fuel Tank",
x = -360843.78125,
y = -75974.5,
burnTime = 24*60*60,
burnEffectPreset = 3,
},
[4] = {
name = "Fuel Tank",
x = -360956.40625,
y = -75968.0078125,
burnTime = 24*60*60,
burnEffectPreset = 3,
},
[5] = {
name = "Ammo Warehouse",
x = -359458.25,
y = -77084.1796875,
burnTime = 8*60*60,
burnEffectPreset = 2,
},
[6] = {
name = "Ammo Warehouse",
x = -359233.25,
y = -77084.1328125,
burnTime = 8*60*60,
burnEffectPreset = 2,
},
[7] = {
name = "Ammo Warehouse",
x = -358989.8125,
y = -77049.125,
burnTime = 8*60*60,
burnEffectPreset = 2,
},
[8] = {
name = "Ammo Warehouse",
x = -359348.78125,
y = -76447.7578125,
burnTime = 8*60*60,
burnEffectPreset = 2,
},
},
},
Expand Down Expand Up @@ -527,11 +543,15 @@ targetlist = {
name = "Hangar Large (Maintenance)",
x = -329691.69873047,
y = -174777.93652344,
burnTime = 5*60*60,
burnEffectPreset = 2,
},
[2] = {
name = "Hangar Small (Fuel, Ammo & Supplies)",
x = -329742.92407227,
y = -174834.015625,
burnTime = 5*60*60,
burnEffectPreset = 2,
},
[3] = {
name = "House (C2 & Ready Room)",
Expand All @@ -553,11 +573,15 @@ targetlist = {
name = "Hangar Large (Maintenance)",
x = -224070.79272461,
y = 33343.052246094,
burnTime = 5*60*60,
burnEffectPreset = 2,
},
[2] = {
name = "Warehouse Small (Fuel, Ammo & Supplies)",
x = -224092.34985352,
y = 33364.486877441,
burnTime = 5*60*60,
burnEffectPreset = 2,
},
[3] = {
name = "Warehouse Small (Crew Quarters)",
Expand Down Expand Up @@ -1251,11 +1275,15 @@ targetlist = {
name = "North Complex - Warehouse",
x = -280479.64074707,
y = -174614.47558594,
burnTime = 5*60*60,
burnEffectPreset = 2,
},
[4] = {
name = "North Complex - Warehouse",
x = -280458.3157959,
y = -174649.67675781,
burnTime = 5*60*60,
burnEffectPreset = 2,
},
[5] = {
name = "East Complex - Generator Building",
Expand All @@ -1271,6 +1299,8 @@ targetlist = {
name = "South Complex - Warehouse",
x = -281019.87670898,
y = -174737.45703125,
burnTime = 5*60*60,
burnEffectPreset = 2,
},
[8] = {
name = "South Complex - Truck Terminal",
Expand Down Expand Up @@ -1322,16 +1352,22 @@ targetlist = {
name = "Storage Warehouse 1",
x = -235913.40625,
y = -145391.18261719,
burnTime = 5*60*60,
burnEffectPreset = 2,
},
[6] = {
name = "Storage Warehouse 2",
x = -235920.84179688,
y = -145242.81054688,
burnTime = 5*60*60,
burnEffectPreset = 2,
},
[7] = {
name = "Storage Warehouse 3",
x = -236236.91992188,
y = -145378.79296875,
burnTime = 5*60*60,
burnEffectPreset = 2,
},
},
},
Expand Down Expand Up @@ -1528,16 +1564,22 @@ targetlist = {
name = "West Plant",
x = -226238.01367188,
y = 33164.70791626,
burnTime = 8*60*60,
burnEffectPreset = 3,
},
[2] = {
name = "East Plant",
x = -225821.24609375,
y = 33621.758361816,
burnTime = 8*60*60,
burnEffectPreset = 3,
},
[3] = {
name = "Warehouse",
x = -226305.03125,
y = 33160.510345459,
burnTime = 5*60*60,
burnEffectPreset = 2,
},
},
},
Expand Down
9 changes: 8 additions & 1 deletion Desert F14 89/Scripts/ATO_Parking.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ function getParkingId(base)
if db_airbases[base].parkingIds.parkingN == nil then
db_airbases[base].parkingIds.parkingN = db_airbases[base].parkingIds[db_airbases[base].parkingIds.iPrefix].lower
end

if db_airbases[base].parkingIds[db_airbases[base].parkingIds.iPrefix] == nil then
return nil
end

-- generate the id
fullId = db_airbases[base].parkingIds[db_airbases[base].parkingIds.iPrefix].prefix .. db_airbases[base].parkingIds.parkingN
Expand All @@ -27,7 +31,10 @@ function getParkingId(base)
-- roll over to the next parking prefix if needed
if db_airbases[base].parkingIds.parkingN > db_airbases[base].parkingIds[db_airbases[base].parkingIds.iPrefix].upper then
db_airbases[base].parkingIds.iPrefix = db_airbases[base].parkingIds.iPrefix + 1
db_airbases[base].parkingIds.parkingN = db_airbases[base].parkingIds[db_airbases[base].parkingIds.iPrefix].lower

if db_airbases[base].parkingIds[db_airbases[base].parkingIds.iPrefix] ~= nil then
db_airbases[base].parkingIds.parkingN = db_airbases[base].parkingIds[db_airbases[base].parkingIds.iPrefix].lower
end
end

return fullId
Expand Down
77 changes: 77 additions & 0 deletions Desert F14 89/Scripts/DC_SmokeFx.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
--
-- This script attempts to create smoke effects for target elements with burn flags
--

for side_name, side in pairs(targetlist) do --Iterate through all sides
for target_name, target in pairs(side) do --Iterate through all targets
if target.elements ~= nil then
for i, element in pairs(target.elements) do
--Check if the target is dead and has a burnTime
if element.dead == true and element.burnTime ~= nil and element.burnTime > 0 then

-- Decrement the target's burntime
element.burnTime = element.burnTime - camp.time_since_last_mission

--Only create smoke for targets with coordinates and a remaining burn time
if element.x ~= nil and element.burnTime > 0 then
-- initalize static group for side if needed
if mission.coalition[side_name].country[1].static == nil then
mission.coalition[side_name].country[1].static = {
}
end

if mission.coalition[side_name].country[1].static.group == nil then
mission.coalition[side_name].country[1].static.group = {
}
end


-- create static smoke effects in mission
table.insert(mission.coalition[side_name].country[1].static.group, {
["heading"] = 0,
["route"] =
{
["points"] =
{
[1] =
{
["alt"] = 0,
["type"] = "",
["name"] = "",
["speed"] = 0,
["y"] = element.y,
["x"] = element.x,
["formation_template"] = "",
["action"] = "",
},
},
},
["groupId"] = GenerateID(),
["units"] =
{
[1] =
{
["effectPreset"] = element.burnEffectPreset or 1,
["category"] = "Effects",
["type"] = "big_smoke",
["y"] = element.y,
["x"] = element.x,
["unitId"] = GenerateID(),
["name"] = "Smoke_" .. element.name:gsub("%s+", "_"),
["effectTransparency"] = 1,
["heading"] = 0,
}
},
["y"] = element.y,
["x"] = element.x,
["name"] = "Smoke_" .. element.name:gsub("%s+", "_"),
["linkOffset"] = false,
["dead"] = false,
["hidden"] = true,
})
end
end
end
end
end
end
1 change: 1 addition & 0 deletions Desert F14 89/Scripts/DC_Time.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ end
--advance campaign time
local idle_time = math.random(camp.idle_time_min, camp.idle_time_max) --random idle time to next mission in seconds, depending on min-max defined for campaign
camp.time = camp.time + idle_time --add idle time to campaign time
camp.time_since_last_mission = idle_time --store idle time

while camp.time >= 86400 do --repeat as long as time 24 hours or more
camp.time = camp.time - 86400 --remove 24 hours from time
Expand Down
1 change: 1 addition & 0 deletions Desert F14 89/Scripts/MAIN_NextMission.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ dofile("Scripts/ATO_FlightPlan.lua")
dofile("Scripts/DC_StaticAircraft.lua")
dofile("Scripts/DC_Briefing.lua")
dofile("Scripts/DC_Prune.lua")
dofile("Scripts/DC_SmokeFx.lua")

dofile("Scripts/DC_EndCampaign.lua")

Expand Down