forked from Mirrors/openclonk
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 limitqteditor
parent
ad74d44943
commit
ffcbdc7fd0
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,11 +121,6 @@ func IsLiquidContainerForMaterial(string liquid)
|
|||
return WildcardMatch("Oil", liquid);
|
||||
}
|
||||
|
||||
func GetLiquidContainerMaxFillLevel()
|
||||
{
|
||||
return 300;
|
||||
}
|
||||
|
||||
func QueryConnectPipe(object pipe)
|
||||
{
|
||||
if (GetNeutralPipe())
|
||||
|
|
Loading…
Reference in New Issue