mirror of
https://github.com/mrSkortch/MissionScriptingTools.git
synced 2026-07-19 10:17:18 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c5bab0f64 | |||
| 941ff9708c | |||
| e242126cb3 | |||
| 8dc51dbc83 |
@@ -8,7 +8,7 @@ mist = {}
|
||||
-- don't change these
|
||||
mist.majorVersion = 3
|
||||
mist.minorVersion = 6
|
||||
mist.build = 42
|
||||
mist.build = 44
|
||||
|
||||
|
||||
|
||||
@@ -530,7 +530,7 @@ do
|
||||
if newObj.x and newObj.y and newObj.type and type(newObj.x) == 'number' and type(newObj.y) == 'number' and type(newObj.type) == 'string' then
|
||||
coalition.addStaticObject(country.id[newCountry], newObj)
|
||||
|
||||
return newObj.name
|
||||
return newObj
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -696,7 +696,7 @@ do
|
||||
|
||||
coalition.addGroup(country.id[newCountry], Unit.Category[newCat], newGroup)
|
||||
|
||||
return newGroup.name
|
||||
return newGroup
|
||||
|
||||
end
|
||||
|
||||
@@ -791,6 +791,7 @@ do
|
||||
self.f(event)
|
||||
end
|
||||
world.addEventHandler(handler)
|
||||
return handler.id
|
||||
end
|
||||
|
||||
mist.removeEventHandler = function(id)
|
||||
@@ -4021,9 +4022,12 @@ do
|
||||
new.addedAt = timer.getTime()
|
||||
|
||||
|
||||
if vars.sound then -- has no function yet, basic idea is to play the sound file for designated players. Had considered a more complex system similar to On Station audio messaging with staggering mesages, but that isn't entirely needed.
|
||||
if vars.sound or vars.fileName then -- has no function yet, basic idea is to play the sound file for designated players. Had considered a more complex system similar to On Station audio messaging with staggering mesages, but that isn't entirely needed.
|
||||
-- additionally we could have an "outSound" function that will do just the audio alone with no text
|
||||
new.sound = vars.sound
|
||||
if vars.fileName then
|
||||
new.sound = vars.fileName
|
||||
end
|
||||
new.playAudio = true
|
||||
end
|
||||
|
||||
@@ -5035,11 +5039,11 @@ mist.getPayload = function(unitIdent)
|
||||
-- refactor to search by groupId and allow groupId and groupName as inputs
|
||||
local unitId = unitIdent
|
||||
if type(unitIdent) == 'string' and not tonumber(unitIdent) then
|
||||
unitId = mist.DBs.MEunitsById[unitIdent].unitId
|
||||
unitId = mist.DBs.MEunitsByName[unitIdent].unitId
|
||||
end
|
||||
local gpId = mist.DBs.MEunitsById[unitId].groupId
|
||||
|
||||
if unitName and type(unitName) == 'string' then
|
||||
if gpId and unitId then
|
||||
for coa_name, coa_data in pairs(env.mission.coalition) do
|
||||
if (coa_name == 'red' or coa_name == 'blue') and type(coa_data) == 'table' then
|
||||
if coa_data.country then --there is a country table
|
||||
@@ -5048,7 +5052,7 @@ mist.getPayload = function(unitIdent)
|
||||
if obj_type_name == "helicopter" or obj_type_name == "ship" or obj_type_name == "plane" or obj_type_name == "vehicle" then -- only these types have points
|
||||
if ((type(obj_type_data) == 'table') and obj_type_data.group and (type(obj_type_data.group) == 'table') and (#obj_type_data.group > 0)) then --there's a group!
|
||||
for group_num, group_data in pairs(obj_type_data.group) do
|
||||
if group_data and group_data.groupId == groupId then
|
||||
if group_data and group_data.groupId == gpId then
|
||||
for unitIndex, unitData in pairs(group_data.units) do --group index
|
||||
if unitData.unitId == unitId then
|
||||
return unitData.payload
|
||||
@@ -5064,7 +5068,7 @@ mist.getPayload = function(unitIdent)
|
||||
end
|
||||
end
|
||||
else
|
||||
env.info('mist.getPayload got ' .. type(unitName))
|
||||
env.info('mist.getPayload got ' .. type(unitIdent))
|
||||
return false
|
||||
end
|
||||
env.info('mist.getPayload, payload not found')
|
||||
@@ -5205,10 +5209,10 @@ mist.teleportToPoint = function(vars) -- main teleport function that all of tele
|
||||
end
|
||||
if point then
|
||||
if (newGroupData.category == 'plane' or newGroupData.category == 'helicopter') and point.z then
|
||||
if point.y > 0 and point.y > terrain.getHeight({newGroupData.units[unitNum]["x"], newGroupData.units[unitNum]["y"]}) + 10 then
|
||||
if point.y > 0 and point.y > land.getHeight({newGroupData.units[unitNum]["x"], newGroupData.units[unitNum]["y"]}) + 10 then
|
||||
newGroupData.units[unitNum]["alt"] = point.y
|
||||
else
|
||||
newGroupData.units[unitNum]["alt"] = terrain.getHeight({newGroupData.units[unitNum]["x"], newGroupData.units[unitNum]["y"]}) + 300
|
||||
newGroupData.units[unitNum]["alt"] = land.getHeight({newGroupData.units[unitNum]["x"], newGroupData.units[unitNum]["y"]}) + 300
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ mist = {}
|
||||
-- don't change these
|
||||
mist.majorVersion = 3
|
||||
mist.minorVersion = 6
|
||||
mist.build = 42
|
||||
mist.build = 44
|
||||
|
||||
|
||||
|
||||
@@ -530,7 +530,7 @@ do
|
||||
if newObj.x and newObj.y and newObj.type and type(newObj.x) == 'number' and type(newObj.y) == 'number' and type(newObj.type) == 'string' then
|
||||
coalition.addStaticObject(country.id[newCountry], newObj)
|
||||
|
||||
return newObj.name
|
||||
return newObj
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -696,7 +696,7 @@ do
|
||||
|
||||
coalition.addGroup(country.id[newCountry], Unit.Category[newCat], newGroup)
|
||||
|
||||
return newGroup.name
|
||||
return newGroup
|
||||
|
||||
end
|
||||
|
||||
@@ -791,6 +791,7 @@ do
|
||||
self.f(event)
|
||||
end
|
||||
world.addEventHandler(handler)
|
||||
return handler.id
|
||||
end
|
||||
|
||||
mist.removeEventHandler = function(id)
|
||||
@@ -4021,9 +4022,12 @@ do
|
||||
new.addedAt = timer.getTime()
|
||||
|
||||
|
||||
if vars.sound then -- has no function yet, basic idea is to play the sound file for designated players. Had considered a more complex system similar to On Station audio messaging with staggering mesages, but that isn't entirely needed.
|
||||
if vars.sound or vars.fileName then -- has no function yet, basic idea is to play the sound file for designated players. Had considered a more complex system similar to On Station audio messaging with staggering mesages, but that isn't entirely needed.
|
||||
-- additionally we could have an "outSound" function that will do just the audio alone with no text
|
||||
new.sound = vars.sound
|
||||
if vars.fileName then
|
||||
new.sound = vars.fileName
|
||||
end
|
||||
new.playAudio = true
|
||||
end
|
||||
|
||||
@@ -5035,11 +5039,11 @@ mist.getPayload = function(unitIdent)
|
||||
-- refactor to search by groupId and allow groupId and groupName as inputs
|
||||
local unitId = unitIdent
|
||||
if type(unitIdent) == 'string' and not tonumber(unitIdent) then
|
||||
unitId = mist.DBs.MEunitsById[unitIdent].unitId
|
||||
unitId = mist.DBs.MEunitsByName[unitIdent].unitId
|
||||
end
|
||||
local gpId = mist.DBs.MEunitsById[unitId].groupId
|
||||
|
||||
if unitName and type(unitName) == 'string' then
|
||||
if gpId and unitId then
|
||||
for coa_name, coa_data in pairs(env.mission.coalition) do
|
||||
if (coa_name == 'red' or coa_name == 'blue') and type(coa_data) == 'table' then
|
||||
if coa_data.country then --there is a country table
|
||||
@@ -5048,7 +5052,7 @@ mist.getPayload = function(unitIdent)
|
||||
if obj_type_name == "helicopter" or obj_type_name == "ship" or obj_type_name == "plane" or obj_type_name == "vehicle" then -- only these types have points
|
||||
if ((type(obj_type_data) == 'table') and obj_type_data.group and (type(obj_type_data.group) == 'table') and (#obj_type_data.group > 0)) then --there's a group!
|
||||
for group_num, group_data in pairs(obj_type_data.group) do
|
||||
if group_data and group_data.groupId == groupId then
|
||||
if group_data and group_data.groupId == gpId then
|
||||
for unitIndex, unitData in pairs(group_data.units) do --group index
|
||||
if unitData.unitId == unitId then
|
||||
return unitData.payload
|
||||
@@ -5064,7 +5068,7 @@ mist.getPayload = function(unitIdent)
|
||||
end
|
||||
end
|
||||
else
|
||||
env.info('mist.getPayload got ' .. type(unitName))
|
||||
env.info('mist.getPayload got ' .. type(unitIdent))
|
||||
return false
|
||||
end
|
||||
env.info('mist.getPayload, payload not found')
|
||||
@@ -5205,10 +5209,10 @@ mist.teleportToPoint = function(vars) -- main teleport function that all of tele
|
||||
end
|
||||
if point then
|
||||
if (newGroupData.category == 'plane' or newGroupData.category == 'helicopter') and point.z then
|
||||
if point.y > 0 and point.y > terrain.getHeight({newGroupData.units[unitNum]["x"], newGroupData.units[unitNum]["y"]}) + 10 then
|
||||
if point.y > 0 and point.y > land.getHeight({newGroupData.units[unitNum]["x"], newGroupData.units[unitNum]["y"]}) + 10 then
|
||||
newGroupData.units[unitNum]["alt"] = point.y
|
||||
else
|
||||
newGroupData.units[unitNum]["alt"] = terrain.getHeight({newGroupData.units[unitNum]["x"], newGroupData.units[unitNum]["y"]}) + 300
|
||||
newGroupData.units[unitNum]["alt"] = land.getHeight({newGroupData.units[unitNum]["x"], newGroupData.units[unitNum]["y"]}) + 300
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,14 @@
|
||||
-- changelog
|
||||
v44
|
||||
-fxed getPayload for real this time
|
||||
-addEventHandler now correctly returns the Id value
|
||||
-message.add now also accepts variable 'fileName' for the sound file, this is in addition to the .sound variable
|
||||
-fixed issue with teleportToPoint
|
||||
|
||||
v43
|
||||
-fixed issue with getPayload
|
||||
-dynAdd and dynAddStatic now return the full new table and not just its name. The name value is still accessible via returned table.name
|
||||
|
||||
v42 v3.6 release
|
||||
-added mist.getRandomPointInZone. Function uses mist.getRandomPointInCircle.
|
||||
-fixed bug with altitude switching to radio if baro was specified
|
||||
@@ -12,6 +22,8 @@ getGroupPayload
|
||||
getGroupPoints
|
||||
getGroupRoute
|
||||
|
||||
--re added the mist named file
|
||||
|
||||
v38
|
||||
- fixed bug with optional variables for coordinate messages not actually being optional
|
||||
|
||||
|
||||
Reference in New Issue
Block a user