Implemented Pillbug/Mosquito actions. Implemented pre-game settings. TODO: Game settings + bug testing

This commit is contained in:
Sch1nken 2024-03-30 01:43:38 +01:00
parent 397082f966
commit 2343638749
15 changed files with 477 additions and 70 deletions

View file

@ -11,9 +11,9 @@ const default_insects = {
preload("res://Tile/Prefabs/Beetle.tres"): 2,
preload("res://Tile/Prefabs/Grasshopper.tres"): 3,
preload("res://Tile/Prefabs/Spider.tres"): 2,
preload("res://Tile/Prefabs/Ladybug.tres"): 1,
preload("res://Tile/Prefabs/Mosquito.tres"): 1,
preload("res://Tile/Prefabs/Pillbug.tres"): 1
#preload("res://Tile/Prefabs/Ladybug.tres"): 1,
#preload("res://Tile/Prefabs/Mosquito.tres"): 1,
#preload("res://Tile/Prefabs/Pillbug.tres"): 1
}
var local_bee_button: InsectButton
@ -96,19 +96,33 @@ func setup_colors(is_host_black: bool) -> void:
# Called when the node enters the scene tree for the first time.
func _ready():
GameEvents.game_started.connect(_on_game_started)
func _on_game_started() -> void:
if multiplayer.is_server():
setup_colors.rpc(false)
print("HOST BLACK?")
print(GameData.is_host_black)
setup_colors.rpc(GameData.is_host_black)
add_insect.rpc("res://Tile/Prefabs/Bee.tres", 1, false, 1)
add_spacer.rpc(false, 1)
add_insect.rpc("res://Tile/Prefabs/Bee.tres", 1, GameData.is_host_black, 1)
add_spacer.rpc(GameData.is_host_black, 1)
add_insect.rpc("res://Tile/Prefabs/Bee.tres", 1, true, GameData.peer_id)
add_spacer.rpc(true, GameData.peer_id)
add_insect.rpc("res://Tile/Prefabs/Bee.tres", 1, !GameData.is_host_black, GameData.peer_id)
add_spacer.rpc(!GameData.is_host_black, GameData.peer_id)
var insects = default_insects.duplicate()
if GameData.use_ladybug_extension:
insects[preload("res://Tile/Prefabs/Ladybug.tres")] = 1
if GameData.use_mosquito_extension:
insects[preload("res://Tile/Prefabs/Mosquito.tres")] = 1
if GameData.use_pillbug_extension:
insects[preload("res://Tile/Prefabs/Pillbug.tres")] = 1
#remote_bee_button.set_authority.rpc(GameData.peer_id)
for key in default_insects.keys():
add_insect.rpc(key.get_path(), default_insects[key], false, 1)
add_insect.rpc(key.get_path(), default_insects[key], true, GameData.peer_id)
for key in insects.keys():
add_insect.rpc(key.get_path(), insects[key], GameData.is_host_black, 1)
add_insect.rpc(key.get_path(), insects[key], !GameData.is_host_black, GameData.peer_id)
#add_insect.rpc("res://Tile/Prefabs/Ant.tres", 1, false, GameData.peer_id)
reverse_enemy_list.rpc()
@ -150,8 +164,7 @@ func _ready():
if multiplayer.is_server():
btn.set_authority.rpc(GameData.peer_id)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
func _input(event):
if Input.is_action_just_pressed("deselect_tile"):
GameEvents.insect_placement_cancelled.emit()
pass