diff --git a/client/public/databases/units/groundunitdatabase.json b/client/public/databases/units/groundunitdatabase.json index 04fe6d6b..34936b80 100644 --- a/client/public/databases/units/groundunitdatabase.json +++ b/client/public/databases/units/groundunitdatabase.json @@ -1076,7 +1076,9 @@ "aimTime": 5, "shotsToFire": 100, "cost": 15000000, - "canAAA": true + "canAAA": true, + "targetingRange": 500, + "aimMethodRange": 9000 }, "Grad-URAL": { "name": "Grad-URAL", diff --git a/client/src/contextmenus/mapcontextmenu.ts b/client/src/contextmenus/mapcontextmenu.ts index 0f75a596..89de4c8b 100644 --- a/client/src/contextmenus/mapcontextmenu.ts +++ b/client/src/contextmenus/mapcontextmenu.ts @@ -56,7 +56,7 @@ export class MapContextMenu extends ContextMenu { document.addEventListener("contextMenuExplosion", (e: any) => { this.hide(); - getApp().getServerManager().spawnExplosion(e.detail.strength, this.getLatLng()); + getApp().getServerManager().spawnExplosion(e.detail.strength ?? 0, e.detail.explosionType, this.getLatLng()); }); document.addEventListener("editCoalitionArea", (e: any) => { diff --git a/client/src/server/servermanager.ts b/client/src/server/servermanager.ts index 87a72599..528a539e 100644 --- a/client/src/server/servermanager.ts +++ b/client/src/server/servermanager.ts @@ -160,8 +160,8 @@ export class ServerManager { this.PUT(data, callback); } - spawnExplosion(intensity: number, latlng: LatLng, callback: CallableFunction = () => {}) { - var command = { "intensity": intensity, "location": latlng }; + spawnExplosion(intensity: number, explosionType: string, latlng: LatLng, callback: CallableFunction = () => {}) { + var command = { "explosionType": explosionType, "intensity": intensity, "location": latlng }; var data = { "explosion": command } this.PUT(data, callback); } diff --git a/client/views/contextmenus/map.ejs b/client/views/contextmenus/map.ejs index 75533346..983a5c31 100644 --- a/client/views/contextmenus/map.ejs +++ b/client/views/contextmenus/map.ejs @@ -44,9 +44,12 @@
\ No newline at end of file diff --git a/scripts/OlympusCommand.lua b/scripts/OlympusCommand.lua index 7be6dc31..90b3cba4 100644 --- a/scripts/OlympusCommand.lua +++ b/scripts/OlympusCommand.lua @@ -28,7 +28,8 @@ Olympus.weapons = {} -- Table holding references to all the currently existing -- Miscellaneous initializations Olympus.missionStartTime = DCS.getRealTime() - +Olympus.napalmCounter = 1 +Olympus.fireCounter = 1 ------------------------------------------------------------------------------------------------------ -- Olympus functions ------------------------------------------------------------------------------------------------------ @@ -434,11 +435,90 @@ function Olympus.smoke(color, lat, lng) end -- Creates an explosion on the ground -function Olympus.explosion(intensity, lat, lng) - Olympus.debug("Olympus.explosion " .. intensity .. " (" .. lat .. ", " .. lng ..")", 2) - trigger.action.explosion(mist.utils.makeVec3GL(coord.LLtoLO(lat, lng, 0)), intensity) +function Olympus.explosion(intensity, explosionType, lat, lng) + Olympus.debug("Olympus.explosion " .. explosionType .. " " .. intensity .. " (" .. lat .. ", " .. lng ..")", 2) + local pos = coord.LLtoLO(lat, lng, 0) + local vec3 = mist.utils.makeVec3GL(pos) + + if explosionType == "normal" then + trigger.action.explosion(vec3, intensity) + elseif explosionType == "phosphorous" then + Olympus.phosphorous(vec3) + elseif explosionType == "napalm" then + Olympus.napalm(vec3) + elseif explosionType == "secondary" then + Olympus.secondaries(vec3) + elseif explosionType == "fire" then + Olympus.createFire(vec3) + elseif explosionType == "depthCharge" then + + end end +function Olympus.phosphorous(vec3) + trigger.action.explosion(vec3, 1) + for i = 1,math.random(3, 10) do + angle = mist.utils.toRadian((math.random(1, 360))) + local randVec = mist.utils.makeVec3GL((mist.getRandPointInCircle(vec3, 5, 1, 0, 360))) + trigger.action.signalFlare(randVec, 2, angle) + end +end + +function Olympus.napalm(vec3) + local napeName = "napalmStrike" .. Olympus.napalmCounter + Olympus.napalmCounter = Olympus.napalmCounter + 1 + mist.dynAddStatic( + { + country = 20, + category = 'Fortifications', + hidden = true, + name = napeName, + type ="Fuel tank", + x = vec3.x, + y = vec3.z, + heading = 0, + } -- end of function + ) + timer.scheduleFunction(Olympus.explodeNapalm, vec3, timer.getTime() + 0.1) + timer.scheduleFunction(Olympus.removeNapalm, napeName, timer.getTime() + 0.12) +end + +function Olympus.explodeNapalm(vec3) + trigger.action.explosion(vec3, 10) +end + +function Olympus.removeNapalm(staticName) + StaticObject.getByName(staticName):destroy() +end + +function Olympus.createFire(vec3) + local smokeName = "smokeName" .. Olympus.fireCounter + Olympus.fireCounter = Olympus.fireCounter + 1 + trigger.action.effectSmokeBig(vec3, 2 , 1, smokeName) + trigger.action.explosion(vec3, 1) -- looks wierd to spawn in on flat land without this + timer.scheduleFunction(Olympus.removeFire, smokeName, timer.getTime() + 20) +end + +function Olympus.removeFire (smokeName) + trigger.action.effectSmokeStop(smokeName) +end + +function Olympus.secondaries(vec3) + trigger.action.explosion(vec3, 1) + for i = 1, 10 do + timer.scheduleFunction(Olympus.randomDebries, vec3, timer.getTime() + math.random(0, 180)) + end +end + +function Olympus.randomDebries(vec3) + trigger.action.explosion(vec3, 1) + for i = 1,math.random(3, 10) do + angle = mist.utils.toRadian((math.random(1, 360))) + local randVec = mist.utils.makeVec3GL((mist.getRandPointInCircle(vec3, 5, 1, 0, 360))) + trigger.action.signalFlare(randVec, 3, angle) + end +end + -- Spawns a new unit or group -- Spawn table contains the following parameters -- category: (string), either Aircraft, Helicopter, GroundUnit or NavyUnit diff --git a/src/core/include/commands.h b/src/core/include/commands.h index 6bf3da9d..c12af0ef 100644 --- a/src/core/include/commands.h +++ b/src/core/include/commands.h @@ -410,10 +410,11 @@ private: class Explosion : public Command { public: - Explosion(unsigned int intensity, Coords location, function