Community Forum

Vehicle.registerActionEvents

Forum Overview >> Scripting

CategoryScripting
Created06.03.2021 13:09


Svyatchenko Yuri (Berrod) 06.03.2021 13:09
Hello, please tell me where the "clearActionEventsTable" and "addActionEvent" functions inside "Vehicle.registerActionEvents" come from. These functions are not registered in the Vehicle class, as well as in its parent "Object".

Bilbo Beutlin (BBeutlin) 06.03.2021 15:07
The register/add/clear ActionEvents are usually functions of the dedicated specialization LUAs.
These call functions from "SpecializationUtil".

Svyatchenko Yuri (Berrod) 06.03.2021 16:03
The "Vehicle.registerActionEvents" function contains:

function Vehicle:registerActionEvents(excludedVehicle)
. . .
self:clearActionEventsTable(self.actionEvents)
. . .
local _, actionEventId = self:addActionEvent(self.actionEvents, ............)
. . .
end

The Vehicle class does not contain registrations for these functions. There is no such entry in "Vehicle":

function Vehicle.registerFunctions (vehicleType)
. . .
SpecializationUtil.registerFunction (vehicleType, "clearActionEventsTable", Vehicle.clearActionEventsTable)
SpecializationUtil.registerFunction (vehicleType, "addActionEvent", Vehicle.addActionEvent)
. . .
end

Bilbo Beutlin (BBeutlin) 06.03.2021 22:20
Did you read what I've written?
The actionEvents are managed mainly by specializations and also registered from there.
A basic vehicle without further specs will need only basic events like listed in Vehicle.registerEvents().


PS concerning your first questions
I've just noticed some of the stuff you asked for didn't find yet the way into the documentations here.
You will find it in the LUA source codes distributed with the Giants Remote Debugger.

Svyatchenko Yuri (Berrod) 07.03.2021 00:01
Apparently, the really requested functions did not make it into the documentation, since a survey of the "Vehicle" table shows their presence.
Considering that the "registerActionEvents" function in "MyNewClass" is similar to the one in "Vehicle", I solved the problem as follows:

function MyNewClass:clearActionEventsTable(actionEvents)
Vehicle.clearActionEventsTable(self,actionEvents)
end
function MyNewClass:addActionEvent(argument1,...,argument10)
return Vehicle.addActionEvent(self,argument1,...,argument10)
end

Thank you for your prompt reply.


Note: Log in to post. Create a new account here.