Merge pull request #2330 from shaji-Dev/master

[FIXED] index `nil` at  `MARKEROPS_BASE:OnEventMark`
This commit is contained in:
Thomas 2025-07-03 15:14:11 +02:00 committed by GitHub
commit 33e63a4819
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -154,14 +154,7 @@ function MARKEROPS_BASE:OnEventMark(Event)
self:E("Skipping onEvent. Event or Event.idx unknown.") self:E("Skipping onEvent. Event or Event.idx unknown.")
return true return true
end end
--position
if self.debug then
local vec3={y=Event.pos.y, x=Event.pos.x, z=Event.pos.z}
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()
end
local coalition = Event.MarkCoalition local coalition = Event.MarkCoalition
-- decision -- decision
if Event.id==world.event.S_EVENT_MARK_ADDED then if Event.id==world.event.S_EVENT_MARK_ADDED then
@ -177,7 +170,6 @@ function MARKEROPS_BASE:OnEventMark(Event)
local m = MESSAGE:New(string.format("Mark added at %s with text: %s",coordtext,text),10,"Info",false):ToAll() local m = MESSAGE:New(string.format("Mark added at %s with text: %s",coordtext,text),10,"Info",false):ToAll()
end end
local matchtable = self:_MatchKeywords(Eventtext) local matchtable = self:_MatchKeywords(Eventtext)
local coord=COORDINATE:NewFromVec3(vec3)
self:MarkAdded(Eventtext,matchtable,coord,Event.idx,coalition,Event.PlayerName,Event) self:MarkAdded(Eventtext,matchtable,coord,Event.idx,coalition,Event.PlayerName,Event)
end end
end end
@ -191,10 +183,9 @@ function MARKEROPS_BASE:OnEventMark(Event)
if self.debug then if self.debug then
local coordtext = coord:ToStringLLDDM() local coordtext = coord:ToStringLLDDM()
local text = tostring(Event.text) local text = tostring(Event.text)
local m = MESSAGE:New(string.format("Mark added at %s with text: %s",coordtext,text),10,"Info",false):ToAll() local m = MESSAGE:New(string.format("Mark changed at %s with text: %s",coordtext,text),10,"Info",false):ToAll()
end end
local matchtable = self:_MatchKeywords(Eventtext) local matchtable = self:_MatchKeywords(Eventtext)
local coord=COORDINATE:NewFromVec3(vec3)
self:MarkChanged(Eventtext,matchtable,coord,Event.idx,coalition,Event.PlayerName,Event) self:MarkChanged(Eventtext,matchtable,coord,Event.idx,coalition,Event.PlayerName,Event)
end end
end end