Player changes + projectile fixes

This commit is contained in:
dingo
2026-01-19 15:21:56 -05:00
parent 88737d51c4
commit cefa1cf716
9 changed files with 92 additions and 32 deletions
+14 -1
View File
@@ -120,6 +120,10 @@ func get_state_name() -> String:
return STATE_NAMES[current_state] if current_state < STATE_NAMES.size() else "UNKNOWN"
func _on_message_received(opcode: int, data: Dictionary):
# Debug: log projectile-related opcodes
if opcode == 504 or opcode == 505 or opcode == 506:
print("[GameState] !!!!! Received projectile opcode: ", opcode, " !!!!!")
match opcode:
OpCodes.AUTH_LOGIN_RESULT, OpCodes.AUTH_REGISTER_RESULT:
_handle_auth_result(data)
@@ -768,8 +772,17 @@ func _handle_tile_update(data: Dictionary):
dungeon_tiles_updated.emit(tiles)
func _handle_projectile_spawned(data: Dictionary):
print("[GameState] Projectile spawned: ", data.get("id", -1))
print("[GameState] ===== PROJECTILE SPAWNED EVENT =====")
print("[GameState] Projectile ID: ", data.get("id", -1))
print("[GameState] Position: (", data.get("x", 0), ", ", data.get("y", 0), ")")
print("[GameState] Velocity: (", data.get("vx", 0), ", ", data.get("vy", 0), ")")
print("[GameState] Sprite: ", data.get("sprite", ""))
print("[GameState] Linear: ", data.get("isLinear", false))
print("[GameState] Full data: ", data)
print("[GameState] Emitting projectile_spawned signal")
projectile_spawned.emit(data)
print("[GameState] ===== END PROJECTILE SPAWNED =====")
func _handle_projectile_hit(data: Dictionary):
print("[GameState] Projectile hit: ", data)
+2 -2
View File
@@ -104,7 +104,7 @@ func disconnect_from_server():
## @param opcode: Message type identifier (see opcodes.gd)
## @param data: Dictionary of message data to send
func send_message(opcode: int, data: Dictionary = {}):
print("[Network] Send Message Called to send opCode: ", opcode)
#print("[Network] Send Message Called to send opCode: ", opcode)
if not _is_connected:
push_warning("[Network] Cannot send message - not connected")
return
@@ -188,7 +188,7 @@ func _handle_received_data(packet: PackedByteArray):
var message = json.data
var opcode: int = message.get("opCode", message.get("OpCode", 0))
print("[Network] OpCode Recieved: ", opcode)
#print("[Network] OpCode Recieved: ", opcode)
# Decode payload
var payload_data = message.get("payload", message.get("Payload", null))
var decoded_data = {}