Code format

This commit is contained in:
2025-01-09 10:55:32 +01:00
parent 2e44a1ef31
commit be81a31302
15 changed files with 274 additions and 231 deletions

View File

@@ -31,14 +31,14 @@ function shared.Spotter.Init()
if Heimdall_Data.config.spotter.debug then
print(string.format("[%s] Checking notification criteria for %s (%s)", ModuleName, name, faction))
end
if Heimdall_Data.config.agents[name] then
if Heimdall_Data.config.agents[name] then
if Heimdall_Data.config.spotter.debug then
print(string.format("[%s] Skipping agent: %s", ModuleName, name))
end
return false
return false
end
if Heimdall_Data.config.spotter.stinky then
if Heimdall_Data.config.stinkies[name] then
if Heimdall_Data.config.spotter.debug then
@@ -47,7 +47,7 @@ function shared.Spotter.Init()
return true
end
end
if Heimdall_Data.config.spotter.alliance then
if faction == "Alliance" then
if Heimdall_Data.config.spotter.debug then
@@ -56,7 +56,7 @@ function shared.Spotter.Init()
return true
end
end
if Heimdall_Data.config.spotter.hostile then
if hostile then
if Heimdall_Data.config.spotter.debug then
@@ -65,9 +65,10 @@ function shared.Spotter.Init()
return true
end
end
if Heimdall_Data.config.spotter.debug then
print(string.format("[%s] Using everyone setting: %s", ModuleName, tostring(Heimdall_Data.config.spotter.everyone)))
print(string.format("[%s] Using everyone setting: %s", ModuleName,
tostring(Heimdall_Data.config.spotter.everyone)))
end
return Heimdall_Data.config.spotter.everyone
end
@@ -78,13 +79,13 @@ function shared.Spotter.Init()
if Heimdall_Data.config.spotter.debug then
print(string.format("[%s] Processing spotted unit: %s", ModuleName, unit))
end
if not unit then return string.format("Could not find unit %s", tostring(unit)) end
if not UnitIsPlayer(unit) then
if not UnitIsPlayer(unit) then
if Heimdall_Data.config.spotter.debug then
print(string.format("[%s] Ignoring non-player unit: %s", ModuleName, unit))
end
return nil
return nil
end
local name = UnitName(unit)
@@ -115,13 +116,13 @@ function shared.Spotter.Init()
if Heimdall_Data.config.spotter.debug then
print(string.format("[%s] Player %s is %s", ModuleName, name, hostile and "hostile" or "friendly"))
end
local doNotify = ShouldNotify(unit, name, faction, hostile)
if not doNotify then
if not doNotify then
if Heimdall_Data.config.spotter.debug then
print(string.format("[%s] Skipping notification for %s", ModuleName, name))
end
return string.format("Not notifying for %s", tostring(name))
return string.format("Not notifying for %s", tostring(name))
end
local hp = UnitHealth(unit)
@@ -151,7 +152,7 @@ function shared.Spotter.Init()
if Heimdall_Data.config.spotter.debug then
print(string.format("[%s] Player %s coordinates: %.2f, %.2f", ModuleName, name, x * 100, y * 100))
end
local stinky = Heimdall_Data.config.stinkies[name] or false
local text = string.format("I see (%s) %s/%s %s of race %s (%s) with health %s/%s at %s (%2.2f, %2.2f)",
hostile and "Hostile" or "Friendly",
@@ -185,18 +186,18 @@ function shared.Spotter.Init()
if Heimdall_Data.config.spotter.debug then
print(string.format("[%s] Event received: %s for unit: %s", ModuleName, event, unit or "target"))
end
if not Heimdall_Data.config.spotter.enabled then
if not Heimdall_Data.config.spotter.enabled then
if Heimdall_Data.config.spotter.debug then
print(string.format("[%s] Module disabled, ignoring event", ModuleName))
end
return
return
end
if event == "UNIT_TARGET" then
unit = "target"
end
local err = NotifySpotted(unit)
if err then
if Heimdall_Data.config.spotter.debug then