forked from Mirrors/openclonk
Object Interation Menu: Request displayed amount from objects
The special handling of the stackable library was moved from the interaction menu to that library. The reasoning behind this is that the menu should not have to know each and every object, but the objects should tell the menu how they are displayed. Liquids are displayed by their liquid count now. It would be even better, if the max. capacity would be displayed without having to hover the description field.liquid_container
parent
8c578931bb
commit
8698aa25cf
|
@ -994,10 +994,7 @@ func FxIntRefreshContentsMenuTimer(target, effect, time)
|
|||
}
|
||||
}
|
||||
// How many objects are this object?!
|
||||
var object_amount = obj->~GetStackCount() ?? 1;
|
||||
// Infinite stacks work differently - showing an arbitrary amount would not make sense.
|
||||
if (object_amount > 1 && obj->~IsInfiniteStackCount())
|
||||
object_amount = 1;
|
||||
var object_amount = obj->~GetInteractionMenuAmount() ?? 1;
|
||||
// Empty containers can be stacked.
|
||||
for (var inv in inventory)
|
||||
{
|
||||
|
|
|
@ -62,6 +62,13 @@ func CannotEnter(object into)
|
|||
}
|
||||
}
|
||||
|
||||
// Tell the interaction menu as how many objects this object should be displayed
|
||||
func GetInteractionMenuAmount()
|
||||
{
|
||||
return GetLiquidAmount();
|
||||
}
|
||||
|
||||
|
||||
// -------------- Manipulation of liquid amount
|
||||
|
||||
func SetLiquidType(string liquid_name)
|
||||
|
|
|
@ -282,3 +282,13 @@ public func SaveScenarioObject(props)
|
|||
props->AddCall("Stack", this, "SetStackCount", GetStackCount());
|
||||
return true;
|
||||
}
|
||||
|
||||
// Tell the interaction menu as how many objects this object should be displayed
|
||||
func GetInteractionMenuAmount()
|
||||
{
|
||||
var object_amount = this->GetStackCount() ?? 1;
|
||||
// Infinite stacks work differently - showing an arbitrary amount would not make sense.
|
||||
if (object_amount > 1 && this->IsInfiniteStackCount())
|
||||
object_amount = 1;
|
||||
return object_amount;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue