forked from Mirrors/openclonk
Refactoring: Fuel
Added parameter to 'GetFuelAmount' that specified how much fuel is requested from this object. Oil is now fuel and only the needed amount is removed instead of removing the entire stack when a producer requests fuel.liquid_container
parent
072f599cdb
commit
f78890142c
|
@ -14,8 +14,9 @@ protected func Hit(x, y)
|
|||
}
|
||||
|
||||
public func IsFuel() { return true; }
|
||||
public func GetFuelAmount()
|
||||
{
|
||||
public func GetFuelAmount(int requested_amount)
|
||||
{
|
||||
// disregard the parameter, because only a complete chunk should be removed
|
||||
if (this != Coal) return GetCon();
|
||||
return 100;
|
||||
}
|
||||
|
|
|
@ -18,8 +18,9 @@ private func Hit()
|
|||
}
|
||||
|
||||
public func IsFuel() { return true; }
|
||||
public func GetFuelAmount()
|
||||
{
|
||||
public func GetFuelAmount(int requested_amount)
|
||||
{
|
||||
// disregard the parameter, because only a complete chunk should be removed
|
||||
if (this != CottonSeed) return GetCon()/2;
|
||||
return 50;
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ private func FindNearWater()
|
|||
/*-- Status --*/
|
||||
|
||||
public func IsFuel() { return !wetness; }
|
||||
public func GetFuelAmount() { return 100; }
|
||||
public func GetFuelAmount(int requested_amount) { return 100; } // disregard the parameter, because only a complete chunk should be removed
|
||||
|
||||
local Collectible = 1;
|
||||
local Name = "$Name$";
|
||||
|
|
|
@ -12,8 +12,9 @@ func Incineration()
|
|||
}
|
||||
|
||||
public func IsFuel() { return true; }
|
||||
public func GetFuelAmount()
|
||||
public func GetFuelAmount(int requested_amount)
|
||||
{
|
||||
// disregard the parameter, because only a complete chunk should be removed
|
||||
if (this != Wood) return GetCon() / 2;
|
||||
return 50;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ public func Incineration()
|
|||
}
|
||||
|
||||
public func IsFuel() { return true; }
|
||||
public func GetFuelAmount() { return 30; }
|
||||
public func GetFuelAmount(int requested_amount) { return 30; } // disregard the parameter, because only a complete chunk should be removed
|
||||
|
||||
// Main bridge object is saved.
|
||||
func SaveScenarioObject() { return false; }
|
||||
|
|
|
@ -8,4 +8,16 @@ func Disperse()
|
|||
_inherited(...);
|
||||
}
|
||||
|
||||
func IsFuel(){ return true;}
|
||||
func GetFuelAmount(int requested_amount)
|
||||
{
|
||||
return Min(requested_amount, GetLiquidAmount());
|
||||
}
|
||||
|
||||
func OnFuelRemoved(int amount)
|
||||
{
|
||||
DoStackCount(-amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
local Name="$Name$";
|
Loading…
Reference in New Issue