damage slow down

This commit is contained in:
Rendo 2025-12-11 22:07:53 +05:00
commit 96f92757b5
9 changed files with 47 additions and 18 deletions

View file

@ -1,5 +1,6 @@
extends Button
signal update_ip(StringName)
func _pressed() -> void:
var upnp = UPNP.new()
@ -7,18 +8,18 @@ func _pressed() -> void:
var discover_error = upnp.discover()
if discover_error != UPNP.UPNPResult.UPNP_RESULT_SUCCESS:
Lobby.update_ip.emit("Discover error: " + str(discover_error as UPNP.UPNPResult))
update_ip.emit("Discover error: " + str(discover_error as UPNP.UPNPResult))
return
var error_udp = upnp.add_port_mapping(Lobby.PORT)
if error_udp != UPNP.UPNPResult.UPNP_RESULT_SUCCESS:
Lobby.update_ip.emit("UDP forward error: " + str(error_udp as UPNP.UPNPResult))
update_ip.emit("UDP forward error: " + str(error_udp as UPNP.UPNPResult))
return
var error_tcp = upnp.add_port_mapping(Lobby.PORT,0,"","TCP")
if error_tcp != UPNP.UPNPResult.UPNP_RESULT_SUCCESS:
Lobby.update_ip.emit("TCP forward error: " + str(error_tcp as UPNP.UPNPResult))
update_ip.emit("TCP forward error: " + str(error_tcp as UPNP.UPNPResult))
return
Lobby.update_ip.emit(upnp.query_external_address())