mirror of
https://github.com/weyne85/DML.git
synced 2025-10-29 16:57:49 +00:00
Initial commit
This commit is contained in:
BIN
tutorial & demo missions/demo - 000 smoke em! DML intro.miz
Normal file
BIN
tutorial & demo missions/demo - 000 smoke em! DML intro.miz
Normal file
Binary file not shown.
BIN
tutorial & demo missions/demo - ADF and NDB fun.miz
Normal file
BIN
tutorial & demo missions/demo - ADF and NDB fun.miz
Normal file
Binary file not shown.
BIN
tutorial & demo missions/demo - DML mission template.miz
Normal file
BIN
tutorial & demo missions/demo - DML mission template.miz
Normal file
Binary file not shown.
BIN
tutorial & demo missions/demo - Event Monitor.miz
Normal file
BIN
tutorial & demo missions/demo - Event Monitor.miz
Normal file
Binary file not shown.
BIN
tutorial & demo missions/demo - Landing Counter.miz
Normal file
BIN
tutorial & demo missions/demo - Landing Counter.miz
Normal file
Binary file not shown.
BIN
tutorial & demo missions/demo - ME triggered spawn.miz
Normal file
BIN
tutorial & demo missions/demo - ME triggered spawn.miz
Normal file
Binary file not shown.
BIN
tutorial & demo missions/demo - Owned Zones ME integration.miz
Normal file
BIN
tutorial & demo missions/demo - Owned Zones ME integration.miz
Normal file
Binary file not shown.
BIN
tutorial & demo missions/demo - artillery with UI.miz
Normal file
BIN
tutorial & demo missions/demo - artillery with UI.miz
Normal file
Binary file not shown.
BIN
tutorial & demo missions/demo - artillery zones triggered.miz
Normal file
BIN
tutorial & demo missions/demo - artillery zones triggered.miz
Normal file
Binary file not shown.
BIN
tutorial & demo missions/demo - helo cargo.miz
Normal file
BIN
tutorial & demo missions/demo - helo cargo.miz
Normal file
Binary file not shown.
BIN
tutorial & demo missions/demo - helo trooper.miz
Normal file
BIN
tutorial & demo missions/demo - helo trooper.miz
Normal file
Binary file not shown.
Binary file not shown.
BIN
tutorial & demo missions/demo - moving spawners.miz
Normal file
BIN
tutorial & demo missions/demo - moving spawners.miz
Normal file
Binary file not shown.
BIN
tutorial & demo missions/demo - object destruct detection.miz
Normal file
BIN
tutorial & demo missions/demo - object destruct detection.miz
Normal file
Binary file not shown.
BIN
tutorial & demo missions/demo - player score.miz
Normal file
BIN
tutorial & demo missions/demo - player score.miz
Normal file
Binary file not shown.
BIN
tutorial & demo missions/demo - recon mode.miz
Normal file
BIN
tutorial & demo missions/demo - recon mode.miz
Normal file
Binary file not shown.
Binary file not shown.
BIN
tutorial & demo missions/distressbeacon.ogg
Normal file
BIN
tutorial & demo missions/distressbeacon.ogg
Normal file
Binary file not shown.
97
tutorial & demo missions/dml skeleton mission code.lua
Normal file
97
tutorial & demo missions/dml skeleton mission code.lua
Normal file
@@ -0,0 +1,97 @@
|
||||
dmlMain = {}
|
||||
--
|
||||
-- DML-based mission skeleton with event loop
|
||||
--
|
||||
dmlMain.ups = 1 -- 1 update per second
|
||||
-- minimal libraries required
|
||||
dmlMain.requiredLibs = {
|
||||
"dcsCommon", -- minimal module for all
|
||||
"cfxZones", -- Zones, of course
|
||||
"cfxPlayer", -- player events
|
||||
}
|
||||
|
||||
dmlMain.config = {} -- for reading config zones
|
||||
|
||||
--
|
||||
-- world event handling
|
||||
--
|
||||
function dmlMain.wPreProc(event)
|
||||
return true -- true means invoke worldEventHanlder()
|
||||
-- filter here and return false if the event is to be ignored
|
||||
end
|
||||
|
||||
function dmlMain.worldEventHandler(event)
|
||||
-- now analyse table <event> and do stuff
|
||||
trigger.action.outText("DCS World Event " .. event.id .. " (" .. dcsCommon.event2text(event.id) .. ") received", 30)
|
||||
end
|
||||
|
||||
--
|
||||
-- player event handling
|
||||
--
|
||||
function dmlMain.playerEventHandler (evType, description, info, data)
|
||||
trigger.action.outText("DML Player Event " .. evType .. " received", 30)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- update loop
|
||||
--
|
||||
function dmlMain.update()
|
||||
-- schedule myself in 1/ups seconds
|
||||
timer.scheduleFunction(dmlMain.update, {}, timer.getTime() + 1/dmlMain.ups)
|
||||
|
||||
-- perform any regular checks here in your main loop
|
||||
|
||||
end
|
||||
|
||||
--
|
||||
-- read configuration from zone 'dmlMainConfig'
|
||||
--
|
||||
|
||||
function dmlMain.readConfiguration()
|
||||
local theZone = cfxZones.getZoneByName("dmlMainConfig")
|
||||
if not theZone then return end
|
||||
dmlMain.config = cfxZones.getAllZoneProperties(theZone)
|
||||
-- demo: dump all name/value pairs returned
|
||||
trigger.action.outText("DML config read from config zone:", 30)
|
||||
for name, value in pairs(dmlMain.config) do
|
||||
trigger.action.outText(name .. ":" .. value, 30)
|
||||
end
|
||||
trigger.action.outText("---- (end of list)", 30)
|
||||
|
||||
end
|
||||
|
||||
--
|
||||
-- start
|
||||
--
|
||||
function dmlMain.start()
|
||||
-- ensure that all modules have loaded
|
||||
if not dcsCommon.libCheck("DML Main",
|
||||
dmlMain.requiredLibs) then
|
||||
return false
|
||||
end
|
||||
|
||||
-- read any configuration values placed in a config zone on the map
|
||||
dmlMain.readConfiguration()
|
||||
|
||||
-- subscribe to world events
|
||||
dcsCommon.addEventHandler(dmlMain.worldEventHandler,
|
||||
dmlMain.wPreProc) -- no post nor rejected
|
||||
|
||||
-- subscribe to player events
|
||||
cfxPlayer.addMonitor(dmlMain.playerEventHandler)
|
||||
|
||||
|
||||
-- start the event loop. it will sustain itself
|
||||
dmlMain.update()
|
||||
|
||||
-- say hi!
|
||||
trigger.action.outText("DML Main mission running!", 30)
|
||||
return true
|
||||
end
|
||||
|
||||
-- start main
|
||||
if not dmlMain.start() then
|
||||
trigger.action.outText("Main mission failed to run", 30)
|
||||
dmlMain = nil
|
||||
end
|
||||
104
tutorial & demo missions/ldgCtr.lua
Normal file
104
tutorial & demo missions/ldgCtr.lua
Normal file
@@ -0,0 +1,104 @@
|
||||
ldgCtr = {}
|
||||
--
|
||||
-- DML-based mission that counts the number of
|
||||
-- successful missions for all players. MP-capable
|
||||
--
|
||||
|
||||
ldgCtr.ups = 1 -- 1 update per second
|
||||
-- minimal libraries required
|
||||
ldgCtr.requiredLibs = {
|
||||
"dcsCommon", -- minimal module for all
|
||||
"cfxZones", -- Zones, of course
|
||||
"cfxPlayer", -- player events
|
||||
}
|
||||
|
||||
ldgCtr.config = {} -- for reading config zones
|
||||
ldgCtr.landings = {} -- set all landings to 0
|
||||
--
|
||||
-- world event handling
|
||||
--
|
||||
function ldgCtr.wPreProc(event)
|
||||
return event.id == 4 -- look for 'landing event'
|
||||
end
|
||||
|
||||
function ldgCtr.worldEventHandler(event)
|
||||
-- wPreProc filters all events EXCEPT landing
|
||||
local theUnit = event.initiator
|
||||
local uName = theUnit:getName()
|
||||
local playerName = theUnit:getPlayerName()
|
||||
trigger.action.outText(uName .. " has landed.", 30)
|
||||
if playerName then
|
||||
-- if a player landed, count their landing
|
||||
local numLandings = ldgCtr.landings[playerName]
|
||||
if not numLandings then numLandings = 0 end
|
||||
numLandings = numLandings + 1
|
||||
ldgCtr.landings[playerName] = numLandings
|
||||
trigger.action.outText("Player " .. playerName .. " completed ".. numLandings .." landings.", 30)
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- player event handling
|
||||
--
|
||||
function ldgCtr.playerEventHandler (evType, description, info, data)
|
||||
-- not needed
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- update loop
|
||||
--
|
||||
function ldgCtr.update()
|
||||
-- schedule myself in 1/ups seconds
|
||||
timer.scheduleFunction(ldgCtr.update, {}, timer.getTime() + 1/ldgCtr.ups)
|
||||
|
||||
-- no regular checks needed
|
||||
end
|
||||
|
||||
--
|
||||
-- read configuration from zone 'ldgCtrConfig'
|
||||
--
|
||||
|
||||
function ldgCtr.readConfiguration()
|
||||
local theZone = cfxZones.getZoneByName("ldgCtrConfig")
|
||||
if not theZone then return end
|
||||
ldgCtr.config = cfxZones.getAllZoneProperties(theZone)
|
||||
end
|
||||
|
||||
--
|
||||
-- start
|
||||
--
|
||||
function ldgCtr.start()
|
||||
-- ensure that all modules have loaded
|
||||
if not dcsCommon.libCheck("Landing Counter",
|
||||
ldgCtr.requiredLibs) then
|
||||
return false
|
||||
end
|
||||
|
||||
-- read any configuration values placed in a config zone on the map
|
||||
ldgCtr.readConfiguration()
|
||||
|
||||
-- init variables & state
|
||||
ldgCtr.landings = {}
|
||||
|
||||
-- subscribe to world events
|
||||
dcsCommon.addEventHandler(ldgCtr.worldEventHandler,
|
||||
ldgCtr.wPreProc) -- no post nor rejected
|
||||
|
||||
-- subscribe to player events
|
||||
cfxPlayer.addMonitor(ldgCtr.playerEventHandler)
|
||||
|
||||
|
||||
-- start the event loop. it will sustain itself
|
||||
ldgCtr.update()
|
||||
|
||||
-- say hi!
|
||||
trigger.action.outText("Landing Counter mission running!", 30)
|
||||
return true
|
||||
end
|
||||
|
||||
-- start main
|
||||
if not ldgCtr.start() then
|
||||
trigger.action.outText("Landing Counter failed to run", 30)
|
||||
ldgCtr = nil
|
||||
end
|
||||
Reference in New Issue
Block a user