fixed like 5 bugs
This commit is contained in:
parent
62d0dc0130
commit
6823dff8f7
@ -5,14 +5,13 @@ class_name RocketLauncherWeapon extends ProjectileWeapon
|
||||
@export var targeting_ui_rect: TextureRect
|
||||
|
||||
var target_max: int = 3
|
||||
var targets: Array = []
|
||||
var target_icons: Array = []
|
||||
var targets: Array[EnemyController] = []
|
||||
var target_icons: Array[Sprite3D] = []
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
super._ready()
|
||||
targeting_raycast.global_position = hero.camera.global_position
|
||||
|
||||
target_max = floori(stats.get_attribute("Target Limit"))
|
||||
for x: int in target_max:
|
||||
var icon: Sprite3D = target_icon_scene.instantiate()
|
||||
|
@ -40,6 +40,7 @@ target_position = Vector3(0, 0, -100)
|
||||
collision_mask = 4
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="." index="3"]
|
||||
visible = false
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
|
29
PCs/hero.gd
29
PCs/hero.gd
@ -117,10 +117,10 @@ func _process(delta: float) -> void:
|
||||
equip_weapon()
|
||||
if Input.is_action_just_pressed("Secondary Fire"):
|
||||
swap_weapons()
|
||||
if Input.is_action_just_pressed("Select Next Card"):
|
||||
if Input.is_action_just_pressed("Select Next Card") and inventory.size != 0:
|
||||
increment_selected()
|
||||
$AudioStreamPlayer.play()
|
||||
if Input.is_action_just_pressed("Select Previous Card"):
|
||||
if Input.is_action_just_pressed("Select Previous Card") and inventory.size != 0:
|
||||
decrement_selected()
|
||||
$AudioStreamPlayer.play()
|
||||
if Input.is_action_just_pressed("Primary Fire"):
|
||||
@ -179,17 +179,32 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
if !is_multiplayer_authority() or paused:
|
||||
return
|
||||
if editing_mode and event.is_action_pressed("Ready"):
|
||||
if ready_state:
|
||||
unready_self()
|
||||
else:
|
||||
ready_self()
|
||||
if event.is_action_pressed("Pause"):
|
||||
var menu: PauseMenu = pause_menu_scene.instantiate() as PauseMenu
|
||||
pause()
|
||||
menu.closed.connect(unpause)
|
||||
hud.add_child(menu)
|
||||
|
||||
|
||||
func ready_self() -> void:
|
||||
edit_tool.interact_key_held = false
|
||||
if !ready_state:
|
||||
ready_state = true
|
||||
hud.shrink_wave_start_label()
|
||||
$AudioStreamPlayer.play()
|
||||
networked_set_ready_state.rpc(ready_state)
|
||||
if event.is_action_pressed("Pause"):
|
||||
var menu: PauseMenu = pause_menu_scene.instantiate() as PauseMenu
|
||||
pause()
|
||||
menu.closed.connect(unpause)
|
||||
hud.add_child(menu)
|
||||
|
||||
|
||||
func unready_self() -> void:
|
||||
if ready_state:
|
||||
ready_state = false
|
||||
hud.grow_wave_start_label()
|
||||
$AudioStreamPlayer.play()
|
||||
networked_set_ready_state(ready_state)
|
||||
|
||||
|
||||
func add_card(new_card: Card) -> void:
|
||||
|
@ -51,5 +51,6 @@ selecting_enabled = false
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 3.5
|
||||
one_shot = true
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
|
@ -168,6 +168,7 @@ func networked_spawn_wall(pos: Vector3, name_id: int, caller_id: int) -> void:
|
||||
func networked_remove_wall(new_wall_id: int) -> void:
|
||||
var wall: TowerBase = tower_base_ids[new_wall_id]
|
||||
Game.connected_players_nodes[wall.owner_id].currency += Data.wall_cost
|
||||
Game.connected_players_nodes[wall.owner_id].unready_self()
|
||||
tower_bases.erase(wall)
|
||||
tower_base_ids.erase(new_wall_id)
|
||||
wall.queue_free()
|
||||
|
@ -44,10 +44,10 @@ func _input(event: InputEvent) -> void:
|
||||
if input_line.text.length() != 0:
|
||||
if input_line.text.begins_with("/"):
|
||||
Game.parse_command(input_line.text, multiplayer.get_unique_id())
|
||||
fade_timer.start()
|
||||
else:
|
||||
append_message.rpc(username, color, input_line.text)
|
||||
input_line.clear()
|
||||
fade_timer.start()
|
||||
if event.keycode == KEY_ESCAPE:
|
||||
get_viewport().set_input_as_handled()
|
||||
closed.emit()
|
||||
@ -61,7 +61,7 @@ func change_username(old_name: String, new_name: String) -> void:
|
||||
append_message("SERVER", Color.TOMATO, old_name + " has changed their display name to " + new_name)
|
||||
|
||||
|
||||
@rpc("reliable","call_local","any_peer")
|
||||
@rpc("reliable", "call_local", "any_peer")
|
||||
func append_message(user: String, user_color: Color, content: String) -> void:
|
||||
textbox.append_text("[[color=" + user_color.to_html() + "]" + user + "[color=white]] " + content + "\n")
|
||||
fading = false
|
||||
|
@ -164,7 +164,7 @@ func refund_wall(wall: TowerBase) -> void:
|
||||
func put_card_in_tower_base(tower_base: TowerBase) -> void:
|
||||
if tower_base.has_card:
|
||||
tower_base.remove_card()
|
||||
else:
|
||||
elif inventory.size > 0:
|
||||
var card: Card = inventory.remove_at(hero.inventory_selected_index)
|
||||
if !inventory.contents.has(card):
|
||||
hero.decrement_selected()
|
||||
|
@ -143,11 +143,20 @@ func spawn_players(player_array: Array, player_profiles: Dictionary, chatbox_ope
|
||||
start_game()
|
||||
|
||||
|
||||
func ready_player(_value: int) -> void:
|
||||
func ready_player(player_ready_true: bool) -> void:
|
||||
if !player_ready_true:
|
||||
return
|
||||
var ready_players: int = 0
|
||||
for key: int in connected_players_nodes:
|
||||
if connected_players_nodes[key].ready_state == false:
|
||||
return
|
||||
continue
|
||||
else:
|
||||
ready_players += 1
|
||||
if ready_players == connected_players_nodes.size():
|
||||
spawn_enemy_wave()
|
||||
chatbox.append_message("SERVER", Color.TOMATO, "Wave Started!")
|
||||
else:
|
||||
chatbox.append_message("SERVER", Color.TOMATO, str(ready_players) + "/" + str(connected_players_nodes.size()) + " Players ready")
|
||||
|
||||
|
||||
func spawn_enemy_wave() -> void:
|
||||
@ -262,6 +271,7 @@ func start_game() -> void:
|
||||
set_upcoming_wave()
|
||||
for peer_id: int in connected_players_nodes:
|
||||
connected_players_nodes[peer_id].currency = roundi(float(starting_cash) / float(connected_players_nodes.size()))
|
||||
chatbox.append_message("SERVER", Color.TOMATO, "Started with seed: " + str(rng.seed))
|
||||
game_started.emit()
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@ func add(item: Item) -> bool:
|
||||
else:
|
||||
contents[item] = 1
|
||||
item_added.emit(item)
|
||||
networked_add.rpc(Data.cards.find(item))
|
||||
#networked_add.rpc(Data.cards.find(item))
|
||||
return true
|
||||
return false
|
||||
|
||||
@ -33,7 +33,7 @@ func remove_at(index: int) -> Item:
|
||||
if contents[item] == 0:
|
||||
contents.erase(item)
|
||||
item_removed.emit(item)
|
||||
networked_remove_at.rpc(index)
|
||||
#networked_remove_at.rpc(index)
|
||||
return item
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ func networked_add(value: int) -> void:
|
||||
if contents.has(item):
|
||||
contents[item] += 1
|
||||
else:
|
||||
contents[item] = 0
|
||||
contents[item] = 1
|
||||
item_added.emit(item)
|
||||
|
||||
|
||||
|
@ -15,7 +15,6 @@ class_name Level extends GridMap
|
||||
func generate_obstacles() -> void:
|
||||
#print(str(multiplayer.get_unique_id()) + " spawning obstacles with seed: " + str(Game.rng.seed))
|
||||
var obstacle_count: int = Game.randi_in_range(1, 0, 5)
|
||||
obstacle_count = 3
|
||||
for index: int in obstacle_count:
|
||||
var x: int = Game.randi_in_range(10 * index, 1 - a_star_graph_3d.grid_size.x, a_star_graph_3d.grid_size.x - 1)
|
||||
var y: int = Game.randi_in_range(32 * index, 1 - a_star_graph_3d.grid_size.y, a_star_graph_3d.grid_size.y - 1)
|
||||
|
@ -35,15 +35,11 @@ func set_float(value: float) -> void:
|
||||
$MeshInstance3D.set_instance_shader_parameter("Float", value)
|
||||
|
||||
|
||||
func add_card(card: Card, caller_id: int) -> bool:
|
||||
var result: bool = inventory.add(card)
|
||||
if result:
|
||||
networked_spawn_tower.rpc(caller_id)
|
||||
return result
|
||||
func add_card(card: Card, caller_id: int) -> void:
|
||||
networked_spawn_tower.rpc(Data.cards.find(card), caller_id)
|
||||
|
||||
|
||||
func remove_card() -> void:
|
||||
Game.connected_players_nodes[tower.owner_id].add_card(inventory.remove_at(0))
|
||||
networked_remove_tower.rpc()
|
||||
|
||||
|
||||
@ -72,7 +68,9 @@ func set_west_wall(value: bool) -> void:
|
||||
|
||||
|
||||
@rpc("reliable", "call_local", "any_peer")
|
||||
func networked_spawn_tower(caller_id: int) -> void:
|
||||
func networked_spawn_tower(card_index: int, caller_id: int) -> void:
|
||||
var card: Card = Data.cards[card_index]
|
||||
inventory.add(card)
|
||||
tower = inventory.contents.keys()[0].turret_scene.instantiate() as Tower
|
||||
tower.stats = inventory.contents.keys()[0].tower_stats
|
||||
tower.name = "tower"
|
||||
@ -89,6 +87,8 @@ func networked_spawn_tower(caller_id: int) -> void:
|
||||
|
||||
@rpc("reliable", "call_local", "any_peer")
|
||||
func networked_remove_tower() -> void:
|
||||
Game.connected_players_nodes[tower.owner_id].add_card(inventory.remove_at(0))
|
||||
Game.connected_players_nodes[tower.owner_id].unready_self()
|
||||
tower.queue_free()
|
||||
tower = null
|
||||
minimap_icon.modulate = Color.GREEN
|
||||
|
Loading…
x
Reference in New Issue
Block a user