Updated the engine.

This commit is contained in:
Relintai 2022-08-27 01:12:06 +02:00
parent 3d3f0e13e8
commit bb4d9170d7
7 changed files with 33 additions and 19 deletions

2
HEADS
View File

@ -1 +1 @@
{"engine": {"3.2": "64a9e86c5c20bd4bd5833f0563457d0126617489", "3.x": "cdd4f2722a7c16d9e36521d7180cc80715591554"}, "world_generator": {"master": "260c430f11b0b591eaf4714516419aa327d2842c"}, "entity_spell_system": {"master": "3c334566ff05a74e913cd5c5ff38ae45aba5f5d2"}, "ui_extensions": {"master": "80a3b96fc56991a0f88a1d441ed1e3cebaf3307a"}, "texture_packer": {"master": "ae4d222fbaade063ed6f0bc9f3aaa53df68a7fed"}, "fastnoise": {"master": "46bb1f610bfb7171613b5c708d312bcf94e89356"}, "thread_pool": {"master": "c401b7a027248158dae3fbce20d637d34eaaedb9"}, "mesh_data_resource": {"master": "2bf76b8d07c2821161886ea4ea6edc788ec2ee51"}, "mesh_utils": {"master": "902dae29797789d406faf256a22aa73b7f6d5261"}, "props": {"master": "2afd6eff45f9a921bdf4090ff3029def86df5cb5"}, "terraman_2d": {"master": "b547515ae3817b0088e2cf499af59c8f1dee7189"}, "broken_seals_module": {"master": "52c5a81350db1c29d375c63d95010260911ec034"}, "rtile_map": {"master": "389070cfef387b69902e23e6c4ac53997b69e42e"}, "pandemonium_engine": {"master": "cdbcabc96b7571e16c5c16bf2021474cda7af3f9"}}
{"engine": {"3.2": "64a9e86c5c20bd4bd5833f0563457d0126617489", "3.x": "cdd4f2722a7c16d9e36521d7180cc80715591554"}, "world_generator": {"master": "260c430f11b0b591eaf4714516419aa327d2842c"}, "entity_spell_system": {"master": "3c334566ff05a74e913cd5c5ff38ae45aba5f5d2"}, "ui_extensions": {"master": "80a3b96fc56991a0f88a1d441ed1e3cebaf3307a"}, "texture_packer": {"master": "ae4d222fbaade063ed6f0bc9f3aaa53df68a7fed"}, "fastnoise": {"master": "46bb1f610bfb7171613b5c708d312bcf94e89356"}, "thread_pool": {"master": "c401b7a027248158dae3fbce20d637d34eaaedb9"}, "mesh_data_resource": {"master": "2bf76b8d07c2821161886ea4ea6edc788ec2ee51"}, "mesh_utils": {"master": "902dae29797789d406faf256a22aa73b7f6d5261"}, "props": {"master": "2afd6eff45f9a921bdf4090ff3029def86df5cb5"}, "terraman_2d": {"master": "b547515ae3817b0088e2cf499af59c8f1dee7189"}, "broken_seals_module": {"master": "52c5a81350db1c29d375c63d95010260911ec034"}, "rtile_map": {"master": "389070cfef387b69902e23e6c4ac53997b69e42e"}, "pandemonium_engine": {"master": "8277e890753f9a937255a0a3fe271c9a59933675"}}

View File

@ -49,6 +49,11 @@ func _ready() -> void:
get_tree().connect("connection_failed", self, "_connection_failed")
get_tree().connect("server_disconnected", self, "_server_disconnected")
rpc_config("cset_seed", MultiplayerAPI.RPC_MODE_REMOTE)
rpc_config("crequest_select_class", MultiplayerAPI.RPC_MODE_REMOTE)
rpc_config("cspawn_player", MultiplayerAPI.RPC_MODE_REMOTESYNC)
rpc_config("sreceive_upload_character", MultiplayerAPI.RPC_MODE_MASTER)
func start_hosting(p_port : int = 0) -> int:
if p_port == 0:
@ -154,7 +159,7 @@ func sset_seed(pseed):
if multiplayer.has_network_peer() and multiplayer.is_network_server():
rpc("cset_seed", _sseed)
remote func cset_seed(pseed):
func cset_seed(pseed):
_cseed = pseed
@ -169,7 +174,7 @@ func set_class():
else:
crequest_select_class(local_player_master.my_info)
remote func crequest_select_class(info : Dictionary) -> void:
func crequest_select_class(info : Dictionary) -> void:
# Logger.verbose("NetworkManager crequest_select_class")
if get_tree().is_network_server():
@ -181,7 +186,7 @@ remote func crequest_select_class(info : Dictionary) -> void:
rpc("cspawn_player", info, sid, Vector3(10, 10, 10))
remotesync func cspawn_player(info : Dictionary, sid : int, pos : Vector3):
func cspawn_player(info : Dictionary, sid : int, pos : Vector3):
# Logger.verbose("NetworkManager cspawn_player")
if sid == get_tree().get_network_unique_id():
@ -208,7 +213,7 @@ remotesync func cspawn_player(info : Dictionary, sid : int, pos : Vector3):
func upload_character(data : String) -> void:
rpc_id(1, "sreceive_upload_character", data)
master func sreceive_upload_character(data: String) -> void:
func sreceive_upload_character(data: String) -> void:
ESS.get_ess_entity_spawner().spawn_networked_player_from_data(data, Vector3(0, 10, 0), multiplayer.get_rpc_sender_id())
func set_terrarin_player():

