So i added custom component to character and its crashing when:
i enter cave
i load existing world - creating new world is fine but when i disconnect and resume it teleports my character to some random spot and after few seconds crash server.
here is code for component:
--blood.lua
local Blood = Class(function(self, inst)
self.inst = inst
self.max = 100
self.current = 0
end)
function Blood:OnSave()
return {currentblood = self.current}
end
function Blood:OnLoad(data)
if data.currentblood then
self.current = data.currentblood
self:DoDelta(0, true)
end
end
--Ustawia aktualna wartosc bloodpoints
function Blood:SetCurrent(amount)
self.current = amount
end
function Blood:GetCurrent()
return self.current
end
return Blood
and i add component to character this way
inst:AddComponent("blood")
its probably something with saving or loading, maybe? idk