feat: enforce activity site capacity
This commit is contained in:
@@ -395,6 +395,18 @@ func synchronize_npc_position(npc_id: int, active_position: Vector3) -> bool:
|
||||
return false
|
||||
|
||||
|
||||
func get_activity_target_claim_count(target_id: StringName, except_npc_id: int = -1) -> int:
|
||||
var count := 0
|
||||
for npc in npcs:
|
||||
if npc.id == except_npc_id or npc.is_dead:
|
||||
continue
|
||||
if npc.target_id != target_id:
|
||||
continue
|
||||
if npc.task_state in [SimNPC.TASK_STATE_TRAVELING, SimNPC.TASK_STATE_WORKING]:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
|
||||
func _npc_inventory_id(npc_id: int) -> StringName:
|
||||
return StringName("npc_%d_inventory" % npc_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user