When you build a construction, the GUI thread receives a notification - the name of the event is "builder.apply" The name of the construction file will be located in param.proposal.toAdd[1].filename
Here is my test code:
Code
function data()
return {
update = function ()
end,
guiUpdate = function ()
end,
handleEvent = function (src, id, name, param)
end,
guiHandleEvent = function (id, name, param)
if (name == "builder.apply") then
if param.proposal and param.proposal.toAdd ~= nil then
debugPrint({id, name, param.proposal.toAdd}) -- param.proposal.toAdd[1].filename contains the name of the construction file
end
end
end,
}
end
Alles anzeigen
On receiving the notification and comparing the filename to that of your construction, you could pass the notification over to the Engine thread using SendScriptEvent.
A bit clunky, to be sure, but it should let you get prompt notification so that you can apply the name you want, without having to consistently poll all the construction entities.
A word of warning if you want to do further testing yourself - with a modular construction, the param table is quite large...