Also dural hat das Script ein bisschen überarbeitet, sodass es jetzt die funktion hat, dass wenn der ballen voll ist, die Presse diesen automatisch auswirft, anhalten muss man selbst. Ist in meinen Augen schon eine große erleichterung, wenn man selbst presst, weil das lästige vergewaltigen der X- Taste wegfällt. Nur noch anhalten, warten, weiterfahren
Falls das jemand auch in seinen Pressen haben möchte:
Code
autobaler = {};
function autobaler.prerequisitesPresent(specializations)
print(string.format("%s", "Script Edit by sKyDaNcEr"));
return true;
end;
function autobaler:load(xmlFile)
self.automatik = false;
allowedToDrive = true;
end;
function autobaler:delete()
end;
function autobaler:readStream(streamId, connection)
self.automatik = streamReadBool(streamId);
end;
function autobaler:writeStream(streamId, connection)
streamWriteBool(streamId, self.automatik);
end;
function autobaler:mouseEvent(posX, posY, isDown, isUp, button)
end;
function autobaler:keyEvent(unicode, sym, modifier, isDown)
end;
function autobaler:update(dt)
if self:getIsActiveForInput() and InputBinding.hasEvent(InputBinding.IMPLEMENT_EXTRA3) then
self.automatik = not self.automatik;
autobalerEvent.sendEvent(self, self.automatik)
end;
if self.automatik then
if self.baleUnloadAnimationName ~= nil then
if self.fillLevel >= self.capacity and self.balerUnloadingState == Baler.UNLOADING_CLOSED and self:isUnloadingAllowed() then
self:setIsTurnedOn(false, false);
if table.getn(self.bales) > 0 then
self:setIsUnloadingBale(true,false)
end
elseif self.balerUnloadingState ~= Baler.UNLOADING_CLOSED then
if self.balerUnloadingState == Baler.UNLOADING_OPEN then
self:setIsUnloadingBale(false)
end
elseif self.fillLevel >= 0 and not self.isTurnedOn and self.balerUnloadingState == Baler.UNLOADING_CLOSED then
self:setIsTurnedOn(true, false);
end
end;
end;
end;
function autobaler:updateTick(dt)
end;
function autobaler:draw()
if self.automatik then
g_currentMission:addHelpButtonText("Automatic off",InputBinding.IMPLEMENT_EXTRA3);
else
g_currentMission:addHelpButtonText("Automatic on",InputBinding.IMPLEMENT_EXTRA3);
end;
end;
------------------------------------------- event -------------------------------------------
autobalerEvent = {};
autobalerEvent_mt = Class(autobalerEvent, Event);
InitEventClass(autobalerEvent, "autobalerEvent");
function autobalerEvent:emptyNew()
local self = Event:new(autobalerEvent_mt);
self.className="autobalerEvent";
return self;
end;
function autobalerEvent:new(object, data)
local self = autobalerEvent:emptyNew()
self.object = object;
self.data = data;
return self;
end;
function autobalerEvent:readStream(streamId, connection)
local id = streamReadInt32(streamId);
self.object = networkGetObject(id);
self.data = streamReadBool(streamId);
self.object.automatik = self.data;
if not connection:getIsServer() then
g_server:broadcastEvent(autobalerEvent:new(self.object, self.data), nil, connection, self.object);
end;
end;
function autobalerEvent:writeStream(streamId, connection)
streamWriteInt32(streamId, networkGetObjectId(self.object));
streamWriteBool(streamId, self.data);
end;
function autobalerEvent.sendEvent(vehicle, data)
if g_server ~= nil then
g_server:broadcastEvent(autobalerEvent:new(vehicle, data), nil, nil, vehicle);
else
g_client:getServerConnection():sendEvent(autobalerEvent:new(vehicle, data));
end;
end;
Alles anzeigen