Merge remote-tracking branch 'origin/master' into branch

# Conflicts:
#	Moose Development/Moose/Wrapper/Scenery.lua
This commit is contained in:
Applevangelist
2025-11-27 08:57:37 +01:00
5 changed files with 878 additions and 663 deletions
@@ -27,7 +27,7 @@
--
-- ### Author: **funkyfranky**
--
-- ### Contributions: FlightControl
-- ### Contributions: FlightControl, Applevangelist
--
-- ====
-- @module Functional.Artillery
@@ -753,7 +753,7 @@ ARTY.db={
--- Arty script version.
-- @field #string version
ARTY.version="1.3.3"
ARTY.version="1.3.4"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -2241,7 +2241,7 @@ function ARTY._FuncTrack(weapon, self, target)
if _dist<target.radius then
-- Get random coordinate within a certain radius.
local _cr=_coord:GetRandomCoordinateInRadius(_data.target.radius)
local _cr=_coord:GetRandomCoordinateInRadius(target.radius)
-- Fire smoke at this coordinate.
_cr:Smoke(self.smokeColor)
+113
View File
@@ -5161,3 +5161,116 @@ function UTILS.ValidateAndRepositionStatic(Country, Category, Type, Position, Sh
return nil
end
---
-- This function can be used to scan all airdromes of a map and write the Moose enums to a file.
function UTILS.CreateAirbaseEnum()
-- Save file function
local function _savefile( filename, data )
local file=lfs.writedir() .. filename
local f = io.open(file , "wb")
if f then
f:write( data )
f:close()
env.info(string.format("Saving to file %s", tostring(file) ))
else
env.info(string.format("ERROR: Could not save results to file %s", tostring(file) ))
end
end
-- Get all airbases
local airbases=world.getAirbases()
-- Get map name
local mapname=env.mission.theatre
-- Put airbases in a table
local myab={}
for i,_airbase in pairs(airbases) do
local airbase=_airbase --DCS#Airbase
local cat=airbase:getDesc().category
if cat==Airbase.Category.AIRDROME then
-- Get airbase name
local name=airbase:getName()
-- Key is the name with illigal characters replaced
local key=name
-- Germany map specifics
if name=="Airracing Lubeck" then
key="Airracing_Luebeck"
elseif name=="Bad Durkheim" then
key="Bad_Duerkheim"
elseif name=="Buchel" then
key="Buechel"
elseif name=="Buckeburg" then
key="Bueckeburg"
elseif name=="Dusseldorf" then
key="Duesseldorf"
elseif name=="Gutersloh" then
key="Guetersloh"
elseif name=="Kothen" then
key="Koethen"
elseif name=="Larz" then
key="Laerz"
elseif name=="Lubeck" then
key="Luebeck"
elseif name=="Luneburg" then
key="Lueneburg"
elseif name=="Norvenich" then
key="Noervenich"
elseif name=="Ober-Morlen" then
key="Ober_Moerlen"
elseif name=="Peenemunde" then
key="Peenemuende"
elseif name=="Pottschutthohe" then
key="Pottschutthoehe"
elseif name=="Schonefeld" then
key="Schoenefeld"
elseif name=="Weser Wumme" then
key="Weser_Wuemme"
elseif name=="Zollschen" then
key="Zoellschen"
elseif name=="Zweibrucken" then
key="Zweibruecken"
end
-- Replace blanks, hyphens by underscores
key=key:gsub(" ", "_")
key=key:gsub("-", "_")
key=key:gsub("'", "_")
key=UTILS.ReplaceIllegalCharacters(key, "_")
local entry={}
entry.key=key
entry.name=name
table.insert(myab, entry)
end
end
-- Sort by name
table.sort(myab, function(a,b) return a.name < b.name end)
local text=string.format("\n--- Airbases of the %s map", mapname)
text=text.."\n--"
for _,ab in pairs(myab) do
text=text..string.format("\n-- * `AIRBASE.%s.%s` %s", mapname, ab.key, ab.name)
end
text=text.."\n--"
text=text..string.format("\n-- @field %s", mapname)
text=text..string.format("\nAIRBASE.%s = {", mapname)
for _,ab in pairs(myab) do
text=text..string.format('\n\t["%s"] = "%s",', ab.key, ab.name)
end
text=text.."\n}"
_savefile(string.format("%s-enums.txt", env.mission.theatre), text)
--env.info(text)
end
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -485,7 +485,7 @@ function NET:GetPlayerIDByName(Name)
if not Name then return nil end
local playerList = net.get_player_list()
for i=1,#playerList do
local playerName = net.get_name(i)
local playerName = net.get_name(playerList[i])
if playerName == Name then
return playerList[i]
end
@@ -74,6 +74,13 @@ function SCENERY:Register( SceneryName, SceneryObject, SceneryZone )
self.Vec2 = SceneryZone:GetVec2()
self.Vector = (self.Vec3 and VECTOR) and VECTOR:NewFromVec(self.Vec3) or nil
end
if SceneryObject then
local vec3 = SceneryObject:getPoint()
self.Vec3 = { x = vec3.x, y = vec3.y, z = vec3.z }
self.Vec2 = { x = vec3.x, y = vec3.z }
self.Vector = (self.Vec3 and VECTOR) and VECTOR:NewFromVec(self.Vec3) or nil
end
if self.SceneryObject and self.SceneryObject.getLife then -- fix some objects do not have all functions
self.Life0 = self.SceneryObject:getLife() or 1