started working on fog darkness
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user