mirror of
https://github.com/kristoferssolo/FuncIt.git
synced 2025-10-21 19:30:35 +00:00
[Minimal] Synchronization adjustments
This commit is contained in:
parent
63621fa52f
commit
c93281adc5
@ -84,6 +84,7 @@ var particleTexture = ImageTexture.new()
|
||||
var particleImage = Image.new()
|
||||
|
||||
var globalActivePhase = null
|
||||
var clientPhase = null
|
||||
|
||||
func _ready():
|
||||
|
||||
@ -144,7 +145,6 @@ func process_rotation():
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
globalActivePhase = Global.phase_update_global()
|
||||
$"weaponHolder/Player-character-theme-gun".play(theme)
|
||||
particleImage.load("res://source/assets/sprites/character/player/theme/" + theme + "/na/Player-character-theme-particle-"+theme+".png")
|
||||
particleTexture.create_from_image(particleImage)
|
||||
@ -256,8 +256,10 @@ func _physics_process(delta) -> void:
|
||||
rpc("shoot", trajectory, get_tree().get_network_unique_id())
|
||||
is_reloading = true
|
||||
reload_timer.start()
|
||||
globalActivePhase = Global.phase_update_global()
|
||||
clientPhase = Global.get_client_phase()
|
||||
else:
|
||||
|
||||
Global.phase_update_puppet(clientPhase)
|
||||
rotation = lerp_angle(rotation, puppet_rotation, delta * 8)
|
||||
$"weaponHolder/Player-character-theme-gun".position = puppet_weapon_position
|
||||
weaponAngle = puppet_weapon_angle
|
||||
|
||||
@ -7,22 +7,22 @@ var alive_players = []
|
||||
var clientPhase = {
|
||||
"0": {
|
||||
"phase_name": "Movement phase",
|
||||
"length": 10,
|
||||
"length": 2,
|
||||
"start_time": null
|
||||
},
|
||||
"1": {
|
||||
"phase_name": "Weapon adjustment phase",
|
||||
"length": 20,
|
||||
"length": 2,
|
||||
"start_time": null
|
||||
},
|
||||
"2": {
|
||||
"phase_name": "Bullet simulation phase",
|
||||
"length": 5,
|
||||
"length": 2,
|
||||
"start_time": null
|
||||
},
|
||||
"3": {
|
||||
"phase_name": "Idle phase",
|
||||
"length": 5,
|
||||
"length": 2,
|
||||
"start_time": null
|
||||
}
|
||||
}
|
||||
@ -35,7 +35,7 @@ func phase_update_global():
|
||||
if gameStart:
|
||||
if activePhase != null:
|
||||
if clientPhase[str(activePhase)]["start_time"] != null:
|
||||
if currentTime["second"] - clientPhase[str(activePhase)]["start_time"]["second"] > clientPhase[str(activePhase)]["length"]:
|
||||
if currentTime["second"] + currentTime["minute"] * 60 - clientPhase[str(activePhase)]["start_time"]["second"] - clientPhase[str(activePhase)]["start_time"]["minute"] * 60 > clientPhase[str(activePhase)]["length"]:
|
||||
if activePhase + 1 == clientPhase.size():
|
||||
clientPhase[str(activePhase)]["start_time"] = null
|
||||
activePhase = 0
|
||||
@ -51,6 +51,13 @@ func start_game():
|
||||
gameStart = true
|
||||
pass
|
||||
|
||||
func get_client_phase():
|
||||
return {"clientPhase": clientPhase, "activePhase": activePhase, "gameStart": gameStart, "currentTime": currentTime}
|
||||
|
||||
func phase_update_puppet(phase):
|
||||
clientPhase = phase["clientPhase"]
|
||||
activePhase = phase["activePhase"]
|
||||
|
||||
func instance_node_at_location(node: Object, parent: Object, location: Vector2) -> Object:
|
||||
var node_instance = instance_node(node, parent)
|
||||
node_instance.global_position = location
|
||||
|
||||
@ -33,5 +33,5 @@ func _on_timer_timeout():
|
||||
|
||||
|
||||
func _process(delta):
|
||||
globalActivePhase = Global.phase_update_global()
|
||||
$timer.text = str(globalActivePhase["phase_name"])
|
||||
globalActivePhase = Global.get_client_phase()
|
||||
$timer.text = str(globalActivePhase["clientPhase"][str(globalActivePhase["activePhase"])]["phase_name"])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user