Pawn bodies split out, character select redesigned, and started the dreaded process of correcting the netcode. Players can connect to a shared room, character select, and start a match. They appear correctly differentiated with cameras and map icons that follow them independently. Jankiness with trap ownership is present as is stuff connected to animation. Unit tests for all network functionality required.
This commit is contained in:
@@ -7,6 +7,16 @@ enum Modes{
|
||||
VS_MAN
|
||||
}
|
||||
|
||||
|
||||
var pawns : Dictionary = {
|
||||
"A" : load("res://data/pawns/a.tres"),
|
||||
"B" : load("res://data/pawns/b.tres"),
|
||||
"C" : load("res://data/pawns/c.tres"),
|
||||
"D" : load("res://data/pawns/d.tres"),
|
||||
"E" : load("res://data/pawns/e.tres"),
|
||||
"F" : load("res://data/pawns/f.tres")
|
||||
}
|
||||
|
||||
const blinder_template = preload("res://templates/blinder.tscn")
|
||||
const one_shot_template = preload("res://templates/one_shot.tscn")
|
||||
|
||||
@@ -15,13 +25,14 @@ const vs_com_level = preload("res://scenes/test_level.tscn")
|
||||
const vs_man_level = preload("res://scenes/manufactory.tscn")
|
||||
const pawn_select_scene = preload("res://scenes/character_select.tscn")
|
||||
|
||||
var cmd_args : Dictionary = {}
|
||||
var player : PawnController
|
||||
var hud : HUD
|
||||
var level : Level
|
||||
var mode : Modes = Modes.STORY
|
||||
var multiplayer_game : bool = false
|
||||
var num_players : int = 1
|
||||
var pawns_selected : Dictionary[int, PawnBaseData] = {}
|
||||
var pawns_selected : Dictionary[int, StringName] = {}
|
||||
var level_synced : Dictionary[int, bool] = {}
|
||||
var net_test : bool #TODO: Remove later
|
||||
|
||||
@@ -30,16 +41,21 @@ func _ready() -> void:
|
||||
for arg in OS.get_cmdline_args():
|
||||
if arg.begins_with("--"):
|
||||
var flag = arg.lstrip("--")
|
||||
if flag.contains("="):
|
||||
var key_val = flag.split("=")
|
||||
args[key_val[0]]=key_val[1]
|
||||
args[flag]=true
|
||||
if args.has("net_test"):
|
||||
net_test = true
|
||||
|
||||
if args.has("instance_id"):
|
||||
get_tree().root.title = "Net Gunner (Instance: %s)" % args.instance_id
|
||||
cmd_args = args
|
||||
|
||||
func setup_player(pc : PawnController) -> void:
|
||||
var is_local = false
|
||||
Game.level.pawns[pc.id] = pc
|
||||
if pc.id == Multiplayer.id:
|
||||
is_local = true
|
||||
level.pawns[pc.id] = pc
|
||||
if is_local:
|
||||
player = pc
|
||||
if hud:
|
||||
@@ -49,10 +65,11 @@ func is_multiplayer() -> bool:
|
||||
return multiplayer_game
|
||||
|
||||
|
||||
func start_level(pawns : Dictionary[int, PawnBaseData]) -> void:
|
||||
func start_level(pawns : Dictionary[int, StringName]) -> void:
|
||||
pawns_selected = pawns
|
||||
if !Multiplayer.is_host():
|
||||
return
|
||||
pawns_selected = pawns
|
||||
|
||||
for i in Multiplayer.players.values():
|
||||
level_synced[i] = false
|
||||
level_synced[1] = true
|
||||
@@ -117,7 +134,6 @@ func level_spawned(peer_id : int) -> void:
|
||||
level_synced[peer_id] = true
|
||||
check_level_ready()
|
||||
|
||||
|
||||
func check_level_ready() -> void:
|
||||
var ready : bool = true
|
||||
for id in level_synced:
|
||||
|
||||
Reference in New Issue
Block a user