I started modifing the "Fill level warning" mod, first I add the specialization to vehicles that has the Baler specialization
Code: Select all
local modName = g_currentModName;
function injectSpecialization()
local modNameSpecName = modName .. "." .. "fillLevelWarning"
for vehicleTypeName, vehicleType in pairs(g_vehicleTypeManager.types) do
if SpecializationUtil.hasSpecialization(Baler, vehicleType.specializations) then
print("DEBUG: registred specialization")
g_vehicleTypeManager:addSpecialization(vehicleTypeName, modNameSpecName)
end
end
end
TypeManager.validateTypes = Utils.appendedFunction(TypeManager.validateTypes, function(self)
if self.typeName == "vehicle" then
injectSpecialization()
end
end)
Code: Select all
function fillLevelWarning:onUpdate(dt)
local fillLevel = self:getFillUnitFillLevelPercentage(1)
if fillLevel ~= nil then
if fillLevel >= 0.99 then
if not self.notified then
print("DEBUG: fill level 99%")
self.notified = true
end
else
self.notified = false
end
end
end
Thanks to anyone trying to help me.
Edit don_apple: topic moved from "General Discussion" to "Modding", since it is about creating/changing a mod and not about the game itself.