Code: Select all
function Create()
Object.SetProperty( "Stock", 32.0);
Object.SetProperty("StockType", "WaterBottle" );
Object.SetProperty("NeedsLoading", false);
Object.SetProperty("Count", 0.0);
Object.SetProperty("CurrentDrink", "WaterBottle");
Object.SetProperty("IsLoaded", true);
end
function Update( timePassed )
if Object.GetProperty("IsLoaded") == nil then
Create();
end
local currentStock = tonumber(Object.GetProperty("Stock"));
local count = tonumber(Object.GetProperty("Count"));
local nearbyPrisoner = this.GetNearbyObjects("Prisoner",10);
local pCounter = 0
count = count + timePassed;
Object.SetProperty("Count", count);
if count > 10.0 then
if currentStock > 0.0 then
nearbyPrisoner = this.GetNearbyObjects("Prisoner",10)
if pCounter > 0 then
Object.GetProperty("CurrentDrink");
local currentDrink = Object.Spawn( "WaterBottle", Object.GetProperty("Pos.x"), Object.GetProperty("Pos.y"));
Object.SetProperty("CurrentDrink", currentDrink);
Object.SetProperty( "Stock", currentStock - 1 );
end
end
end
Object.SetProperty("Count", 0.0);
if currentStock < 1.0 then
Object.SetProperty( "NeedsLoading", true );
end
this.Tooltip = tostring(Object.GetProperty("Stock")) .. " Water Bottles Left."
if Object.GetProperty("NeedsLoading") then
Object.GetProperty("CurrentDrink");
Object.SetProperty("CurrentDrink", "WaterBottle");
Object.CreateJob("LoadCooler");
Object.SetProperty("Tooltip", "job_custom_loadcooler");
end
if count > 2.0 then
nearbyPrisoner = this.GetNearbyObjects("Prisoner",10)
if count > 4.0 then
nearbyPrisoner = this.GetNearbyObjects("Prisoner",10)
if count > 6.0 then
nearbyPrisoner = this.GetNearbyObjects("Prisoner",10)
if count > 8.0 then
nearbyPrisoner = this.GetNearbyObjects("Prisoner",10)
end
end
end
end
for table, distance in pairs(nearbyPrisoner) do
pCounter = pCounter + 1
end
end
It doesn't say there is a problem, but the water cooler no longer spouts out water bottle, AND slows down the game now dramatically when there are only 16 prisoners -.- What have i done??