mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added advanced effects
This commit is contained in:
parent
5273291e9a
commit
1e461250d5
@ -1076,7 +1076,9 @@
|
||||
"aimTime": 5,
|
||||
"shotsToFire": 100,
|
||||
"cost": 15000000,
|
||||
"canAAA": true
|
||||
"canAAA": true,
|
||||
"targetingRange": 500,
|
||||
"aimMethodRange": 9000
|
||||
},
|
||||
"Grad-URAL": {
|
||||
"name": "Grad-URAL",
|
||||
|
||||
@ -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) => {
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -44,9 +44,12 @@
|
||||
<button class="smoke-button" title="" data-smoke-color="orange" data-on-click="contextMenuDeploySmoke" data-on-click-params='{ "color": "orange" }'>Orange smoke</button>
|
||||
</div>
|
||||
<div id="explosion-menu" class="ol-panel ol-contexmenu-panel hide">
|
||||
<button class="explosion-button" title="" data-on-click="contextMenuExplosion" data-on-click-params='{ "strength": 1 }'>Small explosion</button>
|
||||
<button class="explosion-button" title="" data-on-click="contextMenuExplosion" data-on-click-params='{ "strength": 2 }'>Medium explosion</button>
|
||||
<button class="explosion-button" title="" data-on-click="contextMenuExplosion" data-on-click-params='{ "strength": 3 }'>Big explosion</button>
|
||||
<button class="explosion-button" title="" data-on-click="contextMenuExplosion" data-on-click-params='{ "strength": 4 }'>Huge explosion</button>
|
||||
<button class="explosion-button" title="" data-on-click="contextMenuExplosion" data-on-click-params='{ "explosionType": "normal", "strength": 1 }'>Small explosion</button>
|
||||
<button class="explosion-button" title="" data-on-click="contextMenuExplosion" data-on-click-params='{ "explosionType": "normal", "strength": 10 }'>Big explosion</button>
|
||||
<button class="explosion-button" title="" data-on-click="contextMenuExplosion" data-on-click-params='{ "explosionType": "phosphorous"}'>White phosphorous</button>
|
||||
<button class="explosion-button" title="" data-on-click="contextMenuExplosion" data-on-click-params='{ "explosionType": "napalm"}'>Napalm</button>
|
||||
<button class="explosion-button" title="" data-on-click="contextMenuExplosion" data-on-click-params='{ "explosionType": "secondary"}'>Explosion with secondaries</button>
|
||||
<button class="explosion-button" title="" data-on-click="contextMenuExplosion" data-on-click-params='{ "explosionType": "fire"}'>Static fire</button>
|
||||
<button class="explosion-button" title="" data-on-click="contextMenuExplosion" data-on-click-params='{ "explosionType": "depthCharge"}'>Depth charge</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -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
|
||||
|
||||
@ -410,10 +410,11 @@ private:
|
||||
class Explosion : public Command
|
||||
{
|
||||
public:
|
||||
Explosion(unsigned int intensity, Coords location, function<void(void)> callback = [](){}) :
|
||||
Explosion(unsigned int intensity, string explosionType, Coords location, function<void(void)> callback = [](){}) :
|
||||
Command(callback),
|
||||
location(location),
|
||||
intensity(intensity)
|
||||
intensity(intensity),
|
||||
explosionType(explosionType)
|
||||
{
|
||||
priority = CommandPriority::MEDIUM;
|
||||
};
|
||||
@ -423,4 +424,5 @@ public:
|
||||
private:
|
||||
const Coords location;
|
||||
const unsigned int intensity;
|
||||
const string explosionType;
|
||||
};
|
||||
|
||||
@ -244,6 +244,7 @@ string Explosion::getString()
|
||||
commandSS.precision(10);
|
||||
commandSS << "Olympus.explosion, "
|
||||
<< intensity << ", "
|
||||
<< "\"" << explosionType << "\"" << ", "
|
||||
<< location.lat << ", "
|
||||
<< location.lng;
|
||||
return commandSS.str();
|
||||
|
||||
@ -498,11 +498,12 @@ void Scheduler::handleRequest(string key, json::value value, string username, js
|
||||
else if (key.compare("explosion") == 0)
|
||||
{
|
||||
unsigned int intensity = value[L"intensity"].as_integer();
|
||||
string explosionType = to_string(value[L"explosionType"]);
|
||||
double lat = value[L"location"][L"lat"].as_double();
|
||||
double lng = value[L"location"][L"lng"].as_double();
|
||||
log("Adding " + to_string(intensity) + " explosion at (" + to_string(lat) + ", " + to_string(lng) + ")");
|
||||
log("Adding explosion of type " + explosionType + " at (" + to_string(lat) + ", " + to_string(lng) + ")");
|
||||
Coords loc; loc.lat = lat; loc.lng = lng;
|
||||
command = dynamic_cast<Command*>(new Explosion(intensity, loc));
|
||||
command = dynamic_cast<Command*>(new Explosion(intensity, explosionType, loc));
|
||||
}
|
||||
/************************/
|
||||
else if (key.compare("bombPoint") == 0)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user