diff --git a/World/Map.gd b/World/Map.gd new file mode 100644 index 0000000..2d8dc6d --- /dev/null +++ b/World/Map.gd @@ -0,0 +1,101 @@ +extends TileMap + +var base_positions: Array[Vector2i] = [] + +# Called when the node enters the scene tree for the first time. +func _ready(): + $Options.reset_to_defaults() + + + +func load_map(file_name: String): + $Options.num_errors = 0 + $Options.reset_to_defaults() + parse_map_file(file_name) + apply_options() + prints("Loaded", $Options.mapname, "by", $Options.mapauthor) + if $Options.num_errors > 0: + push_error("Map contains ", $Options.num_errors, " errors") + + +func parse_map_file(file_name): + # Remove current map if any + clear() + + # Build a dictionary that translates letter codes from + # the map format to tiles + var tile_dictionary = {} + var atlas_source = tile_set.get_source(0) + for i in range(atlas_source.get_tiles_count()): + var tile_id = atlas_source.get_tile_id(i) + var tile_data = atlas_source.get_tile_data(tile_id, 0) + var letter_code = tile_data.get_custom_data("Letter code") + for letter in letter_code: + tile_dictionary[letter] = tile_id + + # Load the map from file + var mapfile = FileAccess.open(file_name, FileAccess.READ) + if not mapfile: + print("Couldn't open map file") + return + var multi_line_mode_option = "" + var multi_line_terminator = "" + var multi_line_content = "" + var line_number = 0 + while not mapfile.eof_reached(): + var line = mapfile.get_line() + line_number += 1 + if multi_line_mode_option: + if line.contains(multi_line_terminator): + $Options.set_option(multi_line_mode_option, multi_line_content) + multi_line_mode_option = "" + else: + multi_line_content += line + else: + # Remove comments + var comment_pos = line.find('#') + if comment_pos >= 0: + line = line.left(comment_pos) + # Get rid of extra whitespace + line = line.strip_edges() + # If what is left over is an empty line, skip it + if line.length() == 0: + continue + var option = line.split(':', true, 1) + if option.size() != 2: + print("Invalid data on line ", line_number) + continue + # Multiline values expand over many lindes until a specified keyword is reached + if option[1].contains("\\multiline:"): + multi_line_mode_option = option[0].strip_edges().to_lower() + multi_line_terminator = option[1].split("\\multiline:")[1].strip_edges() + continue + $Options.set_option(option[0].strip_edges(), option[1].strip_edges()) + if multi_line_mode_option != "": + print("EOF reached before end of multiline") + + if $Options.mapdata.length() > 0 and $Options.mapwidth > 0 and $Options.mapheight > 0: + for iy in range($Options.mapheight): + for ix in range($Options.mapwidth): + var letter_code = $Options.mapdata[iy * $Options.mapwidth + ix] + if tile_dictionary.has(letter_code): + set_cell(0, Vector2i(ix, iy), 0, tile_dictionary[letter_code]) + if "_0123456789".contains(letter_code): + base_positions.push_back(Vector2i(ix, iy)) + if $Options.edgewrap: + if ix < $Options.mapwidth / 2: + base_positions[-1].x += $Options.mapwidth + if iy < $Options.mapheight / 2: + base_positions[-1].y += $Options.mapheight + if $Options.edgewrap: + set_cell(0, Vector2i(ix + $Options.mapwidth, iy), 0, tile_dictionary[letter_code]) + set_cell(0, Vector2i(ix + $Options.mapwidth, iy + $Options.mapheight), 0, tile_dictionary[letter_code]) + set_cell(0, Vector2i(ix, iy + $Options.mapheight), 0, tile_dictionary[letter_code]) + + else: + print("Map data or dimensions missing") + +func apply_options(): +# $"Map boundaries/CollisionShape2D".shape.size = 64 * Vector2i(width, height) +# $"Map boundaries".position = 64 * Vector2i(width, height) + pass diff --git a/World/Options.gd b/World/Options.gd new file mode 100644 index 0000000..7e73608 --- /dev/null +++ b/World/Options.gd @@ -0,0 +1,2058 @@ +extends Node + +var num_errors: int + +var gravity: float +var shipmass: float +var ballmass: float +var shotmass: float +var shotspeed: float +var shotlife: int +var firerepeatrate: int +var maxrobots: int +var minrobots: float +var robotstalk: bool +var robotsleave: bool +var robotleavelife: int +var robotleavescore: int +var robotleaveratio: float +var robotteam: int +var restrictrobots: bool +var reserverobotteam: bool +var robotrealname: String +var robothostname: String +var tankrealname: String +var tankhostname: String +var tankscoredecrement: int +var turnthrust: bool +var selfimmunity: bool +var defaultshipshape: String # Shape? +var tankshipshape: String # Shape? +var maxplayershots: int +var shotsgravity: bool +var mapwidth: int +var mapheight: int +var mapname: String +var mapauthor: String +var mapdata: String +var allowplayercrashes: bool +var allowplayerbounces: bool +var allowplayerkilling: bool +var allowshields: bool +var playerstartsshielded: bool +var shotswallbounce: bool +var ballswallbounce: bool +var ballcollisions: bool +var ballsparkcollisions: bool +var mineswallbounce: bool +var itemswallbounce: bool +var missileswallbounce: bool +var sparkswallbounce: bool +var debriswallbounce: bool +var asteroidswallbounce: bool +var cloakedexhaust: bool +var cloakedshield: bool +var maxobjectwallbouncespeed: float +var maxshieldedwallbouncespeed: float +var maxunshieldedwallbouncespeed: float +var maxshieldedplayerwallbounceangle: float +var maxunshieldedplayerwallbounceangle: float +var playerwallbouncebrakefactor: float +var objectwallbouncebrakefactor: float +var objectwallbouncelifefactor: float +var wallbouncefueldrainmult: float +var wallbouncedestroyitemprob: float +var limitedvisibility: bool +var minvisibilitydistance: float +var maxvisibilitydistance: float +var limitedlives: bool +var worldlives: int +var reset: bool +var resetonhuman: int +var allowalliances: bool +var announcealliances: bool +var teamplay: bool +var teamcannons: bool +var teamfuel: bool +var cannonsmartness: int +var cannonsuseitems: bool +var cannonsdefend: bool +var cannonflak: bool +var cannondeadtime: int +var keepshots: bool +var teamassign: bool +var teamimmunity: bool +var teamsharescore: bool +var ecmsreprogrammines: bool +var ecmsreprogramrobots: bool +var targetkillteam: bool +var targetteamcollision: bool +var targetsync: bool +var targetdeadtime: int +var treasurekillteam: bool +var capturetheflag: bool +var treasurecollisiondestroys: bool +var ballconnectorspringconstant: float +var ballconnectordamping: float +var maxballconnectorratio: float +var ballconnectorlength: float +var connectorisstring: bool +var treasurecollisionmaykill: bool +var wreckagecollisionmaykill: bool +var asteroidcollisionmaykill: bool +var timing: bool +var ballrace: bool +var ballraceconnected: bool +var edgewrap: bool +var edgebounce: bool +var extraborder: bool +var gravitypoint: Vector2i # Maybe Vector2? +var gravityangle: int +var gravitypointsource: bool +var gravityclockwise: bool +var gravityanticlockwise: bool +var gravityvisible: bool +var wormholevisible: bool +var itemconcentratorvisible: bool +var asteroidconcentratorvisible: bool +var wormtime: int +var framespersecond: int +var allowsmartmissiles: bool +var allowheatseekers: bool +var allowtorpedoes: bool +var allownukes: bool +var allowclusters: bool +var allowmodifiers: bool +var allowlasermodifiers: bool +var allowshipshapes: bool +var playersonradar: bool +var missilesonradar: bool +var minesonradar: bool +var nukesonradar: bool +var treasuresonradar: bool +var asteroidsonradar: bool +var distinguishmissiles: bool +var maxmissilesperpack: int +var maxminesperpack: int +var identifymines: bool +var shieldeditempickup: bool +var shieldedmining: bool +var laserisstungun: bool +var nukeminsmarts: int +var nukeminmines: int +var nukeclusterdamage: float +var minefusetime: float +var minelife: int +var minminespeed: int +var missilelife: int +var baseminerange: int +var mineshotdetonatedistance: int +var shotkillscoremult: float +var torpedokillscoremult: float +var smartkillscoremult: float +var heatkillscoremult: float +var clusterkillscoremult: float +var laserkillscoremult: float +var tankkillscoremult: float +var runoverkillscoremult: float +var ballkillscoremult: float +var explosionkillscoremult: float +var shovekillscoremult: float +var crashscoremult: float +var minescoremult: float +var asteroidpoints: float +var cannonpoints: float +var asteroidmaxscore: float +var cannonmaxscore: float +var movingitemprob: float +var dropitemonkillprob: float +var randomitemprob: float +var detonateitemonkillprob: float +var destroyitemincollisionprob: float +var asteroiditemprob: float +var asteroidmaxitems: int +var itemprobmult: float +var cannonitemprobmult: float +var maxitemdensity: float +var asteroidprob: float +var maxasteroiddensity: int +var itemconcentratorradius: int +var itemconcentratorprob: float +var asteroidconcentratorradius: int +var asteroidconcentratorprob: float +var rogueheatprob: float +var roguemineprob: float +var itemenergypackprob: float +var itemtankprob: float +var itemecmprob: float +var itemarmorprob: float +var itemmineprob: float +var itemmissileprob: float +var itemcloakprob: float +var itemsensorprob: float +var itemwideangleprob: float +var itemrearshotprob: float +var itemafterburnerprob: float +var itemtransporterprob: float +var itemmirrorprob: float +var itemdeflectorprob: float +var itemhyperjumpprob: float +var itemphasingprob: float +var itemlaserprob: float +var itememergencythrustprob: float +var itemtractorbeamprob: float +var itemautopilotprob: float +var itememergencyshieldprob: float +var initialfuel: float +var initialtanks: int +var initialarmor: int +var initialecms: int +var initialmines: int +var initialmissiles: int +var initialcloaks: int +var initialsensors: int +var initialwideangles: int +var initialrearshots: int +var initialafterburners: int +var initialtransporters: int +var initialmirrors: int +var maxarmor: int +var initialdeflectors: int +var initialhyperjumps: int +var initialphasings: int +var initiallasers: int +var initialemergencythrusts: int +var initialtractorbeams: int +var initialautopilots: int +var initialemergencyshields: int +var maxfuel: int +var maxtanks: int +var maxecms: int +var maxmines: int +var maxmissiles: int +var maxcloaks: int +var maxsensors: int +var maxwideangles: int +var maxrearshots: int +var maxafterburners: int +var maxtransporters: int +var maxdeflectors: int +var maxphasings: int +var maxhyperjumps: int +var maxemergencythrusts: int +var maxlasers: int +var maxtractorbeams: int +var maxautopilots: int +var maxemergencyshields: int +var maxmirrors: int +var gameduration: float +var allowviewing: bool +var friction: float +var blockfriction: float +var blockfrictionvisible: bool +var coriolis: int +var checkpointradius: float +var racelaps: int +var lockotherteam: bool +var loseitemdestroys: bool +var usewreckage: bool +var maxoffensiveitems: int +var maxdefensiveitems: int +var rounddelay: int +var maxroundtime: int +var roundstoplay: int +var maxpausetime: int + +func reset_to_defaults(): + gravity = -0.14 + shipmass = 20.0 + ballmass = 50.0 + shotmass = 0.1 + shotspeed = 21.0 + shotlife = 60 + firerepeatrate = 2 + maxrobots = 4 + minrobots = -1 + robotstalk = false + robotsleave = true + robotleavelife = 50 + robotleavescore = -90 + robotleaveratio = -5 + robotteam = 0 + restrictrobots = true + reserverobotteam = true + robotrealname = "robot" + robothostname = "xpilot.org" + tankrealname = "tank" + tankhostname = "tanks.org" + tankscoredecrement = 500 + turnthrust = false + selfimmunity = false + defaultshipshape = "(NM:Default)(AU:Unknown)(SH: 15,0 -9,8 -9,-8)(MG: 15,0)(LG: 15,0)(RG: 15,0)(EN: -9,0)(LR: -9,8)(RR: -9,-8)(LL: -9,8)(RL: -9,-8)(MR: 15,0)" + tankshipshape = "(NM:fueltank)(AU:John E. Norlin)(SH: 15,0 14,-5 9,-8 -5,-8 -3,-8 -3,0 2,0 2,2 -3,2 -3,6 5,6 5,8 -5,8 -5,-8 -9,-8 -14,-5 -15,0 -14,5 -9,8 9,8 14,5)(EN: -15,0)(MG: 15,0)" + maxplayershots = 256 + shotsgravity = true + mapwidth = 100 + mapheight = 100 + mapname = "" + mapauthor = "" + mapdata = "" + allowplayercrashes = true + allowplayerbounces = true + allowplayerkilling = true + allowshields = true + playerstartsshielded = true + shotswallbounce = false + ballswallbounce = true + ballcollisions = false + ballsparkcollisions = true + mineswallbounce = false + itemswallbounce = true + missileswallbounce = false + sparkswallbounce = false + debriswallbounce = false + asteroidswallbounce = true + cloakedexhaust = true + cloakedshield = true + maxobjectwallbouncespeed = 40 + maxshieldedwallbouncespeed = 50 + maxunshieldedwallbouncespeed = 20 + maxshieldedplayerwallbounceangle = 90 + maxunshieldedplayerwallbounceangle = 30 + playerwallbouncebrakefactor = 0.89 + objectwallbouncebrakefactor = 0.95 + objectwallbouncelifefactor = 0.80 + wallbouncefueldrainmult = 1.0 + wallbouncedestroyitemprob = 0.0 + limitedvisibility = false + minvisibilitydistance = 0.0 + maxvisibilitydistance = 0.0 + limitedlives = false + worldlives = 0 + reset = true + resetonhuman = 0 + allowalliances = true + announcealliances = false + teamplay = false + teamcannons = false + teamfuel = false + cannonsmartness = 1 + cannonsuseitems = false + cannonsdefend = true + cannonflak = true + cannondeadtime = 72 + keepshots = false + teamassign = true + teamimmunity = true + teamsharescore = false + ecmsreprogrammines = true + ecmsreprogramrobots = true + targetkillteam = false + targetteamcollision = true + targetsync = false + targetdeadtime = 60 + treasurekillteam = false + capturetheflag = false + treasurecollisiondestroys = true + ballconnectorspringconstant = 1500.0 + ballconnectordamping = 2.0 + maxballconnectorratio = 0.30 + ballconnectorlength = 120 + connectorisstring = false + treasurecollisionmaykill = false + wreckagecollisionmaykill = false + asteroidcollisionmaykill = true + timing = false + ballrace = false + ballraceconnected = false + edgewrap = false + edgebounce = true + extraborder = false + gravitypoint = Vector2i(0,0) + gravityangle = 90 + gravitypointsource = false + gravityclockwise = false + gravityanticlockwise = false + gravityvisible = true + wormholevisible = true + itemconcentratorvisible = true + asteroidconcentratorvisible = true + wormtime = 0 + framespersecond = 14 + allowsmartmissiles = true + allowheatseekers = true + allowtorpedoes = true + allownukes = false + allowclusters = false + allowmodifiers = false + allowlasermodifiers = false + allowshipshapes = true + playersonradar = true + missilesonradar = true + minesonradar = false + nukesonradar = true + treasuresonradar = false + asteroidsonradar = false + distinguishmissiles = true + maxmissilesperpack = 4 + maxminesperpack = 2 + identifymines = true + shieldeditempickup = false + shieldedmining = false + laserisstungun = false + nukeminsmarts = 7 + nukeminmines = 4 + nukeclusterdamage = 1.0 + minefusetime = 0.0 + minelife = 0 + minminespeed = 0 + missilelife = 0 + baseminerange = 0 + mineshotdetonatedistance = 0 + shotkillscoremult = 1.0 + torpedokillscoremult = 1.0 + smartkillscoremult = 1.0 + heatkillscoremult = 1.0 + clusterkillscoremult = 1.0 + laserkillscoremult = 1.0 + tankkillscoremult = 0.44 + runoverkillscoremult = 0.33 + ballkillscoremult = 1.0 + explosionkillscoremult = 0.33 + shovekillscoremult = 0.5 + crashscoremult = 0.33 + minescoremult = 0.17 + asteroidpoints = 1.0 + cannonpoints = 1.0 + asteroidmaxscore = 100.0 + cannonmaxscore = 100.0 + movingitemprob = 0.2 + dropitemonkillprob = 0.5 + randomitemprob = 0.0 + detonateitemonkillprob = 0.5 + destroyitemincollisionprob = 0.0 + asteroiditemprob = 0.0 + asteroidmaxitems = 0 + itemprobmult = 1.0 + cannonitemprobmult = 1.0 + maxitemdensity = 0.00012 + asteroidprob = 5e-7 + maxasteroiddensity = 0 + itemconcentratorradius = 10 + itemconcentratorprob = 1.0 + asteroidconcentratorradius = 10 + asteroidconcentratorprob = 1.0 + rogueheatprob = 1.0 + roguemineprob = 1.0 + itemenergypackprob = 1e-9 + itemtankprob = 1e-9 + itemecmprob = 1e-9 + itemarmorprob = 1e-9 + itemmineprob = 1e-9 + itemmissileprob = 1e-9 + itemcloakprob = 1e-9 + itemsensorprob = 1e-9 + itemwideangleprob = 1e-9 + itemrearshotprob = 1e-9 + itemafterburnerprob = 1e-9 + itemtransporterprob = 1e-9 + itemmirrorprob = 1e-9 + itemdeflectorprob = 1e-9 + itemhyperjumpprob = 1e-9 + itemphasingprob = 1e-9 + itemlaserprob = 1e-9 + itememergencythrustprob = 1e-9 + itemtractorbeamprob = 1e-9 + itemautopilotprob = 1e-9 + itememergencyshieldprob = 1e-9 + initialfuel = 1000 + initialtanks = 0 + initialarmor = 0 + initialecms = 0 + initialmines = 0 + initialmissiles = 0 + initialcloaks = 0 + initialsensors = 0 + initialwideangles = 0 + initialrearshots = 0 + initialafterburners = 0 + initialtransporters = 0 + initialmirrors = 0 + maxarmor = 10 + initialdeflectors = 0 + initialhyperjumps = 0 + initialphasings = 0 + initiallasers = 0 + initialemergencythrusts = 0 + initialtractorbeams = 0 + initialautopilots = 0 + initialemergencyshields = 0 + maxfuel = 10000 + maxtanks = 8 + maxecms = 10 + maxmines = 10 + maxmissiles = 10 + maxcloaks = 10 + maxsensors = 10 + maxwideangles = 10 + maxrearshots = 10 + maxafterburners = 10 + maxtransporters = 10 + maxdeflectors = 10 + maxphasings = 10 + maxhyperjumps = 10 + maxemergencythrusts = 10 + maxlasers = 5 + maxtractorbeams = 4 + maxautopilots = 10 + maxemergencyshields = 10 + maxmirrors = 10 + gameduration = 0.0 + allowviewing = false + friction = 0.0 + blockfriction = 0.0 + blockfrictionvisible = true + coriolis = 0 + checkpointradius = 6.0 + racelaps = 3 + lockotherteam = true + loseitemdestroys = false + usewreckage = true + maxoffensiveitems = 100 + maxdefensiveitems = 100 + rounddelay = 0 + maxroundtime = 0 + roundstoplay = 0 + maxpausetime = 3600 + +func set_option(option: String, value: String): + option = option.to_lower() + match option: + "gravity": + if value.is_valid_float(): + gravity = value.to_float() + else: + push_warning("Non-float value for gravity") + num_errors += 1 + "shipmass": + if value.is_valid_float(): + shipmass = value.to_float() + else: + push_warning("Non-float value for shipmass") + num_errors += 1 + "shipmass": + if value.is_valid_float(): + shipmass = value.to_float() + else: + push_warning("Non-float value for shipmass") + num_errors += 1 + "shotmass": + if value.is_valid_float(): + shotmass = value.to_float() + else: + push_warning("Non-float value for shotmass") + num_errors += 1 + "shotspeed": + if value.is_valid_float(): + shotspeed = value.to_float() + else: + push_warning("Non-float value for shotspeed") + num_errors += 1 + "shotlife": + if value.is_valid_int(): + shotlife = value.to_int() + else: + push_warning("Non-int value for shotlife") + num_errors += 1 + "firerepeatrate": + if value.is_valid_int(): + firerepeatrate = value.to_int() + else: + push_warning("Non-int value for firerepeatrate") + num_errors += 1 + "maxrobots": + if value.is_valid_int(): + maxrobots = value.to_int() + else: + push_warning("Non-int value for maxrobots") + num_errors += 1 + "minrobots": + if value.is_valid_float(): + minrobots = value.to_float() + else: + push_warning("Non-float value for minrobots") + num_errors += 1 + "robotstalk": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + robotstalk = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for robotstalk") + num_errors += 1 + "robotsleave": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + robotsleave = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for robotsleave") + num_errors += 1 + "robotleavelife": + if value.is_valid_int(): + robotleavelife = value.to_int() + else: + push_warning("Non-int value for robotleavelife") + num_errors += 1 + "robotleavescore": + if value.is_valid_int(): + robotleavescore = value.to_int() + else: + push_warning("Non-int value for robotleavescore") + num_errors += 1 + "robotleaveratio": + if value.is_valid_float(): + robotleaveratio = value.to_float() + else: + push_warning("Non-float value for robotleaveratio") + num_errors += 1 + "robotteam": + if value.is_valid_int(): + robotteam = value.to_int() + else: + push_warning("Non-int value for robotteam") + num_errors += 1 + "restrictrobots": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + restrictrobots = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for restrictrobots") + num_errors += 1 + "reserverobotteam": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + reserverobotteam = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for reserverobotteam") + num_errors += 1 + "robotrealname": + robotrealname = value + "robothostname": + robothostname = value + "tankrealname": + tankrealname = value + "tankhostname": + tankhostname = value + "tankscoredecrement": + if value.is_valid_int(): + tankscoredecrement = value.to_int() + else: + push_warning("Non-int value for tankscoredecrement") + num_errors += 1 + "turnthrust": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + turnthrust = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for turnthrust") + num_errors += 1 # Shape? + "selfimmunity": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + selfimmunity = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for selfimmunity") + num_errors += 1 + "defaultshipshape": + defaultshipshape = value + "tankshipshape": + tankshipshape = value + "maxplayershots": + if value.is_valid_int(): + maxplayershots = value.to_int() + else: + push_warning("Non-int value for maxplayershots") + num_errors += 1 + "shotsgravity": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + shotsgravity = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for shotsgravity") + num_errors += 1 + "mapwidth": + if value.is_valid_int(): + mapwidth = value.to_int() + else: + push_warning("Non-int value for mapwidth") + num_errors += 1 + "mapheight": + if value.is_valid_int(): + mapheight = value.to_int() + else: + push_warning("Non-int value for mapheight") + num_errors += 1 + "mapname": + mapname = value + "mapauthor": + mapauthor = value + "mapdata": + mapdata = value + "allowplayercrashes": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + allowplayercrashes = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for allowplayercrashes") + num_errors += 1 + "allowplayerbounces": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + allowplayerbounces = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for allowplayerbounces") + num_errors += 1 + "allowplayerkilling": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + allowplayerkilling = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for allowplayerkilling") + num_errors += 1 + "allowshields": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + allowshields = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for allowshields") + num_errors += 1 + "playerstartsshielded": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + playerstartsshielded = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for playerstartsshielded") + num_errors += 1 + "shotswallbounce": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + shotswallbounce = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for shotswallbounce") + num_errors += 1 + "ballswallbounce": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + ballswallbounce = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-float value for ballswallbounce") + num_errors += 1 + "ballcollisions": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + ballcollisions = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for ballcollisions") + num_errors += 1 + "ballsparkcollisions": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + ballsparkcollisions = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for ballsparkcollisions") + num_errors += 1 + "mineswallbounce": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + mineswallbounce = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for mineswallbounce") + num_errors += 1 + "itemswallbounce": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + itemswallbounce = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for itemswallbounce") + num_errors += 1 + "missileswallbounce": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + missileswallbounce = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for missileswallbounce") + num_errors += 1 + "sparkswallbounce": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + sparkswallbounce = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for sparkswallbounce") + num_errors += 1 + "debriswallbounce": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + debriswallbounce = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for debriswallbounce") + num_errors += 1 + "asteroidswallbounce": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + asteroidswallbounce = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for asteroidswallbounce") + num_errors += 1 + "cloakedexhaust": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + cloakedexhaust = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for cloakedexhaust") + num_errors += 1 + "cloakedshield": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + cloakedshield = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for cloakedshield") + num_errors += 1 + "maxobjectwallbouncespeed": + if value.is_valid_float(): + maxobjectwallbouncespeed = value.to_float() + else: + push_warning("Non-float value for maxobjectwallbouncespeed") + num_errors += 1 + "maxshieldedwallbouncespeed": + if value.is_valid_float(): + maxshieldedwallbouncespeed = value.to_float() + else: + push_warning("Non-float value for maxshieldedwallbouncespeed") + num_errors += 1 + "maxunshieldedwallbouncespeed": + if value.is_valid_float(): + maxunshieldedwallbouncespeed = value.to_float() + else: + push_warning("Non-float value for maxunshieldedwallbouncespeed") + num_errors += 1 + "maxshieldedplayerwallbounceangle": + if value.is_valid_float(): + maxshieldedplayerwallbounceangle = value.to_float() + else: + push_warning("Non-float value for maxshieldedplayerwallbounceangle") + num_errors += 1 + "maxunshieldedplayerwallbounceangle": + if value.is_valid_float(): + maxunshieldedplayerwallbounceangle = value.to_float() + else: + push_warning("Non-float value for maxunshieldedplayerwallbounceangle") + num_errors += 1 + "playerwallbouncebrakefactor": + if value.is_valid_float(): + playerwallbouncebrakefactor = value.to_float() + else: + push_warning("Non-float value for playerwallbouncebrakefactor") + num_errors += 1 + "objectwallbouncebrakefactor": + if value.is_valid_float(): + objectwallbouncebrakefactor = value.to_float() + else: + push_warning("Non-float value for objectwallbouncebrakefactor") + num_errors += 1 + "objectwallbouncelifefactor": + if value.is_valid_float(): + objectwallbouncelifefactor = value.to_float() + else: + push_warning("Non-float value for objectwallbouncelifefactor") + num_errors += 1 + "wallbouncefueldrainmult": + if value.is_valid_float(): + wallbouncefueldrainmult = value.to_float() + else: + push_warning("Non-float value for wallbouncefueldrainmult") + num_errors += 1 + "wallbouncedestroyitemprob": + if value.is_valid_float(): + wallbouncedestroyitemprob = value.to_float() + else: + push_warning("Non-float value for wallbouncedestroyitemprob") + num_errors += 1 + "limitedvisibility": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + limitedvisibility = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for limitedvisibility") + num_errors += 1 + "minvisibilitydistance": + if value.is_valid_float(): + minvisibilitydistance = value.to_float() + else: + push_warning("Non-float value for minvisibilitydistance") + num_errors += 1 + "maxvisibilitydistance": + if value.is_valid_float(): + maxvisibilitydistance = value.to_float() + else: + push_warning("Non-float value for maxvisibilitydistance") + num_errors += 1 + "limitedlives": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + limitedlives = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for limitedlives") + num_errors += 1 + "worldlives": + if value.is_valid_int(): + worldlives = value.to_int() + else: + push_warning("Non-int value for worldlives") + num_errors += 1 + "reset": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + reset = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for reset") + num_errors += 1 + "resetonhuman": + if value.is_valid_int(): + resetonhuman = value.to_int() + else: + push_warning("Non-int value for resetonhuman") + num_errors += 1 + "allowalliances": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + allowalliances = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for allowalliances") + num_errors += 1 + "announcealliances": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + announcealliances = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for announcealliances") + num_errors += 1 + "teamplay": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + teamplay = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for teamplay") + num_errors += 1 + "teamcannons": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + teamcannons = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for teamcannons") + num_errors += 1 + "teamfuel": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + teamfuel = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for teamfuel") + num_errors += 1 + "cannonsmartness": + if value.is_valid_int(): + cannonsmartness = value.to_int() + else: + push_warning("Non-int value for cannonsmartness") + num_errors += 1 + "cannonsuseitems": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + cannonsuseitems = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for cannonsuseitems") + num_errors += 1 + "cannonsdefend": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + cannonsdefend = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for cannonsdefend") + num_errors += 1 + "cannonflak": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + cannonflak = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for cannonflak") + num_errors += 1 + "cannondeadtime": + if value.is_valid_int(): + cannondeadtime = value.to_int() + else: + push_warning("Non-int value for cannondeadtime") + num_errors += 1 + "keepshots": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + keepshots = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for keepshots") + num_errors += 1 + "teamassign": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + teamassign = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for teamassign") + num_errors += 1 + "teamimmunity": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + teamimmunity = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for teamimmunity") + num_errors += 1 + "teamsharescore": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + teamsharescore = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for teamsharescore") + num_errors += 1 + "ecmsreprogrammines": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + ecmsreprogrammines = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for ecmsreprogrammines") + num_errors += 1 + "ecmsreprogramrobots": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + ecmsreprogramrobots = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for ecmsreprogramrobots") + num_errors += 1 + "targetkillteam": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + targetkillteam = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for targetkillteam") + num_errors += 1 + "targetteamcollision": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + targetteamcollision = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for targetteamcollision") + num_errors += 1 + "targetsync": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + targetsync = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for targetsync") + num_errors += 1 + "targetdeadtime": + if value.is_valid_int(): + targetdeadtime = value.to_int() + else: + push_warning("Non-int value for targetdeadtime") + num_errors += 1 + "treasurekillteam": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + treasurekillteam = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for treasurekillteam") + num_errors += 1 + "capturetheflag": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + capturetheflag = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for capturetheflag") + num_errors += 1 + "treasurecollisiondestroys": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + treasurecollisiondestroys = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for treasurecollisiondestroys") + num_errors += 1 + "ballconnectorspringconstant": + if value.is_valid_float(): + ballconnectorspringconstant = value.to_float() + else: + push_warning("Non-float value for ballconnectorspringconstant") + num_errors += 1 + "ballconnectordamping": + if value.is_valid_float(): + ballconnectordamping = value.to_float() + else: + push_warning("Non-float value for ballconnectordamping") + num_errors += 1 + "maxballconnectorratio": + if value.is_valid_float(): + maxballconnectorratio = value.to_float() + else: + push_warning("Non-float value for maxballconnectorratio") + num_errors += 1 + "ballconnectorlength": + if value.is_valid_float(): + ballconnectorlength = value.to_float() + else: + push_warning("Non-float value for ballconnectorlength") + num_errors += 1 + "connectorisstring": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + connectorisstring = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for connectorisstring") + num_errors += 1 + "treasurecollisionmaykill": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + treasurecollisionmaykill = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for treasurecollisionmaykill") + num_errors += 1 + "wreckagecollisionmaykill": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + wreckagecollisionmaykill = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for wreckagecollisionmaykill") + num_errors += 1 + "asteroidcollisionmaykill": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + asteroidcollisionmaykill = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for asteroidcollisionmaykill") + num_errors += 1 + "timing": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + timing = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for timing") + num_errors += 1 + "ballrace": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + ballrace = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for ballrace") + num_errors += 1 + "ballraceconnected": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + ballraceconnected = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for ballraceconnected") + num_errors += 1 + "edgewrap": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + edgewrap = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for edgewrap") + num_errors += 1 + "edgebounce": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + edgebounce = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for edgebounce") + num_errors += 1 + "extraborder": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + extraborder = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for extraborder") + num_errors += 1 + "gravitypoint": + var values = value.lstrip('(').rstrip(')').split(",") + if values.size() > 2 and values[0].is_valid_int() and values[1].is_valid_int(): + gravitypoint.x = values[0].to_int() + gravitypoint.x = values[1].to_int() + else: + push_warning("Invalid coordinates for gravitypoint") + num_errors += 1 + "gravityangle": + if value.is_valid_int(): + gravityangle = value.to_int() + else: + push_warning("Non-int value for gravityangle") + num_errors += 1 + "gravitypointsource": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + gravitypointsource = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for gravitypointsource") + num_errors += 1 + "gravityclockwise": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + gravityclockwise = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for gravityclockwise") + num_errors += 1 + "gravityanticlockwise": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + gravityanticlockwise = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for gravityanticlockwise") + num_errors += 1 + "gravityvisible": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + gravityvisible = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for gravityvisible") + num_errors += 1 + "wormholevisible": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + wormholevisible = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for wormholevisible") + num_errors += 1 + "itemconcentratorvisible": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + itemconcentratorvisible = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for itemconcentratorvisible") + num_errors += 1 + "asteroidconcentratorvisible": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + asteroidconcentratorvisible = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for asteroidconcentratorvisible") + num_errors += 1 + "wormtime": + if value.is_valid_int(): + wormtime = value.to_int() + else: + push_warning("Non-int value for wormtime") + num_errors += 1 + "framespersecond": + if value.is_valid_int(): + framespersecond = value.to_int() + else: + push_warning("Non-int value for framespersecond") + num_errors += 1 + "allowsmartmissiles": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + allowsmartmissiles = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for allowsmartmissiles") + num_errors += 1 + "allowheatseekers": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + allowheatseekers = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for allowheatseekers") + num_errors += 1 + "allowtorpedoes": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + allowtorpedoes = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for allowtorpedoes") + num_errors += 1 + "allownukes": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + allownukes = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for allownukes") + num_errors += 1 + "allowclusters": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + allowclusters = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for allowclusters") + num_errors += 1 + "allowmodifiers": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + allowmodifiers = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for allowmodifiers") + num_errors += 1 + "allowlasermodifiers": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + allowlasermodifiers = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for allowlasermodifiers") + num_errors += 1 + "allowshipshapes": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + allowshipshapes = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for allowshipshapes") + num_errors += 1 + "playersonradar": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + playersonradar = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for playersonradar") + num_errors += 1 + "missilesonradar": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + missilesonradar = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for missilesonradar") + num_errors += 1 + "minesonradar": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + minesonradar = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for minesonradar") + num_errors += 1 + "nukesonradar": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + nukesonradar = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for nukesonradar") + num_errors += 1 + "treasuresonradar": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + treasuresonradar = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for treasuresonradar") + num_errors += 1 + "asteroidsonradar": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + asteroidsonradar = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for asteroidsonradar") + num_errors += 1 + "distinguishmissiles": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + distinguishmissiles = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for distinguishmissiles") + num_errors += 1 + "maxmissilesperpack": + if value.is_valid_int(): + maxmissilesperpack = value.to_int() + else: + push_warning("Non-int value for maxmissilesperpack") + num_errors += 1 + "maxminesperpack": + if value.is_valid_int(): + maxminesperpack = value.to_int() + else: + push_warning("Non-int value for maxminesperpack") + num_errors += 1 + "identifymines": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + identifymines = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for identifymines") + num_errors += 1 + "shieldeditempickup": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + shieldeditempickup = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for shieldeditempickup") + num_errors += 1 + "shieldedmining": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + shieldedmining = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for shieldedmining") + num_errors += 1 + "laserisstungun": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + laserisstungun = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for laserisstungun") + num_errors += 1 + "nukeminsmarts": + if value.is_valid_int(): + nukeminsmarts = value.to_int() + else: + push_warning("Non-int value for nukeminsmarts") + num_errors += 1 + "nukeminmines": + if value.is_valid_int(): + nukeminmines = value.to_int() + else: + push_warning("Non-int value for nukeminmines") + num_errors += 1 + "nukeclusterdamage": + if value.is_valid_float(): + nukeclusterdamage = value.to_float() + else: + push_warning("Non-float value for nukeclusterdamage") + num_errors += 1 + "minefusetime": + if value.is_valid_float(): + minefusetime = value.to_float() + else: + push_warning("Non-float value for minefusetime") + num_errors += 1 + "minelife": + if value.is_valid_int(): + minelife = value.to_int() + else: + push_warning("Non-int value for minelife") + num_errors += 1 + "minminespeed": + if value.is_valid_int(): + minminespeed = value.to_int() + else: + push_warning("Non-int value for minminespeed") + num_errors += 1 + "missilelife": + if value.is_valid_int(): + missilelife = value.to_int() + else: + push_warning("Non-int value for missilelife") + num_errors += 1 + "baseminerange": + if value.is_valid_int(): + baseminerange = value.to_int() + else: + push_warning("Non-int value for baseminerange") + num_errors += 1 + "mineshotdetonatedistance": + if value.is_valid_int(): + mineshotdetonatedistance = value.to_int() + else: + push_warning("Non-int value for mineshotdetonatedistance") + num_errors += 1 + "shotkillscoremult": + if value.is_valid_float(): + shotkillscoremult = value.to_float() + else: + push_warning("Non-float value for shotkillscoremult") + num_errors += 1 + "torpedokillscoremult": + if value.is_valid_float(): + torpedokillscoremult = value.to_float() + else: + push_warning("Non-float value for torpedokillscoremult") + num_errors += 1 + "smartkillscoremult": + if value.is_valid_float(): + smartkillscoremult = value.to_float() + else: + push_warning("Non-float value for smartkillscoremult") + num_errors += 1 + "heatkillscoremult": + if value.is_valid_float(): + heatkillscoremult = value.to_float() + else: + push_warning("Non-float value for heatkillscoremult") + num_errors += 1 + "clusterkillscoremult": + if value.is_valid_float(): + clusterkillscoremult = value.to_float() + else: + push_warning("Non-float value for clusterkillscoremult") + num_errors += 1 + "laserkillscoremult": + if value.is_valid_float(): + laserkillscoremult = value.to_float() + else: + push_warning("Non-float value for laserkillscoremult") + num_errors += 1 + "tankkillscoremult": + if value.is_valid_float(): + tankkillscoremult = value.to_float() + else: + push_warning("Non-float value for tankkillscoremult") + num_errors += 1 + "runoverkillscoremult": + if value.is_valid_float(): + runoverkillscoremult = value.to_float() + else: + push_warning("Non-float value for runoverkillscoremult") + num_errors += 1 + "ballkillscoremult": + if value.is_valid_float(): + ballkillscoremult = value.to_float() + else: + push_warning("Non-float value for ballkillscoremult") + num_errors += 1 + "explosionkillscoremult": + if value.is_valid_float(): + explosionkillscoremult = value.to_float() + else: + push_warning("Non-float value for explosionkillscoremult") + num_errors += 1 + "shovekillscoremult": + if value.is_valid_float(): + shovekillscoremult = value.to_float() + else: + push_warning("Non-float value for shovekillscoremult") + num_errors += 1 + "crashscoremult": + if value.is_valid_float(): + crashscoremult = value.to_float() + else: + push_warning("Non-float value for crashscoremult") + num_errors += 1 + "minescoremult": + if value.is_valid_float(): + minescoremult = value.to_float() + else: + push_warning("Non-float value for minescoremult") + num_errors += 1 + "asteroidpoints": + if value.is_valid_float(): + asteroidpoints = value.to_float() + else: + push_warning("Non-float value for asteroidpoints") + num_errors += 1 + "cannonpoints": + if value.is_valid_float(): + cannonpoints = value.to_float() + else: + push_warning("Non-float value for cannonpoints") + num_errors += 1 + "asteroidmaxscore": + if value.is_valid_float(): + asteroidmaxscore = value.to_float() + else: + push_warning("Non-float value for asteroidmaxscore") + num_errors += 1 + "cannonmaxscore": + if value.is_valid_float(): + cannonmaxscore = value.to_float() + else: + push_warning("Non-float value for cannonmaxscore") + num_errors += 1 + "movingitemprob": + if value.is_valid_float(): + movingitemprob = value.to_float() + else: + push_warning("Non-float value for movingitemprob") + num_errors += 1 + "dropitemonkillprob": + if value.is_valid_float(): + dropitemonkillprob = value.to_float() + else: + push_warning("Non-float value for dropitemonkillprob") + num_errors += 1 + "randomitemprob": + if value.is_valid_float(): + randomitemprob = value.to_float() + else: + push_warning("Non-float value for randomitemprob") + num_errors += 1 + "detonateitemonkillprob": + if value.is_valid_float(): + detonateitemonkillprob = value.to_float() + else: + push_warning("Non-float value for detonateitemonkillprob") + num_errors += 1 + "destroyitemincollisionprob": + if value.is_valid_float(): + destroyitemincollisionprob = value.to_float() + else: + push_warning("Non-float value for destroyitemincollisionprob") + num_errors += 1 + "asteroiditemprob": + if value.is_valid_float(): + asteroiditemprob = value.to_float() + else: + push_warning("Non-float value for asteroiditemprob") + num_errors += 1 + "asteroidmaxitems": + if value.is_valid_int(): + asteroidmaxitems = value.to_int() + else: + push_warning("Non-int value for asteroidmaxitems") + num_errors += 1 + "itemprobmult": + if value.is_valid_float(): + itemprobmult = value.to_float() + else: + push_warning("Non-float value for itemprobmult") + num_errors += 1 + "cannonitemprobmult": + if value.is_valid_float(): + cannonitemprobmult = value.to_float() + else: + push_warning("Non-float value for cannonitemprobmult") + num_errors += 1 + "maxitemdensity": + if value.is_valid_float(): + maxitemdensity = value.to_float() + else: + push_warning("Non-float value for maxitemdensity") + num_errors += 1 + "asteroidprob": + if value.is_valid_float(): + asteroidprob = value.to_float() + else: + push_warning("Non-float value for asteroidprob") + num_errors += 1 + "maxasteroiddensity": + if value.is_valid_int(): + maxasteroiddensity = value.to_int() + else: + push_warning("Non-int value for maxasteroiddensity") + num_errors += 1 + "itemconcentratorradius": + if value.is_valid_int(): + itemconcentratorradius = value.to_int() + else: + push_warning("Non-int value for itemconcentratorradius") + num_errors += 1 + "itemconcentratorprob": + if value.is_valid_float(): + itemconcentratorprob = value.to_float() + else: + push_warning("Non-float value for itemconcentratorprob") + num_errors += 1 + "asteroidconcentratorradius": + if value.is_valid_int(): + asteroidconcentratorradius = value.to_int() + else: + push_warning("Non-int value for asteroidconcentratorradius") + num_errors += 1 + "asteroidconcentratorprob": + if value.is_valid_float(): + asteroidconcentratorprob = value.to_float() + else: + push_warning("Non-float value for asteroidconcentratorprob") + num_errors += 1 + "rogueheatprob": + if value.is_valid_float(): + rogueheatprob = value.to_float() + else: + push_warning("Non-float value for rogueheatprob") + num_errors += 1 + "roguemineprob": + if value.is_valid_float(): + roguemineprob = value.to_float() + else: + push_warning("Non-float value for roguemineprob") + num_errors += 1 + "itemenergypackprob": + if value.is_valid_float(): + itemenergypackprob = value.to_float() + else: + push_warning("Non-float value for itemenergypackprob") + num_errors += 1 + "itemtankprob": + if value.is_valid_float(): + itemtankprob = value.to_float() + else: + push_warning("Non-float value for itemtankprob") + num_errors += 1 + "itemecmprob": + if value.is_valid_float(): + itemecmprob = value.to_float() + else: + push_warning("Non-float value for itemecmprob") + num_errors += 1 + "itemarmorprob": + if value.is_valid_float(): + itemarmorprob = value.to_float() + else: + push_warning("Non-float value for itemarmorprob") + num_errors += 1 + "itemmineprob": + if value.is_valid_float(): + itemmineprob = value.to_float() + else: + push_warning("Non-float value for itemmineprob") + num_errors += 1 + "itemmissileprob": + if value.is_valid_float(): + itemmissileprob = value.to_float() + else: + push_warning("Non-float value for itemmissileprob") + num_errors += 1 + "itemcloakprob": + if value.is_valid_float(): + itemcloakprob = value.to_float() + else: + push_warning("Non-float value for itemcloakprob") + num_errors += 1 + "itemsensorprob": + if value.is_valid_float(): + itemsensorprob = value.to_float() + else: + push_warning("Non-float value for itemsensorprob") + num_errors += 1 + "itemwideangleprob": + if value.is_valid_float(): + itemwideangleprob = value.to_float() + else: + push_warning("Non-float value for itemwideangleprob") + num_errors += 1 + "itemrearshotprob": + if value.is_valid_float(): + itemrearshotprob = value.to_float() + else: + push_warning("Non-float value for itemrearshotprob") + num_errors += 1 + "itemafterburnerprob": + if value.is_valid_float(): + itemafterburnerprob = value.to_float() + else: + push_warning("Non-float value for itemafterburnerprob") + num_errors += 1 + "itemtransporterprob": + if value.is_valid_float(): + itemtransporterprob = value.to_float() + else: + push_warning("Non-float value for itemtransporterprob") + num_errors += 1 + "itemmirrorprob": + if value.is_valid_float(): + itemmirrorprob = value.to_float() + else: + push_warning("Non-float value for itemmirrorprob") + num_errors += 1 + "itemdeflectorprob": + if value.is_valid_float(): + itemdeflectorprob = value.to_float() + else: + push_warning("Non-float value for itemdeflectorprob") + num_errors += 1 + "itemhyperjumpprob": + if value.is_valid_float(): + itemhyperjumpprob = value.to_float() + else: + push_warning("Non-float value for itemhyperjumpprob") + num_errors += 1 + "itemphasingprob": + if value.is_valid_float(): + itemphasingprob = value.to_float() + else: + push_warning("Non-float value for itemphasingprob") + num_errors += 1 + "itemlaserprob": + if value.is_valid_float(): + itemlaserprob = value.to_float() + else: + push_warning("Non-float value for itemlaserprob") + num_errors += 1 + "itememergencythrustprob": + if value.is_valid_float(): + itememergencythrustprob = value.to_float() + else: + push_warning("Non-float value for itememergencythrustprob") + num_errors += 1 + "itemtractorbeamprob": + if value.is_valid_float(): + itemtractorbeamprob = value.to_float() + else: + push_warning("Non-float value for itemtractorbeamprob") + num_errors += 1 + "itemautopilotprob": + if value.is_valid_float(): + itemautopilotprob = value.to_float() + else: + push_warning("Non-float value for itemautopilotprob") + num_errors += 1 + "itememergencyshieldprob": + if value.is_valid_float(): + itememergencyshieldprob = value.to_float() + else: + push_warning("Non-float value for itememergencyshieldprob") + num_errors += 1 + "initialfuel": + if value.is_valid_float(): + initialfuel = value.to_float() + else: + push_warning("Non-float value for initialfuel") + num_errors += 1 + "initialtanks": + if value.is_valid_int(): + initialtanks = value.to_int() + else: + push_warning("Non-int value for initialtanks") + num_errors += 1 + "initialarmor": + if value.is_valid_int(): + initialarmor = value.to_int() + else: + push_warning("Non-int value for initialarmor") + num_errors += 1 + "initialecms": + if value.is_valid_int(): + initialecms = value.to_int() + else: + push_warning("Non-int value for initialecms") + num_errors += 1 + "initialmines": + if value.is_valid_int(): + initialmines = value.to_int() + else: + push_warning("Non-int value for initialmines") + num_errors += 1 + "initialmissiles": + if value.is_valid_int(): + initialmissiles = value.to_int() + else: + push_warning("Non-int value for initialmissiles") + num_errors += 1 + "initialcloaks": + if value.is_valid_int(): + initialcloaks = value.to_int() + else: + push_warning("Non-int value for initialcloaks") + num_errors += 1 + "initialsensors": + if value.is_valid_int(): + initialsensors = value.to_int() + else: + push_warning("Non-int value for initialsensors") + num_errors += 1 + "initialwideangles": + if value.is_valid_int(): + initialwideangles = value.to_int() + else: + push_warning("Non-int value for initialwideangles") + num_errors += 1 + "initialrearshots": + if value.is_valid_int(): + initialrearshots = value.to_int() + else: + push_warning("Non-int value for initialrearshots") + num_errors += 1 + "initialafterburners": + if value.is_valid_int(): + initialafterburners = value.to_int() + else: + push_warning("Non-int value for initialafterburners") + num_errors += 1 + "initialtransporters": + if value.is_valid_int(): + initialtransporters = value.to_int() + else: + push_warning("Non-int value for initialtransporters") + num_errors += 1 + "initialmirrors": + if value.is_valid_int(): + initialmirrors = value.to_int() + else: + push_warning("Non-int value for initialmirrors") + num_errors += 1 + "maxarmor": + if value.is_valid_int(): + maxarmor = value.to_int() + else: + push_warning("Non-int value for maxarmor") + num_errors += 1 + "initialdeflectors": + if value.is_valid_int(): + initialdeflectors = value.to_int() + else: + push_warning("Non-int value for initialdeflectors") + num_errors += 1 + "initialhyperjumps": + if value.is_valid_int(): + initialhyperjumps = value.to_int() + else: + push_warning("Non-int value for initialhyperjumps") + num_errors += 1 + "initialphasings": + if value.is_valid_int(): + initialphasings = value.to_int() + else: + push_warning("Non-int value for initialphasings") + num_errors += 1 + "initiallasers": + if value.is_valid_int(): + initiallasers = value.to_int() + else: + push_warning("Non-int value for initiallasers") + num_errors += 1 + "initialemergencythrusts": + if value.is_valid_int(): + initialemergencythrusts = value.to_int() + else: + push_warning("Non-int value for initialemergencythrusts") + num_errors += 1 + "initialtractorbeams": + if value.is_valid_int(): + initialtractorbeams = value.to_int() + else: + push_warning("Non-int value for initialtractorbeams") + num_errors += 1 + "initialautopilots": + if value.is_valid_int(): + initialautopilots = value.to_int() + else: + push_warning("Non-int value for initialautopilots") + num_errors += 1 + "initialemergencyshields": + if value.is_valid_int(): + initialemergencyshields = value.to_int() + else: + push_warning("Non-int value for initialemergencyshields") + num_errors += 1 + "maxfuel": + if value.is_valid_int(): + maxfuel = value.to_int() + else: + push_warning("Non-int value for maxfuel") + num_errors += 1 + "maxtanks": + if value.is_valid_int(): + maxtanks = value.to_int() + else: + push_warning("Non-int value for maxtanks") + num_errors += 1 + "maxecms": + if value.is_valid_int(): + maxecms = value.to_int() + else: + push_warning("Non-int value for maxecms") + num_errors += 1 + "maxmines": + if value.is_valid_int(): + maxmines = value.to_int() + else: + push_warning("Non-int value for maxmines") + num_errors += 1 + "maxmissiles": + if value.is_valid_int(): + maxmissiles = value.to_int() + else: + push_warning("Non-int value for maxmissiles") + num_errors += 1 + "maxcloaks": + if value.is_valid_int(): + maxcloaks = value.to_int() + else: + push_warning("Non-int value for maxcloaks") + num_errors += 1 + "maxsensors": + if value.is_valid_int(): + maxsensors = value.to_int() + else: + push_warning("Non-int value for maxsensors") + num_errors += 1 + "maxwideangles": + if value.is_valid_int(): + maxwideangles = value.to_int() + else: + push_warning("Non-int value for maxwideangles") + num_errors += 1 + "maxrearshots": + if value.is_valid_int(): + maxrearshots = value.to_int() + else: + push_warning("Non-int value for maxrearshots") + num_errors += 1 + "maxafterburners": + if value.is_valid_int(): + maxafterburners = value.to_int() + else: + push_warning("Non-int value for maxafterburners") + num_errors += 1 + "maxtransporters": + if value.is_valid_int(): + maxtransporters = value.to_int() + else: + push_warning("Non-int value for maxtransporters") + num_errors += 1 + "maxdeflectors": + if value.is_valid_int(): + maxdeflectors = value.to_int() + else: + push_warning("Non-int value for maxdeflectors") + num_errors += 1 + "maxphasings": + if value.is_valid_int(): + maxphasings = value.to_int() + else: + push_warning("Non-int value for maxphasings") + num_errors += 1 + "maxhyperjumps": + if value.is_valid_int(): + maxhyperjumps = value.to_int() + else: + push_warning("Non-int value for maxhyperjumps") + num_errors += 1 + "maxemergencythrusts": + if value.is_valid_int(): + maxemergencythrusts = value.to_int() + else: + push_warning("Non-int value for maxemergencythrusts") + num_errors += 1 + "maxlasers": + if value.is_valid_int(): + maxlasers = value.to_int() + else: + push_warning("Non-int value for maxlasers") + num_errors += 1 + "maxtractorbeams": + if value.is_valid_int(): + maxtractorbeams = value.to_int() + else: + push_warning("Non-int value for maxtractorbeams") + num_errors += 1 + "maxautopilots": + if value.is_valid_int(): + maxautopilots = value.to_int() + else: + push_warning("Non-int value for maxautopilots") + num_errors += 1 + "maxemergencyshields": + if value.is_valid_int(): + maxemergencyshields = value.to_int() + else: + push_warning("Non-int value for maxemergencyshields") + num_errors += 1 + "maxmirrors": + if value.is_valid_int(): + maxmirrors = value.to_int() + else: + push_warning("Non-int value for maxmirrors") + num_errors += 1 + "gameduration": + if value.is_valid_float(): + gameduration = value.to_float() + else: + push_warning("Non-float value for gameduration") + num_errors += 1 + "allowviewing": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + allowviewing = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for allowviewing") + num_errors += 1 + "friction": + if value.is_valid_float(): + friction = value.to_float() + else: + push_warning("Non-float value for friction") + num_errors += 1 + "blockfriction": + if value.is_valid_float(): + blockfriction = value.to_float() + else: + push_warning("Non-float value for blockfriction") + num_errors += 1 + "blockfrictionvisible": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + blockfrictionvisible = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-bool value for blockfrictionvisible") + num_errors += 1 + "coriolis": + if value.is_valid_int(): + coriolis = value.to_int() + else: + push_warning("Non-int value for coriolis") + num_errors += 1 + "checkpointradius": + if value.is_valid_float(): + checkpointradius = value.to_float() + else: + push_warning("Non-float value for checkpointradius") + num_errors += 1 + "racelaps": + if value.is_valid_int(): + racelaps = value.to_int() + else: + push_warning("Non-int value for racelaps") + num_errors += 1 + "lockotherteam": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + lockotherteam = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-float value for lockotherteam") + num_errors += 1 + "loseitemdestroys": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + loseitemdestroys = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-float value for loseitemdestroys") + num_errors += 1 + "usewreckage": + if value.to_lower() == "yes" or value.to_lower() == "true" or value.to_lower() == "no" or value.to_lower() == "false": + usewreckage = (value.to_lower() == "yes" or value.to_lower() == "true") + else: + push_warning("Non-float value for usewreckage") + num_errors += 1 + "maxoffensiveitems": + if value.is_valid_int(): + maxoffensiveitems = value.to_int() + else: + push_warning("Non-int value for maxoffensiveitems") + num_errors += 1 + "maxdefensiveitems": + if value.is_valid_int(): + maxdefensiveitems = value.to_int() + else: + push_warning("Non-int value for maxdefensiveitems") + num_errors += 1 + "rounddelay": + if value.is_valid_int(): + rounddelay = value.to_int() + else: + push_warning("Non-int value for rounddelay") + num_errors += 1 + "maxroundtime": + if value.is_valid_int(): + maxroundtime = value.to_int() + else: + push_warning("Non-int value for maxroundtime") + num_errors += 1 + "roundstoplay": + if value.is_valid_int(): + roundstoplay = value.to_int() + else: + push_warning("Non-int value for roundstoplay") + num_errors += 1 + "maxpausetime": + if value.is_valid_int(): + maxpausetime = value.to_int() + else: + push_warning("Non-int value for maxpausetime") + num_errors += 1 + _: + push_warning("Unknown option ", option) diff --git a/World/PlayerShip.gd b/World/PlayerShip.gd index d0ce52d..88c32b7 100644 --- a/World/PlayerShip.gd +++ b/World/PlayerShip.gd @@ -8,7 +8,6 @@ var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") var Bullet = preload("res://World/bullet.tscn") var thrust = 6.0 -var collision_damping = 0.1 # Set by the authority, synchronized on spawn. @export var player := 1 : @@ -47,5 +46,5 @@ func _physics_process(delta): var collision = move_and_collide(velocity * delta) if collision: - velocity = (1 - collision_damping) * velocity.bounce(collision.get_normal()) + velocity = (1 - $"../../Map/Options".playerwallbouncebrakefactor) * velocity.bounce(collision.get_normal()) diff --git a/World/PlayingField.gd b/World/PlayingField.gd index 5b5163e..c7a0684 100644 --- a/World/PlayingField.gd +++ b/World/PlayingField.gd @@ -1,12 +1,8 @@ extends Node2D -var options = {} -var base_positions: Array[Vector2i] - # Called when the node enters the scene tree for the first time. func _ready(): - default_options() - load_map("res://Maps/default.xp") + $Map.load_map("res://Maps/default.xp") # $"Player ship".position = Vector2(500., 500.) if not multiplayer.is_server(): return @@ -32,7 +28,7 @@ func add_player(id: int): var player_ship = preload("res://World/PlayerShip.tscn").instantiate() # Set player id. player_ship.player = id - player_ship.position = 64*base_positions[randi() % base_positions.size()] + Vector2i(32, 32) + player_ship.position = 64*$Map.base_positions[randi() % $Map.base_positions.size()] + Vector2i(32, 32) player_ship.rotation_degrees = -90 player_ship.name = str(id) $Players.add_child(player_ship, true) @@ -43,111 +39,14 @@ func del_player(id: int): return $Players.get_node(str(id)).queue_free() -func default_options(): - options["gravity"] = 100 - options["mapheight"] = 100 - -func load_map(file_name): - parse_map_file(file_name) - apply_options() - -func parse_map_file(file_name): - # Remove current map if any - $TileMap.clear() - - # Build a dictionary that translates letter codes from - # the map format to tiles - var tile_dictionary = {} - var atlas_source = $TileMap.tile_set.get_source(0) - for i in range(atlas_source.get_tiles_count()): - var tile_id = atlas_source.get_tile_id(i) - var tile_data = atlas_source.get_tile_data(tile_id, 0) - var letter_code = tile_data.get_custom_data("Letter code") - for letter in letter_code: - tile_dictionary[letter] = tile_id - - # Load the map from file - var mapfile = FileAccess.open(file_name, FileAccess.READ) - if not mapfile: - print("Couldn't open map file") - return - var multi_line_mode_option = "" - var multi_line_terminator = "" - var multi_line_content = "" - var line_number = 0 - while not mapfile.eof_reached(): - var line = mapfile.get_line() - line_number += 1 - if multi_line_mode_option: - if line.contains(multi_line_terminator): - options[multi_line_mode_option] = multi_line_content - multi_line_mode_option = "" - else: - multi_line_content += line - else: - # Remove comments - var comment_pos = line.find('#') - if comment_pos >= 0: - line = line.left(comment_pos) - # Get rid of extra whitespace - line = line.strip_edges() - # If what is left over is an empty line, skip it - if line.length() == 0: - continue - var option = line.split(':', true, 1) - if option.size() != 2: - print("Invalid data on line ", line_number) - continue - # Multiline values expand over many lindes until a specified keyword is reached - if option[1].contains("\\multiline:"): - multi_line_mode_option = option[0].strip_edges().to_lower() - multi_line_terminator = option[1].split("\\multiline:")[1].strip_edges() - continue - options[option[0].strip_edges().to_lower()] = option[1].strip_edges() - if multi_line_mode_option != "": - print("EOF reached before end of multiline") - - var edge_wrap = false - if options.has("edgewrap"): - edge_wrap = (options["edgewrap"] == "yes") - - if options.has("mapdata") and options.has("mapwidth") and options.has("mapheight"): - var width = int(options["mapwidth"]) - var height = int(options["mapheight"]) - var data = options["mapdata"] - for iy in range(height): - for ix in range(width): - var letter_code = data[iy * width + ix] - if tile_dictionary.has(letter_code): - $TileMap.set_cell(0, Vector2i(ix, iy), 0, tile_dictionary[letter_code]) - if "_0123456789".contains(letter_code): - base_positions.push_back(Vector2i(ix, iy)) - if edge_wrap: - if ix < width / 2: - base_positions[-1].x += width - if iy < height / 2: - base_positions[-1].y += height - if edge_wrap: - $TileMap.set_cell(0, Vector2i(ix + width, iy), 0, tile_dictionary[letter_code]) - $TileMap.set_cell(0, Vector2i(ix + width, iy + height), 0, tile_dictionary[letter_code]) - $TileMap.set_cell(0, Vector2i(ix, iy + height), 0, tile_dictionary[letter_code]) - - else: - print("Map data or dimensions missing") - -func apply_options(): - var width = int(options["mapwidth"]) - var height = int(options["mapheight"]) - $"Map boundaries/CollisionShape2D".shape.size = 64 * Vector2i(width, height) - $"Map boundaries".position = 64 * Vector2i(width, height) - # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): pass func _on_map_boundaries_body_exited(body): - var width = int(options["mapwidth"]) - var height = int(options["mapheight"]) + + var width = $Map/Options.mapwidth + var height = $Map/Options.mapheight if body.position.x < $"Map boundaries".position.x - 32*width: body.position.x += 64 * width diff --git a/World/PlayingField.tscn b/World/PlayingField.tscn index 3f3bc81..3eb45e4 100644 --- a/World/PlayingField.tscn +++ b/World/PlayingField.tscn @@ -1,7 +1,9 @@ -[gd_scene load_steps=6 format=3 uid="uid://ddr7q5f0xrfsm"] +[gd_scene load_steps=8 format=3 uid="uid://ddr7q5f0xrfsm"] [ext_resource type="Script" path="res://World/PlayingField.gd" id="1_ashcc"] [ext_resource type="Texture2D" uid="uid://d4hd1froa8gji" path="res://Images/tilemap.png" id="2_covyd"] +[ext_resource type="Script" path="res://World/Map.gd" id="3_1prtd"] +[ext_resource type="Script" path="res://World/Options.gd" id="4_36ml1"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_b2nj3"] texture = ExtResource("2_covyd") @@ -164,10 +166,14 @@ size = Vector2(6400, 6400) scale = Vector2(0.5, 0.5) script = ExtResource("1_ashcc") -[node name="TileMap" type="TileMap" parent="."] +[node name="Map" type="TileMap" parent="."] tile_set = SubResource("TileSet_8m2mo") cell_quadrant_size = 64 format = 2 +script = ExtResource("3_1prtd") + +[node name="Options" type="Node" parent="Map"] +script = ExtResource("4_36ml1") [node name="Map boundaries" type="Area2D" parent="."]