Intial Commit
This commit is contained in:
56
42.13/media/lua/client/TowBar/HookVehicleAction.lua
Normal file
56
42.13/media/lua/client/TowBar/HookVehicleAction.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
require('TimedActions/ISBaseTimedAction')
|
||||
|
||||
TowBarHookVehicle = ISBaseTimedAction:derive("TowBarHookVehicle")
|
||||
|
||||
|
||||
-- The condition which tells the timed action if it is still valid
|
||||
function TowBarHookVehicle:isValid()
|
||||
return true;
|
||||
end
|
||||
|
||||
-- Starts the Timed Action
|
||||
function TowBarHookVehicle:start()
|
||||
self:setActionAnim(self.animation)
|
||||
self.sound = getSoundManager():PlayWorldSound("towbar_hookingSound", false, self.character:getSquare(), 0, 5, 1, true)
|
||||
end
|
||||
|
||||
-- Is called when the time has passed
|
||||
function TowBarHookVehicle:perform()
|
||||
self.sound:stop();
|
||||
|
||||
if self.performFunc ~= nil then
|
||||
self.performFunc(self.character, self.arg1, self.arg2, self.arg3, self.arg4)
|
||||
end
|
||||
|
||||
ISBaseTimedAction.perform(self);
|
||||
end
|
||||
|
||||
|
||||
function TowBarHookVehicle:stop()
|
||||
if self.sound then
|
||||
self.sound:stop()
|
||||
end
|
||||
|
||||
ISBaseTimedAction.stop(self)
|
||||
end
|
||||
|
||||
function TowBarHookVehicle:new(character, time, animation, performFunc, arg1, arg2, arg3, arg4)
|
||||
local o = {};
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
o.stopOnWalk = true
|
||||
o.stopOnRun = true
|
||||
o.maxTime = time
|
||||
|
||||
o.character = character;
|
||||
o.animation = animation
|
||||
|
||||
o.performFunc = performFunc
|
||||
o.arg1 = arg1
|
||||
o.arg2 = arg2
|
||||
o.arg3 = arg3
|
||||
o.arg4 = arg4
|
||||
|
||||
return o;
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user