Ich habe mal ne Frage oder nen Thema was sicher für vile interessant ist unzwar wie mann Scripte MP Ready macht (Der Aufbau der "Event" LUA mit der Standart LUA) ich habe mal ganz einfaches geschrieben und hab das mal soweit gemacht wie ich es weiß.
[lua]
myScript = {};
function myScript.prerequisitesPresent(specializations)
return true;
end;
function myScript:load(xmlFile)
self.-kp- = SpecializationUtil.callSpecializationsFunction("setRotation");
local rotationPartNodeRotation1= Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.Rotation1#index"));
if rotationPartNodeRotation1 ~= nil then
self.Rotation1 = {};
self.Rotation1.node = rotationPartNodeRotation1;
local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.Rotation1#minRot"));
self.Rotation1.minRot = {};
self.Rotation1.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
self.Rotation1.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
self.Rotation1.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.Rotation1#maxRot"));
self.Rotation1.maxRot = {};
self.Rotation1.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
self.Rotation1.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
self.Rotation1.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
self.Rotation1.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.Rotation1#rotTime"), 2)*1000;
end;
end;
function myScript:delete()
end;
function myScript:mouseEvent(posX, posY, isDown, isUp, button)
end;
function myScript:keyEvent(unicode, sym, modifier, isDown)
end;
function myScript:readStream(streamId, connection)
end;
function myScript:writeStream(streamId, connection)
end;
function myScript:update(dt)
if InputBinding.isPressed(InputBinding.TASTE) then
self.drehen = not self.drehen;
end;
end;
function myScript:updateTick(dt)
if self.Rotation1 ~= nil then
local x, y, z = getRotation(self.Rotation1.node);
local rot = {x,y,z};
local newRot = Utils.getMovedLimitedValues(rot, self.Rotation1.maxRot, self.Rotation1.minRot, 3, self.Rotation1.rotTime, dt, not self.drehen);
setRotation(self.Rotation1.node, unpack(newRot));
end;
end;
function myScript:setRotation(Rotation, noEventSend)
end;
function myScript:draw()
end;[/lua]
Aber von der "Event" LUA hab ich 0 Plan
[lua]RotationEvent = {};
RotationEvent_mt = Class(RotationEvent, Event);
InitEventClass(RotationEvent, "RotationEvent");
function RotationEvent:emptyNew()
end;
function RotationEvent:new(vehicle, Rotation)
end;
function RotationEvent:readStream(streamId, connection)
end;
function RotationEvent:writeStream(streamId, connection)
end;
function RotationEvent:run(connection)
end;
function RotationEvent.sendEvent(vehicle, Rotation, noEventSend)
end;
[/lua]
Würde mich über Antworten freuen