Fixed producers unit test #7

The problems here were:
- the foundry cannot take 400 water from ice if it has a fill limit
- the pump cannot pump anything into the object if it has no fill limit
qteditor
Mark 2016-05-05 20:58:16 +02:00
parent ad74d44943
commit ffcbdc7fd0
4 changed files with 8 additions and 7 deletions

View File

@ -18,7 +18,7 @@ func MaxStackCount()
{
if (this)
{
if (Contained() && Contained()->~IsLiquidContainer())
if (Contained() && Contained()->~IsLiquidContainer() && Contained()->~GetLiquidContainerMaxFillLevel() > 0)
{
// Stack limit is: [what is already inside the stack] + [free space in the container].
return GetLiquidAmount() + Contained()->~GetLiquidAmountRemaining();

View File

@ -95,8 +95,9 @@ func PutLiquid(string liquid_name, int amount, object source)
FatalError(Format("You can insert positive amounts of liquid only, got %d", amount));
}
var max = this->GetLiquidContainerMaxFillLevel();
var before = GetLiquidAmount(liquid_name);
if (before >= this->GetLiquidContainerMaxFillLevel()) return 0;
if (max > 0 && before >= max) return 0;
var type = GetDefinition(liquid_name);
if (type)

View File

@ -822,6 +822,7 @@ public func IsCollectionAllowed(object item)
// This extremely special case is used by the ice object only, and should be removed in my opinion,
// but it is included for compatibility reasons at the moment.
// TODO
Log("Checking for conversion: queue is %v", queue);
if (item->~CanConvertToLiquidType())
{
for (var queued in queue)
@ -870,6 +871,10 @@ private func ConvertToLiquid(object obj)
if (liquid)
{
liquid->Enter(this);
for (var item in FindObjects(Find_Container(this)))
{
Log("* %v %s", item, item->GetName());
}
obj->RemoveObject();
}
}

View File

@ -121,11 +121,6 @@ func IsLiquidContainerForMaterial(string liquid)
return WildcardMatch("Oil", liquid);
}
func GetLiquidContainerMaxFillLevel()
{
return 300;
}
func QueryConnectPipe(object pipe)
{
if (GetNeutralPipe())