started working on fog darkness

This commit is contained in:
2026-01-13 00:16:08 +01:00
parent 82a70aa6a2
commit 89a41397d1
30 changed files with 1613 additions and 386 deletions

View File

@@ -544,6 +544,18 @@ func _request_pickup(player_peer_id: int):
print("Loot: _request_pickup called on non-server, ignoring")
return
# Check cooldown: prevent player from picking up their own dropped item for 5 seconds
if has_meta("dropped_by_peer_id") and has_meta("drop_time"):
var dropped_by_peer_id = get_meta("dropped_by_peer_id")
var drop_time = get_meta("drop_time")
var current_time = Time.get_ticks_msec()
var time_since_drop = (current_time - drop_time) / 1000.0 # Convert to seconds
if player_peer_id == dropped_by_peer_id and time_since_drop < 5.0:
# Player can't pick up their own dropped item for 5 seconds
print("Loot: Player ", player_peer_id, " cannot pick up item they dropped (", time_since_drop, "s ago, need 5s cooldown)")
return
# Use mutex to prevent concurrent processing (race condition protection)
if processing_pickup:
print("Loot: Pickup already being processed, ignoring duplicate request")