View File

@ -87,6 +87,10 @@ var visibility_update_timer : float = 0
var _nameplate : Node = null
func _ready():
rpc_config("sset_position", MultiplayerAPI.RPC_MODE_REMOTE)
rpc_config("cset_position", MultiplayerAPI.RPC_MODE_REMOTE)
func _enter_tree() -> void:
world = get_node(world_path) as Node2D
camera = get_node_or_null("Camera") as Camera2D
@ -517,14 +521,14 @@ func on_diesd(entity):
#set_physics_process(false)
remote func sset_position(pposition : Vector2) -> void:
func sset_position(pposition : Vector2) -> void:
if multiplayer.network_peer and multiplayer.is_network_server():
entity.vrpc("cset_position", position)
if _controlled:
cset_position(position)
remote func cset_position(pposition : Vector2) -> void:
func cset_position(pposition : Vector2) -> void:
pposition = pposition

View File

@ -38,6 +38,8 @@ func _ready():
set_physics_process(true)
rpc_config("set_position_remote", MultiplayerAPI.RPC_MODE_REMOTE)
func _physics_process(delta):
# if (multiplayer.has_network_peer() and multiplayer.is_network_server()) or not multiplayer.has_network_peer():
if multiplayer.has_network_peer() and multiplayer.is_network_server():
@ -67,8 +69,8 @@ func update_visibility() -> void:
#warning-ignore:unassigned_variable
var used_to_see : Array = Array()
for i in range(sees_gets_count()):
var ent : Entity = sees_gets(i)
for i in range(sees_get_count()):
var ent : Entity = sees_get(i)
used_to_see.append(ent)
@ -90,7 +92,7 @@ func update_visibility() -> void:
if self.get_network_master() != 1:
ESS.entity_spawner.despawn_for(self, ent)
sees_removes(ent)
sees_remove(ent)
for e in currenty_sees_filtered:
var ent : Entity = e as Entity
@ -98,10 +100,10 @@ func update_visibility() -> void:
if self.get_network_master() != 1:
ESS.entity_spawner.spawn_for(self, ent)
sees_adds(ent)
sees_add(ent)
remote func set_position_remote(pos : Vector2) -> void:
func set_position_remote(pos : Vector2) -> void:
if get_tree().is_network_server():
rpc("set_position_remote", pos)
#print(position)

View File

@ -44,7 +44,11 @@ func _ready():
# get_tree().connect("connected_to_server", self, "_connected_ok")
# get_tree().connect("connection_failed", self, "_connected_fail")
# get_tree().connect("server_disconnected", self, "_server_disconnected")
pass
rpc_config("creceive_spawn_for", MultiplayerAPI.RPC_MODE_REMOTE)
rpc_config("creceive_despawn_for", MultiplayerAPI.RPC_MODE_REMOTE)
rpc_config("spawn_owned_player", MultiplayerAPI.RPC_MODE_PUPPET)
rpc_config("register_player", MultiplayerAPI.RPC_MODE_REMOTE)
func on_network_peer_packet(id : int, packet : PoolByteArray) ->void:
#todo
@ -58,7 +62,7 @@ func despawn_for(player : Entity, target: Entity) -> void:
print("despawnfor " + target.name)
# rpc_id(player.get_network_master(), "creceive_despawn_for", target.get_path())
remote func creceive_spawn_for(data: String, global_name : String, position: Vector3) -> Entity:
func creceive_spawn_for(data: String, global_name : String, position: Vector3) -> Entity:
var createinfo : EntityCreateInfo = EntityCreateInfo.new()
createinfo.player_name = global_name
@ -73,14 +77,14 @@ remote func creceive_spawn_for(data: String, global_name : String, position: Vec
return createinfo.created_entity
remote func creceive_despawn_for(path : NodePath) -> void:
func creceive_despawn_for(path : NodePath) -> void:
# print("recdespawnfor " + path)
var ent = get_tree().root.get_node_or_null(path)
if ent:
ent.queue_free()
puppet func spawn_owned_player(data : String, position : Vector3) -> Entity:
func spawn_owned_player(data : String, position : Vector3) -> Entity:
var createinfo : EntityCreateInfo = EntityCreateInfo.new()
createinfo.guid = get_tree().multiplayer.get_network_unique_id()
@ -290,7 +294,7 @@ func _server_disconnected():
func _connected_fail():
pass # Could not even connect to server; abort.
remote func register_player(id, info):
func register_player(id, info):
# Store the info
# player_info[id] = info
# If I'm the server, let the new guy know about existing players.

View File

@ -233,7 +233,6 @@ EntitySpawner="*res://player/bs_entity_spawner.tscn"
gdscript/completion/autocomplete_setters_and_getters=true
gdscript/warnings/unused_argument=false
gdscript/warnings/unused_signal=false
gdscript/warnings/return_value_discarded=false
gdscript/warnings/integer_division=false
[display]

View File

@ -52,7 +52,7 @@ func setup(pos : Vector2, color : Color, value : int, crit : bool) -> void:
world_position = pos
text = str(value)
add_color_override("font_color", color)
add_theme_color_override("font_color", color)
if crit:
animation_player.play("crit")