forked from Mirrors/openclonk
Add user action: Set clonk inventory size
parent
71b337fd59
commit
729489e40d
|
@ -1188,5 +1188,18 @@ func Definition(def) {
|
|||
{ Value=3, Name="Farmer"}
|
||||
]};
|
||||
|
||||
UserAction->AddEvaluator("Action", "Clonk", "$SetMaxContentsCount$", "$SetMaxContentsCountHelp$", "clonk_set_max_contents_count", [def, def.EvalAct_SetMaxContentsCount], { }, { Type="proplist", Display="{{Target}}: {{MaxContentsCount}}", EditorProps = {
|
||||
Target = UserAction->GetObjectEvaluator("IsClonk", "Clonk"),
|
||||
MaxContentsCount = new UserAction.Evaluator.Integer { Name="$MaxContentsCount$", EmptyName = Format("$Default$ (%d)", def.MaxContentsCount) }
|
||||
} } );
|
||||
|
||||
_inherited(def);
|
||||
}
|
||||
|
||||
private func EvalAct_SetMaxContentsCount(proplist props, proplist context)
|
||||
{
|
||||
// Set max contents count. nil defaults to Clonk.MaxContentsCount.
|
||||
var clonk = UserAction->EvaluateValue("Object", props.Target, context);
|
||||
var number = BoundBy(UserAction->EvaluateValue("Integer", props.MaxContentsCount, context) ?? clonk->GetID().MaxContentsCount, 0, 10);
|
||||
if (clonk) clonk->~SetMaxContentsCount(number);
|
||||
}
|
||||
|
|
|
@ -10,3 +10,8 @@ TxtDescend=Abspringen
|
|||
TxtEnergysupply=Energieversorgung
|
||||
|
||||
MsgDeadClonk=%s ist tot.|Es sind keine Interaktionen möglich.
|
||||
|
||||
SetMaxContentsCount=Inventarplatzzahl aendern
|
||||
SetMaxContentsCountHelp=Aendert die maximale Anzahl an Objekten, die der Clonk tragen kann. Gueltige Werte von 0 bis 10. Ein zusaetzliches CarryHeavy-Objekt kann immer getragen werden.
|
||||
MaxContentsCount=Anzahl Inventarplaetze
|
||||
Default=Standard
|
||||
|
|
|
@ -10,3 +10,8 @@ TxtDescend=Jump off
|
|||
TxtEnergysupply=Energy supply
|
||||
|
||||
MsgDeadClonk=%s is dead.|No interactions are possible.
|
||||
|
||||
SetMaxContentsCount=Change inventory size
|
||||
SetMaxContentsCountHelp=Modifies the maximum number of items a clonk can carry. Valid values range from 0 to 10. One additional carry-heavy object can always be carried.
|
||||
MaxContentsCount=Inventory slot count
|
||||
Default=Default
|
||||
|
|
|
@ -517,6 +517,6 @@ public func SetMaxContentsCount(int new_count)
|
|||
}
|
||||
}
|
||||
// Update GUI
|
||||
this->~ScheduleUpdateInventory();
|
||||
this->~OnInventoryChange();
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue