refactor: clarify simulation ownership
This commit is contained in:
@@ -57,10 +57,12 @@ func get_total_amount() -> float:
|
||||
return total
|
||||
|
||||
|
||||
func get_available_capacity() -> float:
|
||||
return maxf(float(data["capacity"]) - get_total_amount(), 0.0)
|
||||
|
||||
|
||||
func deposit(item_id: StringName, requested_amount: float) -> float:
|
||||
var accepted := minf(
|
||||
maxf(requested_amount, 0.0), maxf(float(data["capacity"]) - get_total_amount(), 0.0)
|
||||
)
|
||||
var accepted := minf(maxf(requested_amount, 0.0), get_available_capacity())
|
||||
if accepted <= 0.0:
|
||||
return 0.0
|
||||
data["amounts"][String(item_id)] = get_amount(item_id) + accepted
|
||||
|
||||
Reference in New Issue
Block a user