diff --git a/Maps/BaseLevel.gd b/Maps/BaseLevel.gd index 7df7a2a..053dc29 100644 --- a/Maps/BaseLevel.gd +++ b/Maps/BaseLevel.gd @@ -11,16 +11,15 @@ export var capture_mod = false # author , INC = "preinstalled" export var author = "INC" +var team1 = preload("res://Objects/scripts/Team.gd").new(0,self) +var team2 = preload("res://Objects/scripts/Team.gd").new(1,self) +var teamSelector = load("res://Objects/Game_modes/BombDiffuse/BomTeamSelect.tscn") +var spec_mode = preload("res://Objects/Game_modes/Spectate.tscn").instance() +var dropedItem_manager = preload("res://Objects/Misc/DropedItemManager.tscn").instance() -var team1 = preload("res://Objects/scripts/Team.gd").new(0,self) -var team2 = preload("res://Objects/scripts/Team.gd").new(1,self) - -var teamSelector = null -var spec_mode = preload("res://Objects/Game_modes/Spectate.tscn").instance() -var dropedItem_manager = preload("res://Objects/Misc/DropedItemManager.tscn").instance() - -var spawned_units = Array() -var spawn_points = Array() +var spawned_units = Array() +var spawn_points = Array() +var is_server = false #Unit attiributes var unit_data_dict = { @@ -44,10 +43,6 @@ var spawned_units_ids = Array() func _ready(): MusicMan.music_player.stop() - if capture_mod: - captureMap() - return - if not game_states.game_settings.shadows: $BaseMap/shadow.hide() @@ -60,20 +55,22 @@ func _ready(): game_server._unit_data_list.clear() spawn_points = get_tree().get_nodes_in_group("SpawnPoint") network.connect("disconnected", self, "_on_disconnected") + loadGameMode() - #handle team selector add_child(teamSelector) teamSelector.connect("team_selected",self,"_on_player_selected_team") teamSelector.connect("spectate_mode",self,"_on_specmode_selected") spec_mode.connect("leave_spec_mode",self,"_on_spec_mode_leave") - if (get_tree().is_network_server()): + is_server = get_tree().is_network_server() + if is_server: network.connect("player_removed", self, "_on_player_removed") genNavigation() else: rpc_id(1,"S_getExistingUnits", String(game_states.player_info.net_id)) + # For remote server if game_states.is_server: add_child(load("res://Objects/scripts/serverInfoUpdater.gd").new()) @@ -102,8 +99,6 @@ func loadGameMode(): game_mode = load("res://Objects/Game_modes/Elimination/Elimination.tscn").instance() elif game_server.serverInfo.game_mode == "CheckPoints": game_mode = load("res://Objects/Game_modes/CheckPoints/CheckPoints.tscn").instance() - #elif game_server.serverInfo.game_mode == "Bombing": - #game_mode = load("res://Objects/Game_modes/BombDiffuse.tscn").instance() #add game mode if game_mode: @@ -111,13 +106,12 @@ func loadGameMode(): add_child(game_mode) #Use custom team selector, if exist - var ts = game_mode.get("Custom_teamSelector") + var ts = game_mode.get("team_selector") if ts: - teamSelector = load(ts).instance() - Logger.Log("Using custom team selector from %s" % [ts]) - print("Loading not default team selector") - #switch to default team selector + teamSelector = ts.instance() + Logger.Log("Using custom team selector from %s") + # Switch to default team selector else: teamSelector = load("res://Objects/Game_modes/BombDiffuse/BomTeamSelect.tscn").instance() print("Loading default team selector") @@ -200,7 +194,7 @@ remote func S_getExistingUnits(peer_id : String): # create player , server side remotesync func S_createPlayer(pinfo,team : int): - if get_tree().is_network_server(): + if is_server: rpc("P_createPlayer",pinfo,getSpawnPosition(team),team) else: print("Error : S_createPlayer called on client") @@ -333,7 +327,7 @@ func spawnBot(team_id : int = 0): # Function to remove Unit, server side func S_removeUnit(uid : String): - if get_tree().is_network_server(): + if is_server: rpc("P_removeUnit", uid) else: Logger.LogError("S_removeUnit", "Not network server") @@ -367,7 +361,7 @@ remotesync func P_removeUnit(uid : String): #Kick/remove all the bots from game func removeAllBot(): - if get_tree().is_network_server(): + if is_server: #get all bots var bots = get_tree().get_nodes_in_group("Bot") for i in bots: @@ -384,7 +378,7 @@ func _on_disconnected(): # restart level, server side func S_restartLevel(): - if get_tree().is_network_server(): + if is_server: rpc("P_restartLevel") else: print("Error : S_restartLevel called on client") @@ -409,7 +403,7 @@ remotesync func P_restartLevel(): # Func to change player's team remotesync func S_changeUnitTeam(unit_id : String, team_id : int, kill_unit = true): - if get_tree().is_network_server(): + if is_server: var unit = game_server._unit_data_list.get(unit_id) if not unit: Logger.LogError("S_changeUnitTeam", "Unit with id %s not found" % [unit_id]) @@ -459,6 +453,10 @@ remotesync func P_changeUnitTeam(unit_id : String, team_id : int): unit.ref.get_node("Model").setSkin(data.ct_model) +func S_swapTeams(): + if is_server: + pass + ################################################################################ diff --git a/Objects/Game_modes/CheckPoints/CheckPoints.gd b/Objects/Game_modes/CheckPoints/CheckPoints.gd index 4200047..1f309ac 100644 --- a/Objects/Game_modes/CheckPoints/CheckPoints.gd +++ b/Objects/Game_modes/CheckPoints/CheckPoints.gd @@ -9,11 +9,13 @@ var mode_settings = { var CP_minimap = preload("res://Objects/Game_modes/CheckPoints/CPMinimap.tscn") var end_screen = preload("res://Objects/Game_modes/Elimination/EndScreen.tscn").instance() +var scoreboard = preload("res://Objects/Ui/elimScoreboard.tscn") var time_elasped = 0 var focused_point = null var teams = Array() + onready var timer_label = $top_panel/Label onready var points_node = $top_panel/points onready var progress_bar = $top_panel/ProgressBar diff --git a/Objects/Game_modes/Elimination/Elimination.gd b/Objects/Game_modes/Elimination/Elimination.gd index 78ec2b1..060a295 100644 --- a/Objects/Game_modes/Elimination/Elimination.gd +++ b/Objects/Game_modes/Elimination/Elimination.gd @@ -6,6 +6,7 @@ var mode_settings = { } var scoreboard = preload("res://Objects/Ui/elimScoreboard.tscn") +var end_screen = preload("res://Objects/Game_modes/Elimination/EndScreen.tscn").instance() var time_elasped = 0 # Elasped time var cur_round = 1 # Current round @@ -19,9 +20,6 @@ onready var level = get_tree().get_nodes_in_group("Level")[0] onready var teams = get_tree().get_nodes_in_group("Team") -var end_screen = preload("res://Objects/Game_modes/Elimination/EndScreen.tscn").instance() - - # Called when the node enters the scene tree for the first time. func _ready(): game_states.safe_cpy_dict(mode_settings, game_server.game_mode_settings) @@ -178,7 +176,7 @@ func unfreezeEveryone(): func swapTeam(): var units = get_tree().get_nodes_in_group("Unit") for i in units: - level.rpc_id(1,"S_changeUnitTeam", i.name, abs(i.team.team_id - 1), false) + level.rpc_id(1,"S_changeUnitTeam", i.name, abs(i.team.team_id - 1), true) # Swap scores var temp = teams[0].score teams[0].score = teams[1].score diff --git a/Objects/Game_modes/TDM/TDM.gd b/Objects/Game_modes/TDM/TDM.gd index 9165bc8..4a9ad64 100644 --- a/Objects/Game_modes/TDM/TDM.gd +++ b/Objects/Game_modes/TDM/TDM.gd @@ -2,7 +2,8 @@ ##################### extends CanvasLayer -var end_screen_scn = preload("res://Objects/Game_modes/TDM/endScreen.tscn") +var end_screen_scn = preload("res://Objects/Game_modes/TDM/endScreen.tscn") +var scoreboard = preload("res://Objects/Ui/elimScoreboard.tscn") var mode_settings = { time_limit = 5, diff --git a/Objects/Game_modes/ZombieMod/ZombieMod.gd b/Objects/Game_modes/ZombieMod/ZombieMod.gd index 5b8b0bf..7b1bd21 100644 --- a/Objects/Game_modes/ZombieMod/ZombieMod.gd +++ b/Objects/Game_modes/ZombieMod/ZombieMod.gd @@ -1,6 +1,6 @@ extends CanvasLayer -var Custom_teamSelector = "res://Objects/Game_modes/ZombieMod/Zm_TeamSelect.tscn" +var team_selector = preload("res://Objects/Game_modes/ZombieMod/Zm_TeamSelect.tscn") var current_round = 0 var z_count = 0 diff --git a/Objects/Global/game_states.gd b/Objects/Global/game_states.gd index 93dabc7..23f2ee8 100644 --- a/Objects/Global/game_states.gd +++ b/Objects/Global/game_states.gd @@ -4,7 +4,7 @@ extends Node #contains key resouces #is exporting for android or not -var is_android = false +var is_android = true var is_server = false var is_sysAdmin = false diff --git a/Objects/scripts/Team.gd b/Objects/scripts/Team.gd index c23fd36..12621d1 100644 --- a/Objects/scripts/Team.gd +++ b/Objects/scripts/Team.gd @@ -43,17 +43,14 @@ func removePlayer(plr): player_count -= 1 if player_count == 0 and plr.alive: - alive_players = 1 emit_signal("team_eliminated",self) if plr.is_in_group("User"): - user_count -= 1 + user_count -= 1 if plr.alive: alive_players -= 1 - # Error chk - if player_count < 0: - print("Error : Negative number of players") + func _on_player_killed(): diff --git a/export_presets.cfg b/export_presets.cfg index 1d1f3f8..f6e503e 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -67,8 +67,8 @@ custom_template/release="" custom_template/use_custom_build=true plugins/GodotAdMob=true command_line/extra_args="" -version/code=51 -version/name="1.51_armv7" +version/code=53 +version/name="1.52_beta_armv7" package/unique_name="com.raptor.inc" package/name="warzone2" package/signed=true