forked from Mirrors/openclonk
barrel: prevent entrance of arbitrary objects
You could put e.g. tools into the barrel using the interaction menu. This would lead to a script error later, when the barrel did Contents()->GetLiquidType(). PS: And the RejectStack function is part of a private internal interface. I made that clear so the next one does not have to look it up again.qteditor
parent
acde7c923a
commit
58bb6af75a
|
@ -43,7 +43,7 @@ func CollectFromStack(object item)
|
|||
}
|
||||
}
|
||||
|
||||
func RejectStack(object item)
|
||||
private func RejectStack(object item)
|
||||
{
|
||||
// Callback from stackable object: When should a stack entrance be rejected, if the object was not merged into the existing stacks?
|
||||
if (Contents())
|
||||
|
@ -63,6 +63,13 @@ func RejectStack(object item)
|
|||
}
|
||||
}
|
||||
|
||||
public func RejectCollect(id def, object new_contents)
|
||||
{
|
||||
// The barrel can only contain liquids.
|
||||
if (RejectStack(new_contents)) return true;
|
||||
return _inherited(def, new_contents, ...);
|
||||
}
|
||||
|
||||
private func Hit()
|
||||
{
|
||||
this->PlayBarrelHitSound();
|
||||
|
|
Loading…
Reference in New Issue