mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
#MARKEROPS - do not crate a COORDINATE b4 you need it
#UTILS - added * UTILS.ShowHelperGate(pos, heading) * UTILS.ShellZone * UTILS.RemoveObjects * UTILS.DestroyScenery
This commit is contained in:
parent
a467fabdc8
commit
068d21612f
@ -50,7 +50,7 @@ MARKEROPS_BASE = {
|
||||
ClassName = "MARKEROPS",
|
||||
Tag = "mytag",
|
||||
Keywords = {},
|
||||
version = "0.1.3",
|
||||
version = "0.1.4",
|
||||
debug = false,
|
||||
Casesensitive = true,
|
||||
}
|
||||
@ -156,8 +156,8 @@ function MARKEROPS_BASE:OnEventMark(Event)
|
||||
end
|
||||
--position
|
||||
local vec3={y=Event.pos.y, x=Event.pos.x, z=Event.pos.z}
|
||||
local coord=COORDINATE:NewFromVec3(vec3)
|
||||
if self.debug then
|
||||
local coord=COORDINATE:NewFromVec3(vec3)
|
||||
local coordtext = coord:ToStringLLDDM()
|
||||
local text = tostring(Event.text)
|
||||
local m = MESSAGE:New(string.format("Mark added at %s with text: %s",coordtext,text),10,"Info",false):ToAll()
|
||||
@ -171,6 +171,7 @@ function MARKEROPS_BASE:OnEventMark(Event)
|
||||
if Eventtext~=nil then
|
||||
if self:_MatchTag(Eventtext) then
|
||||
local matchtable = self:_MatchKeywords(Eventtext)
|
||||
local coord=COORDINATE:NewFromVec3(vec3)
|
||||
self:MarkAdded(Eventtext,matchtable,coord,Event.idx,coalition,Event.PlayerName,Event)
|
||||
end
|
||||
end
|
||||
@ -181,6 +182,7 @@ function MARKEROPS_BASE:OnEventMark(Event)
|
||||
if Eventtext~=nil then
|
||||
if self:_MatchTag(Eventtext) then
|
||||
local matchtable = self:_MatchKeywords(Eventtext)
|
||||
local coord=COORDINATE:NewFromVec3(vec3)
|
||||
self:MarkChanged(Eventtext,matchtable,coord,Event.idx,coalition,Event.PlayerName,Event)
|
||||
end
|
||||
end
|
||||
|
||||
@ -4428,3 +4428,50 @@ end
|
||||
function UTILS.Weather.StopFogAnimation()
|
||||
return world.weather.setFogAnimation({})
|
||||
end
|
||||
|
||||
--- Find a ME created zone by its name
|
||||
function UTILS.GetEnvZone(name)
|
||||
for _,v in ipairs(env.mission.triggers.zones) do
|
||||
if v.name == name then
|
||||
return v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Show a helper gate at a DCS#Vec3 position
|
||||
-- @param DCS#Vec3 pos The position
|
||||
-- @param number heading Heading in degrees, can be 0..359 degrees
|
||||
function UTILS.ShowHelperGate(pos, heading)
|
||||
net.dostring_in("mission",string.format("a_show_helper_gate(%s, %s, %s, %f)", pos.x, pos.y, pos.z, math.rad(heading)))
|
||||
end
|
||||
|
||||
--- Shell a zone, zone must ME created
|
||||
-- @param #string name The name of the ME created zone
|
||||
-- @param #number power Equals kg of TNT, e.g. 75
|
||||
-- @param #count Number of shells simulated
|
||||
function UTILS.ShellZone(name, power, count)
|
||||
local z = UTILS.GetEnvZone(name)
|
||||
if z then
|
||||
net.dostring_in("mission",string.format("a_shelling_zone(%d, %d, %d)", z.zoneId, power, count))
|
||||
end
|
||||
end
|
||||
|
||||
--- Remove objects from a zone, zone must ME created
|
||||
-- @param #string name The name of the ME created zone
|
||||
-- @param #number type Type of objects to remove can be 0:all, 1: trees, 2:objects
|
||||
function UTILS.RemoveObjects(name, type)
|
||||
local z = UTILS.GetEnvZone(name)
|
||||
if z then
|
||||
net.dostring_in("mission",string.format("a_remove_scene_objects(%d, %d)", z.zoneId, type))
|
||||
end
|
||||
end
|
||||
|
||||
--- Remove scenery objects from a zone, zone must ME created
|
||||
-- @param #string name The name of the ME created zone
|
||||
-- @param #number level Level of removal
|
||||
function UTILS.DestroyScenery(name, level)
|
||||
local z = UTILS.GetEnvZone(name)
|
||||
if z then
|
||||
net.dostring_in("mission",string.format("a_scenery_destruction_zone(%d, %d)", z.zoneId, level))
|
||||
end
|
||||
end
|
||||
|
||||
@ -1924,3 +1924,10 @@ function UNIT:IsAAA()
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--- Set the relative life points of a UNIT object
|
||||
-- @param #UNIT self
|
||||
-- @param #number Percent Percent to set, can be 0..100.
|
||||
function UNIT:SetLife(Percent)
|
||||
net.dostring_in("mission",string.format("a_unit_set_life_percentage(%d, %f)", self:GetID(), Percent))
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user