Back to home

TRON Light Cycles/Multiplayer snake

HHTS9
click to copy
This game is archived.
If you with to unarchive it, click the "restore" button in the options menu.

Category:
Custom game mode

Author:
CuddlyFlower

Rating:
5

Version:
1.0.0

Posted:
3 months ago

Last updated:
3 months ago

Tags:
while you wait snake deathmatch tron wall arena light cycle

Project Links

Share this workshop!

Options

TRON Light Cycles

Create walls behind you as you move and get other players to smash into them - but look out, as the same thing can happen to you! After spawning, players start with a temporary shield that prevents them from smashing into walls. If you don't know anything about TRON, think of it like multiplayer snake.

For further customization options (e.g. arena size, speed), check the first rule ("Options") in the workshop code.

Check the Discord for updates and discussion.

settings
{
	main
	{
		Description: "TRON Light Cycles - Updates at discord.gg/YP544CH"
	}

	lobby
	{
		Allow Players Who Are In Queue: Yes
		Map Rotation: Paused
		Match Voice Chat: Enabled
		Return To Lobby: Never
	}

	modes
	{
		Deathmatch
		{
			enabled maps
			{
				Workshop Expanse
			}
		}

		General
		{
			Allow Hero Switching: Off
			Enemy Health Bars: Off
			Game Mode Start: Immediately
			Hero Limit: 1 Per Game
			Respawn Time Scalar: 25%
			Score To Win: 30
			Self Initiated Respawn: Off
			Spawn Health Packs: Disabled
		}
	}

	heroes
	{
		General
		{
			Movement Speed: 300%
			Primary Fire: Off
			Quick Melee: Off
			Ultimate Ability: Off

			Ana
			{
				Biotic Grenade: Off
				No Scope: On
				Quick Melee: Off
				Sleep Dart: Off
				Ultimate Ability Nano Boost: Off
			}

			Ashe
			{
				Coach Gun: Off
				Dynamite: Off
				No Scope: On
				Primary Fire: Off
				Quick Melee: Off
				Ultimate Ability B.O.B.: Off
			}

			Baptiste
			{
				Immortality Field: Off
				Primary Fire: Off
				Quick Melee: Off
				Secondary Fire: Off
				Ultimate Ability Amplification Matrix: Off
			}

			Bastion
			{
				Primary Fire: Off
				Quick Melee: Off
				Reconfigure: Off
				Self-Repair: Off
				Ultimate Ability Configuration: Tank: Off
			}

			Brigitte
			{
				Barrier Shield: Off
				Primary Fire: Off
				Quick Melee: Off
				Repair Pack: Off
				Shield Bash: Off
				Ultimate Ability Rally: Off
				Whip Shot: Off
			}

			D.Va
			{
				Boosters: Off
				Defense Matrix: Off
				Micro Missiles: Off
				Primary Fire: Off
				Quick Melee: Off
				Spawn Without Mech: On
				Ultimate Ability Self-Destruct: Off
			}

			Doomfist
			{
				Primary Fire: Off
				Quick Melee: Off
				Rising Uppercut: Off
				Rocket Punch: Off
				Seismic Slam: Off
				Ultimate Ability Meteor Strike: Off
			}

			Hanzo
			{
				Lunge: Off
				Primary Fire: Off
				Quick Melee: Off
				Sonic Arrow: Off
				Storm Arrows: Off
				Ultimate Ability Dragonstrike: Off
			}

			Junkrat
			{
				Concussion Mine: Off
				Primary Fire: Off
				Quick Melee: Off
				Steel Trap: Off
				Ultimate Ability RIP-Tire: Off
			}

			McCree
			{
				Combat Roll: Off
				Flashbang: Off
				Primary Fire: Off
				Quick Melee: Off
				Secondary Fire: Off
				Ultimate Ability Deadeye: Off
			}

			Mei
			{
				Cryo-Freeze: Off
				Ice Wall: Off
				Primary Fire: Off
				Quick Melee: Off
				Secondary Fire: Off
				Ultimate Ability Blizzard: Off
			}

			Mercy
			{
				Guardian Angel: Off
				Primary Fire: Off
				Quick Melee: Off
				Regeneration: Off
				Resurrect: Off
				Secondary Fire: Off
				Ultimate Ability Valkyrie: Off
			}

			Moira
			{
				Biotic Orb: Off
				Fade: Off
				Primary Fire: Off
				Quick Melee: Off
				Secondary Fire: Off
				Ultimate Ability Coalescence: Off
			}

			Orisa
			{
				Fortify: Off
				Halt!: Off
				Primary Fire: Off
				Protective Barrier: Off
				Quick Melee: Off
				Ultimate Ability Supercharger: Off
			}

			Pharah
			{
				Concussive Blast: Off
				Hover Jets: Off
				Jump Jet: Off
				Primary Fire: Off
				Quick Melee: Off
				Ultimate Ability Barrage: Off
			}

			Reaper
			{
				Primary Fire: Off
				Quick Melee: Off
				Shadow Step: Off
				Ultimate Ability Death Blossom: Off
				Wraith Form: Off
			}

			Reinhardt
			{
				Barrier Field: Off
				Charge: Off
				Fire Strike: Off
				Primary Fire: Off
				Quick Melee: Off
				Ultimate Ability Earthshatter: Off
			}

			Roadhog
			{
				Chain Hook: Off
				Primary Fire: Off
				Quick Melee: Off
				Secondary Fire: Off
				Spawn With Ultimate Ready: On
				Take a Breather: Off
				Ultimate Ability Whole Hog: Off
			}

			Sigma
			{
				Accretion: Off
				Experimental Barrier: Off
				Kinetic Grasp: Off
				Primary Fire: Off
				Quick Melee: Off
				Ultimate Ability Gravitic Flux: Off
			}

			Soldier: 76
			{
				Biotic Field: Off
				Helix Rockets: Off
				Primary Fire: Off
				Quick Melee: Off
				Sprint: Off
				Ultimate Ability Tactical Visor: Off
			}

			Symmetra
			{
				Primary Fire: Off
				Quick Melee: Off
				Secondary Fire: Off
				Sentry Turret: Off
				Teleporter: Off
				Ultimate Ability Photon Barrier: Off
			}

			Torbjörn
			{
				Deploy Turret: Off
				Overload: Off
				Primary Fire: Off
				Quick Melee: Off
				Secondary Fire: Off
				Ultimate Ability Molten Core: Off
			}

			Widowmaker
			{
				Grappling Hook: Off
				No Scope: On
				Primary Fire: Off
				Quick Melee: Off
				Ultimate Ability Infra-Sight: Off
				Venom Mine: Off
			}

			Winston
			{
				Barrier Projector: Off
				Jump Pack: Off
				Primary Fire: Off
				Quick Melee: Off
				Ultimate Ability Primal Rage: Off
			}

			Wrecking Ball
			{
				Adaptive Shield: Off
				Grappling Claw: Off
				Piledriver: Off
				Primary Fire: Off
				Quick Melee: Off
				Roll: Off
				Ultimate Ability Minefield: Off
			}

			Zarya
			{
				Particle Barrier: Off
				Primary Fire: Off
				Projected Barrier: Off
				Quick Melee: Off
				Secondary Fire: Off
				Ultimate Ability Graviton Surge: Off
			}

			Zenyatta
			{
				Orb of Discord: Off
				Orb of Harmony: Off
				Primary Fire: Off
				Quick Melee: Off
				Secondary Fire: Off
				Ultimate Ability Transcendence: Off
			}

			disabled heroes
			{
				Genji
				Junkrat
				Lúcio
				Sombra
				Tracer
				Wrecking Ball
			}
		}
	}
}

variables
{
	global:
		0: Nodes_position_x
		1: Initial_spawn_done
		2: Nodes_count
		3: Nodes_position_x_start
		4: Nodes_position_x_end
		5: Nodes_position_z
		6: Initial_spawn_positions
		7: Nodes_position_z_count
		8: Nodes_position_z_start
		9: Nodes_position_z_end
		10: Nodes_stamp
		11: Nodes_created_entities
		12: Nodes_links
		13: Nodes_associated_player_id
		14: Movements_player_direction
		15: Movements_player_x_z
		16: Movements_player_id
		17: Border_entities
		18: Border_variable
		19: Temp_notified_by
		20: Temp_notified_players
		21: Temp_Value
		22: Temp_Value2
		23: Temp_parent_index
		24: Temp_child_index
		25: Iterator_index
		26: Temp_index
		27: Temp_array
		28: Temp_break
		29: Option_base_speed_multiplier
		30: Option_center
		31: Option_arena_size
		32: Option_max_wall_segments
		33: Option_min_throttle
		34: Option_dir_choosing_time
		35: Spawn_position_index
		36: Option_turn_delay
		37: Temp_leave_index
		38: Node_index_to_be_removed
		39: Option_power_up_point_max
		40: Power_up_entities
		41: Power_up_positions
		42: Temp_power_up_position
		43: Power_up_points_count
		44: Power_up_type
		45: Temp_leave_count
		46: Player_count
		47: Option_enable_dynamic_max_walls
		48: Option_max_entities

	player:
		0: player_direction
		2: next_wall_indices
		3: requires_next_wall_update
		4: next_wall_stamps
		5: last_checked_value
		6: next_wall_value
		7: spawn_position
		8: corresponding_player_index
		9: is_spawning
		10: initial_rotation
		11: shield_active
		12: previous_node_position
		13: next_node_position
		14: current_node_count
		15: created_node_entities
		16: associated_node_position_indices
		18: dynamic_wall
		20: requires_initial_spawn
		21: temp_index
		22: temp_value_1
		23: temp_value_2
		24: temp_value_3
		25: throttle_before_direction_change
		26: shield_entities
		27: requires_respawn
		28: camera_mode
		29: is_choosing_spawn_direction
		30: chase_variable
}

subroutines
{
	0: add_node
	1: add_node_entity
	2: remove_node
	3: remove_node_x_z
	4: set_next_wall_x
	5: set_next_wall_z
	6: notify_players_next_wall_update
	8: update_next_node_position
	9: player_starts_moving
	10: replace_dynamic_wall
	11: kill_on_collision
	12: update_player_direction
	13: enable_shield_break
	14: disable_shield_break
	15: choose_direction
	16: initialize_player
	17: set_initial_rotation
	18: reset_player
	19: setup_player_movements
	20: remove_node_links
	21: cleanup
}

rule("Options")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		"Center of arena (default: 0, 0, 0)"
		Set Global Variable(Option_center, Vector(0, 0, 0));
		"Size of arena (default: 200, i.e. 200 x 200 units)"
		Set Global Variable(Option_arena_size, 150);
		"Number of wall segments - keep low (less than 9 for 12 players) to avoid reaching the entitiy limit (default: 8)"
		Set Global Variable(Option_max_wall_segments, 8);
		"Minimum throttle (forced forward movement) of the player (value between 0 and 1, default: 0.5)"
		Set Global Variable(Option_min_throttle, 0.500);
		"Base speed multiplier (default: 250)"
		Set Global Variable(Option_base_speed_multiplier, 300);
		"Time in seconds for choosing direction after spawn (default: 3)"
		Set Global Variable(Option_dir_choosing_time, 3);
		"Delay after each turn (default: 0.250)"
		Set Global Variable(Option_turn_delay, 0.250);
		"Number of power ups that give extra points (default: 4)"
		Set Global Variable(Option_power_up_point_max, 4);
		"Set wall segment limit according to number of players - overrides max wall set (default: FALSE)"
		Set Global Variable(Option_enable_dynamic_max_walls, True);
		"Used in combination with the dynamic wall limit to determine walls per player (default: 100)"
		Set Global Variable(Option_max_entities, 100);
	}
}

rule("Disable reporting")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		Disable Inspector Recording;
	}
}

rule("Create environment")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		Create Effect(All Players(All Teams), Sphere, Sky Blue, Global Variable(Option_center), Add(Global Variable(Option_arena_size), 0),
			Visible To);
		Create Effect(All Players(All Teams), Light Shaft, Yellow, Vector(Add(Multiply(Global Variable(Option_arena_size), 1), 0), 0, 0),
			5, Visible To);
		Create Effect(All Players(All Teams), Light Shaft, Green, Vector(Add(Multiply(Global Variable(Option_arena_size), -1.000), 0), 0,
			0), 5, Visible To);
		Create Effect(All Players(All Teams), Light Shaft, Purple, Vector(0, 0, Add(Multiply(Global Variable(Option_arena_size), 1), 0)),
			5, Visible To);
		Create Effect(All Players(All Teams), Light Shaft, Aqua, Vector(0, 0, Add(Multiply(Global Variable(Option_arena_size), -1.000),
			0)), 5, Visible To);
	}
}

rule("Create borders")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		Set Global Variable(Border_entities, Empty Array);
		Set Global Variable(Border_variable, Multiply(0.500, Global Variable(Option_arena_size)));
		Create Beam Effect(All Players(All Teams), Bad Beam, Vector(Add(X Component Of(Global Variable(Option_center)), Global Variable(
			Border_variable)), 0.100, Add(Z Component Of(Global Variable(Option_center)), Global Variable(Border_variable))), Vector(Add(
			X Component Of(Global Variable(Option_center)), Multiply(-1.000, Global Variable(Border_variable))), 0.100, Add(Z Component Of(
			Global Variable(Option_center)), Global Variable(Border_variable))), Sky Blue, Visible To Position and Radius);
		Modify Global Variable(Border_entities, Append To Array, Last Created Entity);
		Create Beam Effect(All Players(All Teams), Bad Beam, Vector(Multiply(-1.000, Add(X Component Of(Global Variable(Option_center)),
			Global Variable(Border_variable))), 0.100, Multiply(-1.000, Add(Z Component Of(Global Variable(Option_center)),
			Global Variable(Border_variable)))), Vector(Add(X Component Of(Global Variable(Option_center)), Multiply(-1.000,
			Global Variable(Border_variable))), 0.100, Add(Z Component Of(Global Variable(Option_center)), Global Variable(
			Border_variable))), Sky Blue, Visible To Position and Radius);
		Modify Global Variable(Border_entities, Append To Array, Last Created Entity);
		Create Beam Effect(All Players(All Teams), Bad Beam, Vector(Add(X Component Of(Global Variable(Option_center)), Global Variable(
			Border_variable)), 0.100, Add(Z Component Of(Global Variable(Option_center)), Global Variable(Border_variable))), Vector(Add(
			X Component Of(Global Variable(Option_center)), Multiply(1, Global Variable(Border_variable))), 0.100, Add(Z Component Of(
			Global Variable(Option_center)), Multiply(-1.000, Global Variable(Border_variable)))), Sky Blue,
			Visible To Position and Radius);
		Modify Global Variable(Border_entities, Append To Array, Last Created Entity);
		Create Beam Effect(All Players(All Teams), Bad Beam, Vector(Add(X Component Of(Global Variable(Option_center)), Multiply(-1.000,
			Global Variable(Border_variable))), 0.100, Add(Z Component Of(Global Variable(Option_center)), Multiply(-1.000,
			Global Variable(Border_variable)))), Vector(Add(X Component Of(Global Variable(Option_center)), Multiply(1, Global Variable(
			Border_variable))), 0.100, Add(Z Component Of(Global Variable(Option_center)), Multiply(-1.000, Global Variable(
			Border_variable)))), Sky Blue, Visible To Position and Radius);
		Modify Global Variable(Border_entities, Append To Array, Last Created Entity);
		Create Effect(All Players(All Teams), Orb, Sky Blue, Vector(Multiply(1, Global Variable(Border_variable)), 0.100, Multiply(1,
			Global Variable(Border_variable))), 0.200, Visible To);
		Create Effect(All Players(All Teams), Orb, Sky Blue, Vector(Multiply(-1.000, Global Variable(Border_variable)), 0.100, Multiply(1,
			Global Variable(Border_variable))), 0.200, Visible To);
		Create Effect(All Players(All Teams), Orb, Sky Blue, Vector(Multiply(1, Global Variable(Border_variable)), 0.100, Multiply(-1.000,
			Global Variable(Border_variable))), 0.200, Visible To);
		Create Effect(All Players(All Teams), Orb, Sky Blue, Vector(Multiply(-1.000, Global Variable(Border_variable)), 0.100, Multiply(
			-1.000, Global Variable(Border_variable))), 0.200, Visible To);
	}
}

rule("Setup global variables")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		Set Global Variable(Nodes_position_x, Empty Array);
		Set Global Variable(Nodes_position_x_start, -1.000);
		Set Global Variable(Nodes_position_x_end, -1.000);
		Set Global Variable(Nodes_count, 0);
		Set Global Variable(Nodes_position_z, Empty Array);
		Set Global Variable(Nodes_position_z_start, -1.000);
		Set Global Variable(Nodes_position_z_end, -1.000);
		Set Global Variable(Nodes_position_z_count, 0);
		Set Global Variable(Nodes_created_entities, Empty Array);
		Set Global Variable(Nodes_links, Empty Array);
		Set Global Variable(Nodes_associated_player_id, Empty Array);
		Set Global Variable(Movements_player_direction, Empty Array);
		Set Global Variable(Movements_player_x_z, Empty Array);
		Set Global Variable(Movements_player_id, Empty Array);
		Set Global Variable(Temp_array, Empty Array);
		Set Global Variable(Temp_break, False);
		Set Global Variable(Nodes_stamp, Empty Array);
		Set Global Variable(Initial_spawn_done, False);
		Set Global Variable(Power_up_entities, Empty Array);
		Set Global Variable(Power_up_positions, Empty Array);
		Set Global Variable(Power_up_type, Empty Array);
	}
}

rule("Create power up - points (type: 1)")
{
	event
	{
		Ongoing - Global;
	}

	conditions
	{
		Is Game In Progress == True;
		Global Variable(Power_up_points_count) < Global Variable(Option_power_up_point_max);
	}

	actions
	{
		Set Global Variable(Temp_power_up_position, Vector(Random Integer(Multiply(-1.000, Subtract(Global Variable(Border_variable), 5)),
			Subtract(Global Variable(Border_variable), 5)), 0, Random Integer(Multiply(-1.000, Subtract(Global Variable(Border_variable),
			5)), Subtract(Global Variable(Border_variable), 5))));
		Set Global Variable(Temp_index, 0);
		While(Compare(Value In Array(Global Variable(Power_up_positions), Global Variable(Temp_index)), !=, 0));
			Modify Global Variable(Temp_index, Add, 1);
		End;
		Set Global Variable At Index(Power_up_positions, Global Variable(Temp_index), Global Variable(Temp_power_up_position));
		Create Effect(All Players(All Teams), Sphere, Green, Global Variable(Temp_power_up_position), 3, Visible To);
		Set Global Variable At Index(Power_up_entities, Global Variable(Temp_index), Last Created Entity);
		Set Global Variable At Index(Power_up_type, Global Variable(Temp_index), 1);
		Modify Global Variable(Power_up_points_count, Add, 1);
		Wait(1, Ignore Condition);
		Loop If Condition Is True;
	}
}

rule("Collect power ups")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Is Alive(Event Player) == True;
		Global Variable(Power_up_points_count) > 0;
		Count Of(Filtered Array(Global Variable(Power_up_positions), And(Compare(Current Array Element, !=, 0), Compare(Distance Between(
			Position Of(Event Player), Current Array Element), <=, 3)))) > 0;
	}

	actions
	{
		For Player Variable(Event Player, temp_index, 0, Count Of(Global Variable(Power_up_positions)), 1);
			If(And(Compare(Value In Array(Global Variable(Power_up_positions), Player Variable(Event Player, temp_index)), !=, 0), Compare(
				Distance Between(Position Of(Event Player), Value In Array(Global Variable(Power_up_positions), Player Variable(Event Player,
				temp_index))), <=, 3)));
				Destroy Effect(Value In Array(Global Variable(Power_up_entities), Player Variable(Event Player, temp_index)));
				Set Global Variable At Index(Power_up_entities, Player Variable(Event Player, temp_index), 0);
				Play Effect(All Players(All Teams), Ring Explosion, Green, Value In Array(Global Variable(Power_up_positions), Player Variable(
					Event Player, temp_index)), 4);
				Set Global Variable At Index(Power_up_positions, Player Variable(Event Player, temp_index), 0);
				Set Player Score(Event Player, Add(Score Of(Event Player), 1));
				Modify Global Variable(Power_up_points_count, Subtract, 1);
			End;
		End;
	}
}

rule("Setup mode")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		"Reduce hero selection time"
		Set Match Time(10);
		Disallow Button(All Players(All Teams), Crouch);
		Disallow Button(All Players(All Teams), Jump);
	}
}

rule("Setup player variables")
{
	event
	{
		Player Joined Match;
		All;
		All;
	}

	conditions
	{
		Array Contains(Global Variable(Movements_player_id), Event Player) == False;
	}

	actions
	{
		Set Player Variable(Event Player, created_node_entities, Empty Array);
		Set Player Variable(Event Player, associated_node_position_indices, Empty Array);
		Set Player Variable(Event Player, next_wall_indices, Empty Array);
		Call Subroutine(setup_player_movements);
		Set Player Variable(Event Player, requires_next_wall_update, False);
		Set Player Variable(Event Player, is_spawning, True);
		Set Player Variable(Event Player, shield_active, False);
		Set Player Variable(Event Player, shield_entities, Empty Array);
		Set Player Variable(Event Player, requires_initial_spawn, Not(Is Game In Progress));
		Set Player Variable(Event Player, requires_respawn, True);
		Set Player Variable(Event Player, camera_mode, 0);
		Disallow Button(Event Player, Crouch);
		Set Player Variable(Event Player, is_choosing_spawn_direction, False);
		Disallow Button(Event Player, Crouch);
		Disallow Button(Event Player, Jump);
	}
}

rule("Setup player movement variables")
{
	event
	{
		Subroutine;
		setup_player_movements;
	}

	actions
	{
		Set Global Variable(Temp_index, 0);
		While(Compare(Value In Array(Global Variable(Movements_player_id), Global Variable(Temp_index)), !=, 0));
			Modify Global Variable(Temp_index, Add, 1);
		End;
		Set Global Variable At Index(Movements_player_id, Global Variable(Temp_index), Event Player);
		Set Global Variable At Index(Movements_player_x_z, Global Variable(Temp_index), Vector(-1.000, 0, -1.000));
		Set Global Variable At Index(Movements_player_direction, Global Variable(Temp_index), Vector(-1.000, 0, 0));
		Set Player Variable(Event Player, corresponding_player_index, Global Variable(Temp_index));
	}
}

rule("Setup player effects")
{
	event
	{
		Player Joined Match;
		All;
		All;
	}

	conditions
	{
		Is Game In Progress == True;
	}

	actions
	{
		Create Effect(All Players(All Teams), Good Aura Sound, White, Position Of(Event Player), 10000, Visible To Position and Radius);
	}
}

rule("Set player Camera")
{
	event
	{
		Player Joined Match;
		All;
		All;
	}

	actions
	{
		Start Camera(Event Player, Add(Position Of(Event Player), World Vector Of(Vector(0, 20, Subtract(-20.000, Min(Multiply(0.400, Add(
			Absolute Value(X Component Of(Velocity Of(Event Player))), Absolute Value(Z Component Of(Velocity Of(Event Player))))), 45))),
			Event Player, Rotation)), Event Player, 5);
	}
}

rule("Change camera to dynamic")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Player Variable(Event Player, camera_mode) == 1;
		Is Button Held(Event Player, Reload) == True;
	}

	actions
	{
		Stop Camera(Event Player);
		Start Camera(Event Player, Add(Position Of(Event Player), World Vector Of(Vector(0, 20, Subtract(-20.000, Min(Multiply(0.400, Add(
			Absolute Value(X Component Of(Velocity Of(Event Player))), Absolute Value(Z Component Of(Velocity Of(Event Player))))), 45))),
			Event Player, Rotation)), Event Player, 5);
		Wait(0.500, Ignore Condition);
		Set Player Variable(Event Player, camera_mode, 0);
	}
}

rule("Change camera to static")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Player Variable(Event Player, camera_mode) == 0;
		Is Button Held(Event Player, Reload) == True;
	}

	actions
	{
		Stop Camera(Event Player);
		Start Camera(Event Player, Add(Position Of(Event Player), Vector(0, 75, -2.000)), Event Player, 10);
		Wait(0.500, Ignore Condition);
		Set Player Variable(Event Player, camera_mode, 1);
	}
}

rule("Setup initial spawn positions")
{
	event
	{
		Ongoing - Global;
	}

	conditions
	{
		Is Assembling Heroes == False;
	}

	actions
	{
		Set Global Variable(Player_count, Count Of(All Players(All Teams)));
		Set Global Variable(Temp_Value, Max(2, Global Variable(Player_count)));
		Set Global Variable(Temp_Value, Divide(360, Global Variable(Temp_Value)));
		"Radius"
		Set Global Variable(Temp_Value2, Subtract(Global Variable(Border_variable), 5));
		Set Global Variable(Temp_index, 0);
		Set Global Variable(Initial_spawn_positions, Empty Array);
		While(Compare(Global Variable(Temp_index), <, 360));
			Modify Global Variable(Initial_spawn_positions, Append To Array, Vector(Add(0, Multiply(Global Variable(Temp_Value2),
				Cosine From Degrees(Global Variable(Temp_index)))), 0, Add(0, Multiply(Global Variable(Temp_Value2), Sine From Degrees(
				Global Variable(Temp_index))))));
			Set Global Variable(Temp_index, Add(Global Variable(Temp_index), Global Variable(Temp_Value)));
		End;
	}
}

rule("Initialize player")
{
	event
	{
		Subroutine;
		initialize_player;
	}

	actions
	{
		Call Subroutine(enable_shield_break);
		Set Status(Event Player, Null, Phased Out, 9999);
		Set Move Speed(Event Player, 0);
		Start Forcing Throttle(Event Player, 0, 0, 0, 0, 0, 1);
		Set Player Variable(Event Player, is_spawning, True);
		Set Player Variable(Event Player, initial_rotation, Vector(-1.000, 0, 0));
		Set Player Variable(Event Player, player_direction, Player Variable(Event Player, initial_rotation));
	}
}

rule("Set initial rotation")
{
	event
	{
		Subroutine;
		set_initial_rotation;
	}

	actions
	{
		Set Player Variable(Event Player, temp_value_1, Normalize(Player Variable(Event Player, spawn_position)));
		Set Player Variable(Event Player, temp_value_1, Vector(Round To Integer(X Component Of(Player Variable(Event Player,
			temp_value_1)), To Nearest), 0, Round To Integer(Z Component Of(Player Variable(Event Player, temp_value_1)), To Nearest)));
		Set Player Variable(Event Player, temp_value_1, Multiply(-1.000, Player Variable(Event Player, temp_value_1)));
		Set Player Variable(Event Player, initial_rotation, Player Variable(Event Player, temp_value_1));
		If(Compare(Player Variable(Event Player, initial_rotation), ==, Vector(0, 0, 0)));
			Set Player Variable(Event Player, initial_rotation, Normalize(Vector(Random Real(-1.000, 1), 0, 0)));
		Else If(And(Compare(X Component Of(Player Variable(Event Player, initial_rotation)), !=, 0), Compare(Z Component Of(
				Player Variable(Event Player, initial_rotation)), !=, 0)));
			Set Player Variable(Event Player, initial_rotation, Vector(X Component Of(Player Variable(Event Player, initial_rotation)), 0, 0));
		End;
		Set Player Variable(Event Player, player_direction, Player Variable(Event Player, initial_rotation));
		Set Global Variable At Index(Movements_player_direction, Player Variable(Event Player, corresponding_player_index),
			Player Variable(Event Player, player_direction));
	}
}

rule("Set fixed spawn position at match start")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Player Variable(Event Player, spawn_position) == 0;
		Has Spawned(Event Player) == True;
		Player Variable(Event Player, requires_initial_spawn) == True;
	}

	actions
	{
		Call Subroutine(initialize_player);
		Set Player Variable(Event Player, spawn_position, Value In Array(Global Variable(Initial_spawn_positions), Global Variable(
			Spawn_position_index)));
		Call Subroutine(set_initial_rotation);
		Teleport(Event Player, Player Variable(Event Player, spawn_position));
		Modify Global Variable(Spawn_position_index, Add, 1);
		Wait(1, Ignore Condition);
		Stop Facing(Event Player);
		Set Facing(Event Player, Player Variable(Event Player, initial_rotation), To World);
		Start Facing(Event Player, Player Variable(Event Player, initial_rotation), 9999, To World, None);
		Wait(4, Ignore Condition);
		Call Subroutine(choose_direction);
		Set Player Variable(Event Player, requires_initial_spawn, False);
	}
}

rule("Set random player spawn during match")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Is Alive(Event Player) == True;
		Player Variable(Event Player, requires_initial_spawn) == False;
		Player Variable(Event Player, requires_respawn) == True;
		Is Game In Progress == True;
		Has Spawned(Event Player) == True;
	}

	actions
	{
		Call Subroutine(initialize_player);
		Set Player Variable(Event Player, spawn_position, Vector(Add(X Component Of(Global Variable(Option_center)), Random Integer(
			Multiply(-1.000, Subtract(Global Variable(Border_variable), 5)), Subtract(Global Variable(Border_variable), 5))), 0, Add(
			Z Component Of(Global Variable(Option_center)), Random Integer(Multiply(-1.000, Subtract(Global Variable(Border_variable), 5)),
			Subtract(Global Variable(Border_variable), 5)))));
		Call Subroutine(set_initial_rotation);
		Teleport(Event Player, Player Variable(Event Player, spawn_position));
		Stop Facing(Event Player);
		Set Facing(Event Player, Player Variable(Event Player, initial_rotation), To World);
		Start Facing(Event Player, Player Variable(Event Player, initial_rotation), 9999, To World, None);
		Call Subroutine(choose_direction);
	}
}

rule("Start direction choosing phase")
{
	event
	{
		Subroutine;
		choose_direction;
	}

	actions
	{
		Big Message(Event Player, Custom String("{0} Choose direction! {1}", Icon String(Arrow: Left), Icon String(Arrow: Right), Null));
		Set Player Variable(Event Player, is_choosing_spawn_direction, True);
		Set Player Variable(Event Player, chase_variable, Global Variable(Option_dir_choosing_time));
		Create Effect(All Players(All Teams), Light Shaft, Sky Blue, Event Player, Player Variable(Event Player, chase_variable),
			Visible To Position and Radius);
		Chase Player Variable At Rate(Event Player, chase_variable, 0, 1, None);
		Wait(Global Variable(Option_dir_choosing_time), Ignore Condition);
		Stop Chasing Player Variable(Event Player, chase_variable);
		Destroy Effect(Last Created Entity);
		Big Message(Event Player, Custom String("Go!", Null, Null, Null));
		Set Player Variable(Event Player, is_choosing_spawn_direction, False);
		Set Player Variable(Event Player, is_spawning, False);
		Set Player Variable(Event Player, requires_respawn, False);
		Wait(0.200, Ignore Condition);
		Call Subroutine(player_starts_moving);
		Wait(3, Ignore Condition);
		Call Subroutine(disable_shield_break);
	}
}

rule("Change spawn direction")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Player Variable(Event Player, is_choosing_spawn_direction) == True;
		Player Variable(Event Player, is_spawning) == True;
		Is Alive(Event Player) == True;
		X Component Of(Throttle Of(Event Player)) != 0;
		Player Variable(Event Player, throttle_before_direction_change) == 0;
	}

	actions
	{
		Set Player Variable(Event Player, throttle_before_direction_change, Vector(Round To Integer(X Component Of(Throttle Of(
			Event Player)), To Nearest), 0, Round To Integer(Z Component Of(Throttle Of(Event Player)), To Nearest)));
		Start Forcing Throttle(Event Player, 0, 0, 0, 0, 0, 0);
		Stop Facing(Event Player);
		Start Facing(Event Player, World Vector Of(Vector(X Component Of(Player Variable(Event Player, throttle_before_direction_change)),
			0, 0), Event Player, Rotation), 10000, To World, None);
		Wait(Global Variable(Option_turn_delay), Ignore Condition);
		"Update direction"
		Call Subroutine(update_player_direction);
		Start Forcing Throttle(Event Player, 0, 0, 0, 0, 0, 1);
		Set Player Variable(Event Player, throttle_before_direction_change, 0);
	}
}

rule("Player starts moving")
{
	event
	{
		Subroutine;
		player_starts_moving;
	}

	actions
	{
		Set Move Speed(Event Player, Global Variable(Option_base_speed_multiplier));
		Start Forcing Throttle(Event Player, Global Variable(Option_min_throttle), 1, 0, 0, 0, 1);
		Start Accelerating(Event Player, Vector(0, 0, 1), 10000, Multiply(Z Component Of(Throttle Of(Event Player)), 2000), To Player,
			Direction Rate and Max Speed);
		Set Player Variable(Event Player, next_node_position, Vector(X Component Of(Position Of(Event Player)), Y Component Of(Position Of(
			Event Player)), Z Component Of(Position Of(Event Player))));
		Set Player Variable(Event Player, previous_node_position, Player Variable(Event Player, next_node_position));
		Call Subroutine(add_node);
		Call Subroutine(replace_dynamic_wall);
		Call Subroutine(notify_players_next_wall_update);
	}
}

rule("Change move direction")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Is Alive(Event Player) == True;
		Player Variable(Event Player, is_spawning) == False;
		Is Moving(Event Player) == True;
		X Component Of(Throttle Of(Event Player)) != 0;
		Player Variable(Event Player, throttle_before_direction_change) == 0;
	}

	actions
	{
		Set Player Variable(Event Player, throttle_before_direction_change, Vector(Round To Integer(X Component Of(Throttle Of(
			Event Player)), To Nearest), 0, Round To Integer(Z Component Of(Throttle Of(Event Player)), To Nearest)));
		Start Forcing Throttle(Event Player, Global Variable(Option_min_throttle), 1, 0, 0, 0, 0);
		If(Compare(Global Variable(Option_enable_dynamic_max_walls), ==, True));
			Set Global Variable(Option_max_wall_segments, Round To Integer(Divide(Global Variable(Option_max_entities), Global Variable(
				Player_count)), To Nearest));
		End;
		If(Compare(Player Variable(Event Player, current_node_count), >, Global Variable(Option_max_wall_segments)));
			Call Subroutine(remove_node);
		End;
		Stop Facing(Event Player);
		Start Facing(Event Player, World Vector Of(Vector(X Component Of(Player Variable(Event Player, throttle_before_direction_change)),
			0, 0), Event Player, Rotation), 10000, To World, None);
		Wait(Global Variable(Option_turn_delay), Ignore Condition);
		Call Subroutine(update_next_node_position);
		"Update direction"
		Call Subroutine(update_player_direction);
		If(Compare(X Component Of(Player Variable(Event Player, player_direction)), !=, 0));
			Set Player Variable(Event Player, last_checked_value, X Component Of(Player Variable(Event Player, next_node_position)));
			Call Subroutine(set_next_wall_x);
		Else If(Compare(Z Component Of(Player Variable(Event Player, player_direction)), !=, 0));
			Set Player Variable(Event Player, last_checked_value, Z Component Of(Player Variable(Event Player, next_node_position)));
			Call Subroutine(set_next_wall_z);
		End;
		Set Global Variable At Index(Movements_player_x_z, Player Variable(Event Player, corresponding_player_index), Position Of(
			Event Player));
		Call Subroutine(add_node);
		Call Subroutine(replace_dynamic_wall);
		Call Subroutine(notify_players_next_wall_update);
		Start Forcing Throttle(Event Player, Global Variable(Option_min_throttle), 1, 0, 0, 0, 1);
		Set Player Variable(Event Player, throttle_before_direction_change, 0);
	}
}

rule("Update next node position")
{
	event
	{
		Subroutine;
		update_next_node_position;
	}

	actions
	{
		Set Player Variable(Event Player, previous_node_position, Player Variable(Event Player, next_node_position));
		If(Compare(Z Component Of(Player Variable(Event Player, player_direction)), !=, 0));
			Set Player Variable(Event Player, next_node_position, Vector(X Component Of(Player Variable(Event Player, previous_node_position)),
				0.500, Z Component Of(Position Of(Event Player))));
		Else;
			Set Player Variable(Event Player, next_node_position, Vector(X Component Of(Position Of(Event Player)), 0.500, Z Component Of(
				Player Variable(Event Player, previous_node_position))));
		End;
	}
}

rule("Update player direction")
{
	event
	{
		Subroutine;
		update_player_direction;
	}

	actions
	{
		If(Compare(X Component Of(Player Variable(Event Player, player_direction)), !=, 0));
			Set Player Variable(Event Player, player_direction, Vector(0, 0, Multiply(-1.000, Multiply(X Component Of(Player Variable(
				Event Player, player_direction)), X Component Of(Player Variable(Event Player, throttle_before_direction_change))))));
		Else;
			Set Player Variable(Event Player, player_direction, Vector(Multiply(Z Component Of(Player Variable(Event Player,
				player_direction)), X Component Of(Player Variable(Event Player, throttle_before_direction_change))), 0, 0));
		End;
		Set Global Variable At Index(Movements_player_direction, Player Variable(Event Player, corresponding_player_index),
			Player Variable(Event Player, player_direction));
	}
}

rule("Add Node")
{
	event
	{
		Subroutine;
		add_node;
	}

	actions
	{
		Set Global Variable(Temp_index, 0);
		Set Global Variable(Temp_parent_index, -1.000);
		Set Global Variable(Temp_child_index, Subtract(Global Variable(Nodes_position_x_start), 0));
		Set Global Variable(Iterator_index, Global Variable(Nodes_position_x_start));
		While(And(Compare(Y Component Of(Value In Array(Global Variable(Nodes_position_x), Global Variable(Iterator_index))), <,
			X Component Of(Player Variable(Event Player, next_node_position))), Compare(Global Variable(Iterator_index), !=, -1.000)));
			Set Global Variable(Temp_parent_index, Global Variable(Iterator_index));
			Set Global Variable(Iterator_index, Z Component Of(Value In Array(Global Variable(Nodes_position_x), Global Variable(
				Iterator_index))));
			Set Global Variable(Temp_child_index, Global Variable(Iterator_index));
		End;
		While(Compare(Value In Array(Global Variable(Nodes_position_x), Global Variable(Temp_index)), !=, 0));
			Modify Global Variable(Temp_index, Add, 1);
		End;
		"Set x position"
		Set Global Variable At Index(Nodes_position_x, Global Variable(Temp_index), Vector(Global Variable(Temp_parent_index),
			X Component Of(Player Variable(Event Player, next_node_position)), Global Variable(Temp_child_index)));
		"Reset start x"
		If(Or(Compare(Global Variable(Nodes_position_x_start), ==, -1.000), Compare(Y Component Of(Value In Array(Global Variable(
			Nodes_position_x), Global Variable(Temp_index))), <=, Y Component Of(Value In Array(Global Variable(Nodes_position_x),
			Global Variable(Nodes_position_x_start))))));
			Set Global Variable(Nodes_position_x_start, Global Variable(Temp_index));
		End;
		"Reset end x"
		If(Or(Compare(Global Variable(Nodes_position_x_end), ==, -1.000), Compare(Y Component Of(Value In Array(Global Variable(
			Nodes_position_x), Global Variable(Temp_index))), >, Y Component Of(Value In Array(Global Variable(Nodes_position_x),
			Global Variable(Nodes_position_x_end))))));
			Set Global Variable(Nodes_position_x_end, Global Variable(Temp_index));
		End;
		"Link parent x"
		Skip If(Compare(Global Variable(Temp_parent_index), ==, -1.000), 1);
		Set Global Variable At Index(Nodes_position_x, Global Variable(Temp_parent_index), Vector(X Component Of(Value In Array(
			Global Variable(Nodes_position_x), Global Variable(Temp_parent_index))), Y Component Of(Value In Array(Global Variable(
			Nodes_position_x), Global Variable(Temp_parent_index))), Global Variable(Temp_index)));
		"Link child x"
		Skip If(Compare(Global Variable(Temp_child_index), ==, -1.000), 1);
		Set Global Variable At Index(Nodes_position_x, Global Variable(Temp_child_index), Vector(Global Variable(Temp_index),
			Y Component Of(Value In Array(Global Variable(Nodes_position_x), Global Variable(Temp_child_index))), Z Component Of(
			Value In Array(Global Variable(Nodes_position_x), Global Variable(Temp_child_index)))));
		Set Global Variable(Temp_parent_index, -1.000);
		Set Global Variable(Temp_child_index, Subtract(Global Variable(Nodes_position_z_start), 0));
		Set Global Variable(Iterator_index, Global Variable(Nodes_position_z_start));
		While(And(Compare(Y Component Of(Value In Array(Global Variable(Nodes_position_z), Global Variable(Iterator_index))), <,
			Z Component Of(Player Variable(Event Player, next_node_position))), Compare(Global Variable(Iterator_index), !=, -1.000)));
			Set Global Variable(Temp_parent_index, Global Variable(Iterator_index));
			Set Global Variable(Iterator_index, Z Component Of(Value In Array(Global Variable(Nodes_position_z), Global Variable(
				Iterator_index))));
			Set Global Variable(Temp_child_index, Global Variable(Iterator_index));
		End;
		"Set z position"
		Set Global Variable At Index(Nodes_position_z, Global Variable(Temp_index), Vector(Global Variable(Temp_parent_index),
			Z Component Of(Player Variable(Event Player, next_node_position)), Global Variable(Temp_child_index)));
		"Reset start z"
		If(Or(Compare(Global Variable(Nodes_position_z_start), ==, -1.000), Compare(Y Component Of(Value In Array(Global Variable(
			Nodes_position_z), Global Variable(Temp_index))), <=, Y Component Of(Value In Array(Global Variable(Nodes_position_z),
			Global Variable(Nodes_position_z_start))))));
			Set Global Variable(Nodes_position_z_start, Global Variable(Temp_index));
		End;
		"Reset end z"
		If(Or(Compare(Global Variable(Nodes_position_z_end), ==, -1.000), Compare(Y Component Of(Value In Array(Global Variable(
			Nodes_position_z), Global Variable(Temp_index))), >, Y Component Of(Value In Array(Global Variable(Nodes_position_z),
			Global Variable(Nodes_position_z_end))))));
			Set Global Variable(Nodes_position_z_end, Global Variable(Temp_index));
		End;
		"Link parent z"
		Skip If(Compare(Global Variable(Temp_parent_index), ==, -1.000), 1);
		Set Global Variable At Index(Nodes_position_z, Global Variable(Temp_parent_index), Vector(X Component Of(Value In Array(
			Global Variable(Nodes_position_z), Global Variable(Temp_parent_index))), Y Component Of(Value In Array(Global Variable(
			Nodes_position_z), Global Variable(Temp_parent_index))), Global Variable(Temp_index)));
		"Link child z"
		Skip If(Compare(Global Variable(Temp_child_index), ==, -1.000), 1);
		Set Global Variable At Index(Nodes_position_z, Global Variable(Temp_child_index), Vector(Global Variable(Temp_index),
			Y Component Of(Value In Array(Global Variable(Nodes_position_z), Global Variable(Temp_child_index))), Z Component Of(
			Value In Array(Global Variable(Nodes_position_z), Global Variable(Temp_child_index)))));
		Call Subroutine(add_node_entity);
		If(Compare(Count Of(Player Variable(Event Player, associated_node_position_indices)), !=, 0));
			"Set Y component to 1 if wall to next added node happens to be vertical, 0 if horizontal"
			If(Compare(Y Component Of(Value In Array(Global Variable(Nodes_position_x), Global Variable(Temp_index))), ==, Y Component Of(
				Value In Array(Global Variable(Nodes_position_x), Last Of(Player Variable(Event Player, associated_node_position_indices))))));
				Set Global Variable At Index(Nodes_links, Last Of(Player Variable(Event Player, associated_node_position_indices)), Vector(
					X Component Of(Value In Array(Global Variable(Nodes_links), Last Of(Player Variable(Event Player,
					associated_node_position_indices)))), 1, Global Variable(Temp_index)));
			Else;
				Set Global Variable At Index(Nodes_links, Last Of(Player Variable(Event Player, associated_node_position_indices)), Vector(
					X Component Of(Value In Array(Global Variable(Nodes_links), Last Of(Player Variable(Event Player,
					associated_node_position_indices)))), 0, Global Variable(Temp_index)));
			End;
			"Set latest node - Y component is the opposite of previous value in link"
			Set Global Variable At Index(Nodes_links, Global Variable(Temp_index), Vector(Last Of(Player Variable(Event Player,
				associated_node_position_indices)), Modulo(Add(Y Component Of(Value In Array(Global Variable(Nodes_links), Last Of(
				Player Variable(Event Player, associated_node_position_indices)))), 1), 2), -1.000));
		Else;
			Set Global Variable At Index(Nodes_links, Global Variable(Temp_index), Vector(-1.000, Absolute Value(Z Component Of(
				Player Variable(Event Player, player_direction))), -1.000));
		End;
		Modify Player Variable(Event Player, associated_node_position_indices, Append To Array, Global Variable(Temp_index));
		Modify Global Variable(Nodes_count, Add, 1);
		Modify Player Variable(Event Player, current_node_count, Add, 1);
		Modify Global Variable At Index(Nodes_stamp, Global Variable(Temp_index), Add, 1);
		Set Global Variable At Index(Nodes_associated_player_id, Global Variable(Temp_index), Event Player);
	}
}

rule("Add Node Entity")
{
	event
	{
		Subroutine;
		add_node_entity;
	}

	actions
	{
		If(Compare(Player Variable(Event Player, previous_node_position), !=, Player Variable(Event Player, next_node_position)));
			"Create beam"
			Create Beam Effect(All Players(All Teams), Bad Beam, Player Variable(Event Player, previous_node_position), Player Variable(
				Event Player, next_node_position), Yellow, Visible To);
			Set Global Variable At Index(Nodes_created_entities, Last Of(Player Variable(Event Player, associated_node_position_indices)),
				Last Created Entity);
			Play Effect(All Players(All Teams), Good Pickup Effect, Yellow, Player Variable(Event Player, next_node_position), 50);
			Play Effect(All Players(All Teams), Buff Impact Sound, White, Player Variable(Event Player, next_node_position), 50);
		End;
	}
}

rule("Replace dynamic wall")
{
	event
	{
		Subroutine;
		replace_dynamic_wall;
	}

	actions
	{
		Skip If(Compare(Player Variable(Event Player, dynamic_wall), ==, 0), 1);
		Destroy Effect(Player Variable(Event Player, dynamic_wall));
		If(Compare(X Component Of(Player Variable(Event Player, player_direction)), !=, 0));
			Create Beam Effect(All Players(All Teams), Bad Beam, Player Variable(Event Player, next_node_position), Vector(X Component Of(
				Position Of(Event Player)), 0.500, Z Component Of(Player Variable(Event Player, next_node_position))), Yellow,
				Visible To Position and Radius);
		Else;
			Create Beam Effect(All Players(All Teams), Bad Beam, Player Variable(Event Player, next_node_position), Vector(X Component Of(
				Player Variable(Event Player, next_node_position)), 0.500, Z Component Of(Position Of(Event Player))), Yellow,
				Visible To Position and Radius);
		End;
		Set Player Variable(Event Player, dynamic_wall, Last Created Entity);
	}
}

rule("Remove Node")
{
	event
	{
		Subroutine;
		remove_node;
	}

	actions
	{
		Set Global Variable(Node_index_to_be_removed, Value In Array(Player Variable(Event Player, associated_node_position_indices), 0));
		Destroy Effect(Value In Array(Global Variable(Nodes_created_entities), Global Variable(Node_index_to_be_removed)));
		Set Global Variable At Index(Nodes_created_entities, Global Variable(Node_index_to_be_removed), 0);
		Set Player Variable At Index(Event Player, associated_node_position_indices, 0, -1.000);
		Set Player Variable(Event Player, associated_node_position_indices, Filtered Array(Player Variable(Event Player,
			associated_node_position_indices), Compare(Current Array Element, !=, -1.000)));
		Modify Player Variable(Event Player, current_node_count, Subtract, 1);
		Call Subroutine(remove_node_links);
		Call Subroutine(remove_node_x_z);
		Set Global Variable At Index(Nodes_associated_player_id, Global Variable(Node_index_to_be_removed), 0);
	}
}

rule("Remove Node Links")
{
	event
	{
		Subroutine;
		remove_node_links;
	}

	actions
	{
		If(Compare(Value In Array(Global Variable(Nodes_links), Global Variable(Node_index_to_be_removed)), !=, 0));
			If(Compare(X Component Of(Value In Array(Global Variable(Nodes_links), Global Variable(Node_index_to_be_removed))), !=, -1.000));
				Set Global Variable At Index(Nodes_links, X Component Of(Value In Array(Global Variable(Nodes_links), Global Variable(
					Node_index_to_be_removed))), Vector(X Component Of(Value In Array(Global Variable(Nodes_links), X Component Of(Value In Array(
					Global Variable(Nodes_links), Global Variable(Node_index_to_be_removed))))), Y Component Of(Value In Array(Global Variable(
					Nodes_links), X Component Of(Value In Array(Global Variable(Nodes_links), Global Variable(Node_index_to_be_removed))))),
					Z Component Of(Value In Array(Global Variable(Nodes_links), Global Variable(Node_index_to_be_removed)))));
			End;
			If(Compare(Z Component Of(Value In Array(Global Variable(Nodes_links), Global Variable(Node_index_to_be_removed))), !=, -1.000));
				Set Global Variable At Index(Nodes_links, Z Component Of(Value In Array(Global Variable(Nodes_links), Global Variable(
					Node_index_to_be_removed))), Vector(X Component Of(Value In Array(Global Variable(Nodes_links), Global Variable(
					Node_index_to_be_removed))), Y Component Of(Value In Array(Global Variable(Nodes_links), Z Component Of(Value In Array(
					Global Variable(Nodes_links), Global Variable(Node_index_to_be_removed))))), Z Component Of(Value In Array(Global Variable(
					Nodes_links), Z Component Of(Value In Array(Global Variable(Nodes_links), Global Variable(Node_index_to_be_removed)))))));
			End;
		End;
	}
}

rule("Remove Node Coords")
{
	event
	{
		Subroutine;
		remove_node_x_z;
	}

	actions
	{
		Set Global Variable(Iterator_index, Global Variable(Node_index_to_be_removed));
		If(Compare(Value In Array(Global Variable(Nodes_position_x), Global Variable(Iterator_index)), !=, 0));
			Modify Global Variable At Index(Nodes_stamp, Global Variable(Iterator_index), Add, 1);
			If(Compare(X Component Of(Value In Array(Global Variable(Nodes_position_x), Global Variable(Iterator_index))), !=, -1.000));
				"Parent"
				Set Global Variable At Index(Nodes_position_x, X Component Of(Value In Array(Global Variable(Nodes_position_x), Global Variable(
					Iterator_index))), Vector(X Component Of(Value In Array(Global Variable(Nodes_position_x), X Component Of(Value In Array(
					Global Variable(Nodes_position_x), Global Variable(Iterator_index))))), Y Component Of(Value In Array(Global Variable(
					Nodes_position_x), X Component Of(Value In Array(Global Variable(Nodes_position_x), Global Variable(Iterator_index))))),
					Z Component Of(Value In Array(Global Variable(Nodes_position_x), Global Variable(Iterator_index)))));
			Else;
				"Reset start of the list"
				Set Global Variable(Nodes_position_x_start, Z Component Of(Value In Array(Global Variable(Nodes_position_x), Global Variable(
					Iterator_index))));
			End;
			If(Compare(Z Component Of(Value In Array(Global Variable(Nodes_position_x), Global Variable(Iterator_index))), !=, -1.000));
				"Child"
				Set Global Variable At Index(Nodes_position_x, Z Component Of(Value In Array(Global Variable(Nodes_position_x), Global Variable(
					Iterator_index))), Vector(X Component Of(Value In Array(Global Variable(Nodes_position_x), Global Variable(Iterator_index))),
					Y Component Of(Value In Array(Global Variable(Nodes_position_x), Z Component Of(Value In Array(Global Variable(
					Nodes_position_x), Global Variable(Iterator_index))))), Z Component Of(Value In Array(Global Variable(Nodes_position_x),
					Z Component Of(Value In Array(Global Variable(Nodes_position_x), Global Variable(Iterator_index)))))));
			Else;
				"Reset end of the list"
				Set Global Variable(Nodes_position_x_end, X Component Of(Value In Array(Global Variable(Nodes_position_x), Global Variable(
					Iterator_index))));
			End;
			Set Global Variable At Index(Nodes_position_x, Global Variable(Iterator_index), 0);
			Modify Global Variable(Nodes_count, Subtract, 1);
			If(Compare(X Component Of(Value In Array(Global Variable(Nodes_position_z), Global Variable(Iterator_index))), !=, -1.000));
				"Parent"
				Set Global Variable At Index(Nodes_position_z, X Component Of(Value In Array(Global Variable(Nodes_position_z), Global Variable(
					Iterator_index))), Vector(X Component Of(Value In Array(Global Variable(Nodes_position_z), X Component Of(Value In Array(
					Global Variable(Nodes_position_z), Global Variable(Iterator_index))))), Y Component Of(Value In Array(Global Variable(
					Nodes_position_z), X Component Of(Value In Array(Global Variable(Nodes_position_z), Global Variable(Iterator_index))))),
					Z Component Of(Value In Array(Global Variable(Nodes_position_z), Global Variable(Iterator_index)))));
			Else;
				"Reset start of the list"
				Set Global Variable(Nodes_position_z_start, Z Component Of(Value In Array(Global Variable(Nodes_position_z), Global Variable(
					Iterator_index))));
			End;
			If(Compare(Z Component Of(Value In Array(Global Variable(Nodes_position_z), Global Variable(Iterator_index))), !=, -1.000));
				"Child"
				Set Global Variable At Index(Nodes_position_z, Z Component Of(Value In Array(Global Variable(Nodes_position_z), Global Variable(
					Iterator_index))), Vector(X Component Of(Value In Array(Global Variable(Nodes_position_z), Global Variable(Iterator_index))),
					Y Component Of(Value In Array(Global Variable(Nodes_position_z), Z Component Of(Value In Array(Global Variable(
					Nodes_position_z), Global Variable(Iterator_index))))), Z Component Of(Value In Array(Global Variable(Nodes_position_z),
					Z Component Of(Value In Array(Global Variable(Nodes_position_z), Global Variable(Iterator_index)))))));
			Else;
				"Reset end of the list"
				Set Global Variable(Nodes_position_z_end, X Component Of(Value In Array(Global Variable(Nodes_position_z), Global Variable(
					Iterator_index))));
			End;
			Set Global Variable At Index(Nodes_position_z, Global Variable(Iterator_index), 0);
			Set Global Variable At Index(Nodes_links, Global Variable(Iterator_index), 0);
		End;
	}
}

rule("Notify players of possible collision")
{
	event
	{
		Subroutine;
		notify_players_next_wall_update;
	}

	actions
	{
		Set Global Variable(Temp_notified_players, Empty Array);
		If(Compare(X Component Of(Player Variable(Event Player, player_direction)), !=, 0));
			Set Global Variable(Temp_notified_players, Filtered Array(Global Variable(Movements_player_id), And(Compare(Current Array Element,
				!=, Event Player), Compare(Z Component Of(Player Variable(Current Array Element, player_direction)), !=, 0))));
		Else;
			Set Global Variable(Temp_notified_players, Filtered Array(Global Variable(Movements_player_id), And(Compare(Current Array Element,
				!=, Event Player), Compare(X Component Of(Player Variable(Current Array Element, player_direction)), !=, 0))));
		End;
		Set Player Variable(Global Variable(Temp_notified_players), requires_next_wall_update, True);
		Set Global Variable(Temp_notified_by, Event Player);
	}
}

rule("Notified players set next wall X by other player")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Is Alive(Event Player) == True;
		Player Variable(Event Player, requires_next_wall_update) == True;
		X Component Of(Player Variable(Event Player, player_direction)) != 0;
	}

	actions
	{
		If(Compare(X Component Of(Player Variable(Event Player, player_direction)), >, 0));
			If(And(Compare(X Component Of(Position Of(Global Variable(Temp_notified_by))), >, X Component Of(Position Of(Event Player))), Or(
				Compare(Count Of(Player Variable(Event Player, next_wall_indices)), <=, 0), Compare(X Component Of(Position Of(Global Variable(
				Temp_notified_by))), <, X Component Of(Player Variable(Event Player, next_wall_value))))));
				Set Player Variable(Event Player, next_wall_indices, Empty Array);
				Set Player Variable(Event Player, next_wall_stamps, Empty Array);
				Modify Player Variable(Event Player, next_wall_indices, Append To Array, Last Of(Player Variable(Global Variable(Temp_notified_by),
					associated_node_position_indices)));
				Modify Player Variable(Event Player, next_wall_stamps, Append To Array, Value In Array(Global Variable(Nodes_stamp), Last Of(
					Player Variable(Global Variable(Temp_notified_by), associated_node_position_indices))));
				Set Player Variable(Event Player, next_wall_value, Vector(X Component Of(Position Of(Global Variable(Temp_notified_by))), 0, 0));
			End;
		Else If(Compare(X Component Of(Player Variable(Event Player, player_direction)), <, 0));
			If(And(Compare(X Component Of(Position Of(Global Variable(Temp_notified_by))), <, X Component Of(Position Of(Event Player))), Or(
				Compare(Count Of(Player Variable(Event Player, next_wall_indices)), <=, 0), Compare(X Component Of(Position Of(Global Variable(
				Temp_notified_by))), >, X Component Of(Player Variable(Event Player, next_wall_value))))));
				Set Player Variable(Event Player, next_wall_indices, Empty Array);
				Set Player Variable(Event Player, next_wall_stamps, Empty Array);
				Modify Player Variable(Event Player, next_wall_indices, Append To Array, Last Of(Player Variable(Global Variable(Temp_notified_by),
					associated_node_position_indices)));
				Modify Player Variable(Event Player, next_wall_stamps, Append To Array, Value In Array(Global Variable(Nodes_stamp), Last Of(
					Player Variable(Global Variable(Temp_notified_by), associated_node_position_indices))));
				Set Player Variable(Event Player, next_wall_value, Vector(X Component Of(Position Of(Global Variable(Temp_notified_by))), 0, 0));
			End;
		End;
		Set Player Variable(Event Player, requires_next_wall_update, False);
	}
}

rule("Notified players set next wall Z by other player")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Is Alive(Event Player) == True;
		Player Variable(Event Player, requires_next_wall_update) == True;
		Z Component Of(Player Variable(Event Player, player_direction)) != 0;
	}

	actions
	{
		If(Compare(Z Component Of(Player Variable(Event Player, player_direction)), >, 0));
			If(And(Compare(Z Component Of(Position Of(Global Variable(Temp_notified_by))), >, Z Component Of(Position Of(Event Player))), Or(
				Compare(Count Of(Player Variable(Event Player, next_wall_indices)), <=, 0), Compare(Z Component Of(Position Of(Global Variable(
				Temp_notified_by))), <, Z Component Of(Player Variable(Event Player, next_wall_value))))));
				Set Player Variable(Event Player, next_wall_indices, Empty Array);
				Set Player Variable(Event Player, next_wall_stamps, Empty Array);
				Modify Player Variable(Event Player, next_wall_indices, Append To Array, Last Of(Player Variable(Global Variable(Temp_notified_by),
					associated_node_position_indices)));
				Modify Player Variable(Event Player, next_wall_stamps, Append To Array, Value In Array(Global Variable(Nodes_stamp), Last Of(
					Player Variable(Global Variable(Temp_notified_by), associated_node_position_indices))));
				Set Player Variable(Event Player, next_wall_value, Vector(0, 0, Z Component Of(Position Of(Global Variable(Temp_notified_by)))));
			End;
		Else If(Compare(Z Component Of(Player Variable(Event Player, player_direction)), <, 0));
			If(And(Compare(Z Component Of(Position Of(Global Variable(Temp_notified_by))), <, Z Component Of(Position Of(Event Player))), Or(
				Compare(Count Of(Player Variable(Event Player, next_wall_indices)), <=, 0), Compare(Z Component Of(Position Of(Global Variable(
				Temp_notified_by))), >, Z Component Of(Player Variable(Event Player, next_wall_value))))));
				Set Player Variable(Event Player, next_wall_indices, Empty Array);
				Set Player Variable(Event Player, next_wall_stamps, Empty Array);
				Modify Player Variable(Event Player, next_wall_indices, Append To Array, Last Of(Player Variable(Global Variable(Temp_notified_by),
					associated_node_position_indices)));
				Modify Player Variable(Event Player, next_wall_stamps, Append To Array, Value In Array(Global Variable(Nodes_stamp), Last Of(
					Player Variable(Global Variable(Temp_notified_by), associated_node_position_indices))));
				Set Player Variable(Event Player, next_wall_value, Vector(0, 0, Z Component Of(Position Of(Global Variable(Temp_notified_by)))));
			End;
		End;
		Set Player Variable(Event Player, requires_next_wall_update, False);
	}
}

rule("Set next wall X")
{
	event
	{
		Subroutine;
		set_next_wall_x;
	}

	actions
	{
		Set Player Variable(Event Player, T, Position Of(Event Player));
		Set Player Variable(Event Player, next_wall_indices, Empty Array);
		Set Player Variable(Event Player, next_wall_stamps, Empty Array);
		If(And(Compare(X Component Of(Player Variable(Event Player, player_direction)), >, 0), Compare(Y Component Of(Value In Array(
			Global Variable(Nodes_position_x), Global Variable(Nodes_position_x_end))), >=, Player Variable(Event Player,
			last_checked_value))));
			Set Player Variable(Event Player, temp_index, Global Variable(Nodes_position_x_end));
			While(And(Compare(Player Variable(Event Player, temp_index), !=, -1.000), Compare(Y Component Of(Value In Array(Global Variable(
				Nodes_position_x), Player Variable(Event Player, temp_index))), >=, Player Variable(Event Player, last_checked_value))));
				If(And(Compare(Player Variable(Event Player, temp_index), !=, Last Of(Player Variable(Event Player,
					associated_node_position_indices))), Compare(Y Component Of(Value In Array(Global Variable(Nodes_links), Player Variable(
					Event Player, temp_index))), ==, 1)));
					If(Compare(Y Component Of(Value In Array(Global Variable(Nodes_position_x), Player Variable(Event Player, temp_index))), !=,
						Y Component Of(Value In Array(Global Variable(Nodes_position_x), First Of(Player Variable(Event Player,
						next_wall_indices))))));
						Set Player Variable(Event Player, next_wall_stamps, Empty Array);
						Set Player Variable(Event Player, next_wall_indices, Empty Array);
					End;
					Modify Player Variable(Event Player, next_wall_indices, Append To Array, Player Variable(Event Player, temp_index));
					Modify Player Variable(Event Player, next_wall_stamps, Append To Array, Value In Array(Global Variable(Nodes_stamp),
						Player Variable(Event Player, temp_index)));
					Set Player Variable(Event Player, next_wall_value, Vector(Y Component Of(Value In Array(Global Variable(Nodes_position_x),
						Player Variable(Event Player, temp_index))), 0, 0));
				End;
				Set Player Variable(Event Player, temp_index, X Component Of(Value In Array(Global Variable(Nodes_position_x), Player Variable(
					Event Player, temp_index))));
			End;
		Else If(And(Compare(X Component Of(Player Variable(Event Player, player_direction)), <, 0), Compare(Y Component Of(Value In Array(
				Global Variable(Nodes_position_x), Global Variable(Nodes_position_x_start))), <=, Player Variable(Event Player,
				last_checked_value))));
			Set Player Variable(Event Player, temp_index, Global Variable(Nodes_position_x_start));
			While(And(Compare(Player Variable(Event Player, temp_index), !=, -1.000), Compare(Y Component Of(Value In Array(Global Variable(
				Nodes_position_x), Player Variable(Event Player, temp_index))), <=, Player Variable(Event Player, last_checked_value))));
				If(And(Compare(Player Variable(Event Player, temp_index), !=, Last Of(Player Variable(Event Player,
					associated_node_position_indices))), Compare(Y Component Of(Value In Array(Global Variable(Nodes_links), Player Variable(
					Event Player, temp_index))), ==, 1)));
					If(Compare(Y Component Of(Value In Array(Global Variable(Nodes_position_x), Player Variable(Event Player, temp_index))), !=,
						Y Component Of(Value In Array(Global Variable(Nodes_position_x), First Of(Player Variable(Event Player,
						next_wall_indices))))));
						Set Player Variable(Event Player, next_wall_indices, Empty Array);
						Set Player Variable(Event Player, next_wall_stamps, Empty Array);
					End;
					Modify Player Variable(Event Player, next_wall_indices, Append To Array, Player Variable(Event Player, temp_index));
					Modify Player Variable(Event Player, next_wall_stamps, Append To Array, Value In Array(Global Variable(Nodes_stamp),
						Player Variable(Event Player, temp_index)));
					Set Player Variable(Event Player, next_wall_value, Vector(Y Component Of(Value In Array(Global Variable(Nodes_position_x),
						Player Variable(Event Player, temp_index))), 0, 0));
				End;
				Set Player Variable(Event Player, temp_index, Z Component Of(Value In Array(Global Variable(Nodes_position_x), Player Variable(
					Event Player, temp_index))));
			End;
		End;
		Set Player Variable(Event Player, requires_next_wall_update, False);
	}
}

rule("Set next wall Z")
{
	event
	{
		Subroutine;
		set_next_wall_z;
	}

	actions
	{
		Set Player Variable(Event Player, T, Position Of(Event Player));
		Set Player Variable(Event Player, next_wall_indices, Empty Array);
		Set Player Variable(Event Player, next_wall_stamps, Empty Array);
		If(And(Compare(Z Component Of(Player Variable(Event Player, player_direction)), >, 0), Compare(Y Component Of(Value In Array(
			Global Variable(Nodes_position_z), Global Variable(Nodes_position_z_end))), >=, Player Variable(Event Player,
			last_checked_value))));
			Set Player Variable(Event Player, temp_index, Global Variable(Nodes_position_z_end));
			While(And(Compare(Player Variable(Event Player, temp_index), !=, -1.000), Compare(Y Component Of(Value In Array(Global Variable(
				Nodes_position_z), Player Variable(Event Player, temp_index))), >=, Player Variable(Event Player, last_checked_value))));
				If(And(Compare(Player Variable(Event Player, temp_index), !=, Last Of(Player Variable(Event Player,
					associated_node_position_indices))), Compare(Y Component Of(Value In Array(Global Variable(Nodes_links), Player Variable(
					Event Player, temp_index))), ==, 0)));
					If(Compare(Y Component Of(Value In Array(Global Variable(Nodes_position_z), Player Variable(Event Player, temp_index))), !=,
						Y Component Of(Value In Array(Global Variable(Nodes_position_z), First Of(Player Variable(Event Player,
						next_wall_indices))))));
						Set Player Variable(Event Player, next_wall_stamps, Empty Array);
						Set Player Variable(Event Player, next_wall_indices, Empty Array);
					End;
					Modify Player Variable(Event Player, next_wall_indices, Append To Array, Player Variable(Event Player, temp_index));
					Modify Player Variable(Event Player, next_wall_stamps, Append To Array, Value In Array(Global Variable(Nodes_stamp),
						Player Variable(Event Player, temp_index)));
					Set Player Variable(Event Player, next_wall_value, Vector(0, 0, Y Component Of(Value In Array(Global Variable(Nodes_position_z),
						Player Variable(Event Player, temp_index)))));
				End;
				Set Player Variable(Event Player, temp_index, X Component Of(Value In Array(Global Variable(Nodes_position_z), Player Variable(
					Event Player, temp_index))));
			End;
		Else If(And(Compare(Z Component Of(Player Variable(Event Player, player_direction)), <, 0), Compare(Y Component Of(Value In Array(
				Global Variable(Nodes_position_z), Global Variable(Nodes_position_z_start))), <=, Player Variable(Event Player,
				last_checked_value))));
			Set Player Variable(Event Player, temp_index, Global Variable(Nodes_position_z_start));
			While(And(Compare(Player Variable(Event Player, temp_index), !=, -1.000), Compare(Y Component Of(Value In Array(Global Variable(
				Nodes_position_z), Player Variable(Event Player, temp_index))), <=, Player Variable(Event Player, last_checked_value))));
				If(And(Compare(Player Variable(Event Player, temp_index), !=, Last Of(Player Variable(Event Player,
					associated_node_position_indices))), Compare(Y Component Of(Value In Array(Global Variable(Nodes_links), Player Variable(
					Event Player, temp_index))), ==, 0)));
					If(Compare(Y Component Of(Value In Array(Global Variable(Nodes_position_z), Player Variable(Event Player, temp_index))), !=,
						Y Component Of(Value In Array(Global Variable(Nodes_position_z), First Of(Player Variable(Event Player,
						next_wall_indices))))));
						Set Player Variable(Event Player, next_wall_indices, Empty Array);
						Set Player Variable(Event Player, next_wall_stamps, Empty Array);
					End;
					Modify Player Variable(Event Player, next_wall_indices, Append To Array, Player Variable(Event Player, temp_index));
					Modify Player Variable(Event Player, next_wall_stamps, Append To Array, Value In Array(Global Variable(Nodes_stamp),
						Player Variable(Event Player, temp_index)));
					Set Player Variable(Event Player, next_wall_value, Vector(0, 0, Y Component Of(Value In Array(Global Variable(Nodes_position_z),
						Player Variable(Event Player, temp_index)))));
				End;
				Set Player Variable(Event Player, temp_index, Z Component Of(Value In Array(Global Variable(Nodes_position_z), Player Variable(
					Event Player, temp_index))));
			End;
		End;
		Set Player Variable(Event Player, requires_next_wall_update, False);
	}
}

rule("Check for collision")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Is Game In Progress == True;
		Is Alive(Event Player) == True;
		Count Of(Player Variable(Event Player, next_wall_indices)) > 0;
		Compare(Dot Product(Player Variable(Event Player, player_direction), Position Of(Event Player)), >=, Dot Product(Player Variable(
			Event Player, player_direction), Player Variable(Event Player, next_wall_value))) == True;
	}

	actions
	{
		Set Player Variable(Event Player, T, Position Of(Event Player));
		"Check for collision with vertical wall"
		If(Compare(X Component Of(Player Variable(Event Player, player_direction)), !=, 0));
			For Player Variable(Event Player, temp_index, 0, Count Of(Player Variable(Event Player, next_wall_indices)), 1);
				If(Compare(Value In Array(Player Variable(Event Player, next_wall_stamps), Player Variable(Event Player, temp_index)), ==,
					Value In Array(Global Variable(Nodes_stamp), Value In Array(Player Variable(Event Player, next_wall_indices), Player Variable(
					Event Player, temp_index)))));
					Set Player Variable(Event Player, temp_value_1, Y Component Of(Value In Array(Global Variable(Nodes_position_z), Value In Array(
						Player Variable(Event Player, next_wall_indices), Player Variable(Event Player, temp_index)))));
					If(Compare(Z Component Of(Value In Array(Global Variable(Nodes_links), Value In Array(Player Variable(Event Player,
						next_wall_indices), Player Variable(Event Player, temp_index)))), ==, -1.000));
						Set Player Variable(Event Player, temp_value_2, Z Component Of(Position Of(Value In Array(Global Variable(
							Nodes_associated_player_id), Value In Array(Player Variable(Event Player, next_wall_indices), Player Variable(Event Player,
							temp_index))))));
					Else;
						Set Player Variable(Event Player, temp_value_2, Y Component Of(Value In Array(Global Variable(Nodes_position_z), Z Component Of(
							Value In Array(Global Variable(Nodes_links), Value In Array(Player Variable(Event Player, next_wall_indices), Player Variable(
							Event Player, temp_index)))))));
					End;
					Set Player Variable(Event Player, temp_value_3, Z Component Of(Position Of(Event Player)));
					Call Subroutine(kill_on_collision);
				End;
			End;
			If(Compare(Player Variable(Event Player, temp_index), <, 9999));
				Set Player Variable(Event Player, last_checked_value, Add(Multiply(X Component Of(Player Variable(Event Player, player_direction)),
					0.001), X Component Of(Player Variable(Event Player, next_wall_value))));
				Call Subroutine(set_next_wall_x);
			End;
		"Check for collision with horizontal wall"
		Else If(Compare(Z Component Of(Player Variable(Event Player, player_direction)), !=, 0));
			For Player Variable(Event Player, temp_index, 0, Count Of(Player Variable(Event Player, next_wall_indices)), 1);
				If(Compare(Value In Array(Player Variable(Event Player, next_wall_stamps), Player Variable(Event Player, temp_index)), ==,
					Value In Array(Global Variable(Nodes_stamp), Value In Array(Player Variable(Event Player, next_wall_indices), Player Variable(
					Event Player, temp_index)))));
					Set Player Variable(Event Player, temp_value_1, Y Component Of(Value In Array(Global Variable(Nodes_position_x), Value In Array(
						Player Variable(Event Player, next_wall_indices), Player Variable(Event Player, temp_index)))));
					If(Compare(Z Component Of(Value In Array(Global Variable(Nodes_links), Value In Array(Player Variable(Event Player,
						next_wall_indices), Player Variable(Event Player, temp_index)))), ==, -1.000));
						Set Player Variable(Event Player, temp_value_2, X Component Of(Position Of(Value In Array(Global Variable(
							Nodes_associated_player_id), Value In Array(Player Variable(Event Player, next_wall_indices), Player Variable(Event Player,
							temp_index))))));
					Else;
						Set Player Variable(Event Player, temp_value_2, Y Component Of(Value In Array(Global Variable(Nodes_position_x), Z Component Of(
							Value In Array(Global Variable(Nodes_links), Value In Array(Player Variable(Event Player, next_wall_indices), Player Variable(
							Event Player, temp_index)))))));
					End;
					Set Player Variable(Event Player, temp_value_3, X Component Of(Position Of(Event Player)));
					Call Subroutine(kill_on_collision);
				End;
			End;
			If(Compare(Player Variable(Event Player, temp_index), <, 9999));
				Set Player Variable(Event Player, last_checked_value, Add(Multiply(Z Component Of(Player Variable(Event Player, player_direction)),
					0.001), Z Component Of(Player Variable(Event Player, next_wall_value))));
				Call Subroutine(set_next_wall_z);
			End;
		End;
		Wait(0.016, Ignore Condition);
		Loop If Condition Is True;
	}
}

rule("Kill on collision")
{
	event
	{
		Subroutine;
		kill_on_collision;
	}

	actions
	{
		If(Compare(Player Variable(Event Player, shield_active), ==, True));
			Abort;
		End;
		"Check if player position is between two nodes"
		If(And(Compare(Max(Player Variable(Event Player, temp_value_1), Player Variable(Event Player, temp_value_3)), ==, Player Variable(
			Event Player, temp_value_1)), Compare(Max(Player Variable(Event Player, temp_value_2), Player Variable(Event Player,
			temp_value_3)), ==, Player Variable(Event Player, temp_value_3))));
			Play Effect(All Players(All Teams), Bad Explosion, Red, Event Player, 5);
			Kill(Event Player, Value In Array(Global Variable(Nodes_associated_player_id), Value In Array(Player Variable(Event Player,
				next_wall_indices), Player Variable(Event Player, temp_index))));
			Set Player Variable(Event Player, temp_index, 9999);
		Else If(And(Compare(Max(Player Variable(Event Player, temp_value_1), Player Variable(Event Player, temp_value_3)), ==,
				Player Variable(Event Player, temp_value_3)), Compare(Max(Player Variable(Event Player, temp_value_2), Player Variable(
				Event Player, temp_value_3)), ==, Player Variable(Event Player, temp_value_2))));
			Play Effect(All Players(All Teams), Bad Explosion, Red, Event Player, 5);
			Kill(Event Player, Value In Array(Global Variable(Nodes_associated_player_id), Value In Array(Player Variable(Event Player,
				next_wall_indices), Player Variable(Event Player, temp_index))));
			Set Player Variable(Event Player, temp_index, 9999);
		End;
	}
}

rule("Kill out of border players")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Is Game In Progress == True;
		Is Alive(Event Player) == True;
		Has Spawned(Event Player) == True;
		Or(Compare(Absolute Value(X Component Of(Position Of(Event Player))), >, Global Variable(Border_variable)), Compare(Absolute Value(
			Z Component Of(Position Of(Event Player))), >, Global Variable(Border_variable))) == True;
	}

	actions
	{
		Play Effect(All Players(All Teams), Bad Explosion, Purple, Event Player, 5);
		Kill(Event Player, Event Player);
	}
}

rule("Reset player on death")
{
	event
	{
		Player Died;
		All;
		All;
	}

	actions
	{
		Call Subroutine(reset_player);
		Set Player Variable(Event Player, requires_respawn, True);
	}
}

rule("Player joins")
{
	event
	{
		Ongoing - Global;
	}

	conditions
	{
		Global Variable(Player_count) < Count Of(All Players(All Teams));
	}

	actions
	{
		Set Global Variable(Player_count, Count Of(All Players(All Teams)));
		disabled Wait(1, Ignore Condition);
		disabled Loop If Condition Is True;
	}
}

rule("Player leaves")
{
	event
	{
		Ongoing - Global;
	}

	conditions
	{
		Global Variable(Player_count) > Count Of(All Players(All Teams));
	}

	actions
	{
		Call Subroutine(cleanup);
		Set Global Variable(Player_count, Count Of(All Players(All Teams)));
		disabled Wait(1, Ignore Condition);
		disabled Loop If Condition Is True;
	}
}

rule("Cleanup")
{
	event
	{
		Subroutine;
		cleanup;
	}

	actions
	{
		Abort If(Compare(Global Variable(Temp_leave_index), !=, 0));
		Set Global Variable(Temp_leave_count, Count Of(Global Variable(Nodes_associated_player_id)));
		For Global Variable(Temp_leave_index, 0, Global Variable(Temp_leave_count), 1);
			If(And(Compare(Value In Array(Global Variable(Nodes_associated_player_id), Global Variable(Temp_leave_index)), !=, 0), Compare(
				Array Contains(All Players(All Teams), Value In Array(Global Variable(Nodes_associated_player_id), Global Variable(
				Temp_leave_index))), ==, False)));
				If(Compare(Value In Array(Global Variable(Nodes_created_entities), Global Variable(Temp_leave_index)), !=, 0));
					Destroy Effect(Value In Array(Global Variable(Nodes_created_entities), Global Variable(Temp_leave_index)));
					Set Global Variable At Index(Nodes_created_entities, Global Variable(Temp_leave_index), 0);
				End;
				Set Global Variable(Node_index_to_be_removed, Global Variable(Temp_leave_index));
				Call Subroutine(remove_node_links);
				Call Subroutine(remove_node_x_z);
				Set Global Variable At Index(Nodes_associated_player_id, Global Variable(Temp_leave_index), 0);
			End;
			Wait(0.016, Ignore Condition);
		End;
		Set Global Variable(Temp_leave_count, Count Of(Global Variable(Movements_player_id)));
		For Global Variable(Temp_leave_index, 0, Global Variable(Temp_leave_count), 1);
			If(And(Compare(Value In Array(Global Variable(Movements_player_id), Global Variable(Temp_leave_index)), !=, 0), Compare(
				Array Contains(All Players(All Teams), Value In Array(Global Variable(Movements_player_id), Global Variable(
				Temp_leave_index))), ==, False)));
				Set Global Variable At Index(Movements_player_direction, Global Variable(Temp_leave_index), 0);
				Set Global Variable At Index(Movements_player_x_z, Global Variable(Temp_leave_index), 0);
				Set Global Variable At Index(Movements_player_id, Global Variable(Temp_leave_index), 0);
			End;
			Wait(0.016, Ignore Condition);
		End;
		Set Global Variable(Temp_leave_index, 0);
	}
}

rule("Reset player")
{
	event
	{
		Subroutine;
		reset_player;
	}

	actions
	{
		Call Subroutine(disable_shield_break);
		Set Player Variable(Event Player, requires_initial_spawn, 0);
		Start Forcing Throttle(Event Player, 0, 0, 0, 0, 0, 0);
		Stop Accelerating(Event Player);
		Wait(0.250, Ignore Condition);
		Destroy Effect(Player Variable(Event Player, dynamic_wall));
		Set Player Variable(Event Player, dynamic_wall, 0);
		While(Compare(Count Of(Player Variable(Event Player, associated_node_position_indices)), >, 0));
			Call Subroutine(remove_node);
			Wait(0.016, Ignore Condition);
		End;
		Set Player Variable(Event Player, associated_node_position_indices, Empty Array);
		Set Player Variable(Event Player, next_wall_indices, Empty Array);
		Set Player Variable(Event Player, requires_next_wall_update, False);
		Set Player Variable(Event Player, next_node_position, 0);
		Set Player Variable(Event Player, previous_node_position, 0);
		Set Player Variable(Event Player, next_wall_stamps, Empty Array);
		Set Player Variable(Event Player, next_wall_value, 0);
	}
}

rule("Enable shield")
{
	event
	{
		Subroutine;
		enable_shield_break;
	}

	actions
	{
		Set Player Variable(Event Player, shield_active, True);
		Create Effect(All Players(All Teams), Sphere, Aqua, Event Player, 1, Visible To Position and Radius);
		Modify Player Variable(Event Player, shield_entities, Append To Array, Last Created Entity);
		Create HUD Text(Event Player, Custom String("{0}", Icon String(Ring Thick), Null, Null), Custom String("Shield", Null, Null, Null),
			Custom String("Move through walls unharmed", Null, Null, Null), Left, 0, Aqua, Aqua, White, Visible To and String,
			Default Visibility);
		Modify Player Variable(Event Player, shield_entities, Append To Array, Last Text ID);
		Small Message(Event Player, Custom String("Shield enabled", Null, Null, Null));
	}
}

rule("Disable shield")
{
	event
	{
		Subroutine;
		disable_shield_break;
	}

	actions
	{
		Set Player Variable(Event Player, shield_active, False);
		If(Compare(Count Of(Player Variable(Event Player, shield_entities)), <=, 0));
			Abort;
		End;
		Destroy Effect(First Of(Player Variable(Event Player, shield_entities)));
		Destroy HUD Text(Last Of(Player Variable(Event Player, shield_entities)));
		Set Player Variable(Event Player, shield_entities, Empty Array);
		Play Effect(All Players(All Teams), Ring Explosion, Aqua, Event Player, 4);
		Small Message(Event Player, Custom String("Shield disabled", Null, Null, Null));
	}
}

disabled rule("Test - Static wall")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		Set Global Variable At Index(Nodes_position_x, 0, Vector(3, -10.000, 1));
		Set Global Variable At Index(Nodes_position_z, 0, Vector(2, 10, 1));
		Create Beam Effect(All Players(All Teams), Good Beam, Vector(-10.000, 0.500, 10), Vector(10, 0.500, 10), White,
			Visible To Position and Radius);
		Set Global Variable At Index(Nodes_position_x, 1, Vector(0, 10, 2));
		Set Global Variable At Index(Nodes_position_z, 1, Vector(0, 10, -1.000));
		Create Beam Effect(All Players(All Teams), Good Beam, Vector(10, 0.500, 10), Vector(10, 0.500, -10.000), White,
			Visible To Position and Radius);
		Set Global Variable At Index(Nodes_position_x, 2, Vector(1, 10, -1.000));
		Set Global Variable At Index(Nodes_position_z, 2, Vector(3, -10.000, 0));
		Create Beam Effect(All Players(All Teams), Good Beam, Vector(10, 0.500, -10.000), Vector(-10.000, 0.500, -10.000), White,
			Visible To Position and Radius);
		Set Global Variable At Index(Nodes_position_x, 3, Vector(-1.000, -10.000, 0));
		Set Global Variable At Index(Nodes_position_z, 3, Vector(-1.000, -10.000, 2));
		Set Global Variable(Nodes_position_x_start, 3);
		Set Global Variable(Nodes_position_x_end, 2);
		Set Global Variable(Nodes_count, 4);
		Set Global Variable(Nodes_position_z_start, 3);
		Set Global Variable(Nodes_position_z_end, 1);
		Set Global Variable At Index(Nodes_links, 0, Vector(-1.000, 0, 1));
		Set Global Variable At Index(Nodes_links, 1, Vector(0, 1, 2));
		Set Global Variable At Index(Nodes_links, 2, Vector(1, 0, 3));
		Set Global Variable At Index(Nodes_links, 3, Vector(2, 0, -1.000));
	}
}

disabled rule("Test - Bot")
{
	event
	{
		Ongoing - Global;
	}

	conditions
	{
		Is Game In Progress == True;
	}

	actions
	{
		Big Message(All Players(All Teams), Custom String("Bot created", Null, Null, Null));
		Create Dummy Bot(Hero(Wrecking Ball), All Teams, -1.000, Vector(10, 0.500, 0), Vector(0, 0, 0));
	}
}

rule("UI")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		"For updates, check the Discord"
		Create HUD Text(All Players(All Teams), Null, Null, Custom String("discord.gg/YP544CH", Null, Null, Null), Right, 0, White, White,
			Sky Blue, Visible To and String, Default Visibility);
		Create HUD Text(All Players(All Teams), Null, Null, Custom String("V1.00 (01-03-20)", Null, Null, Null), Right, 1, White, White,
			White, Visible To and String, Default Visibility);
		Create HUD Text(All Players(All Teams), Custom String("{0}", Icon String(Exclamation Mark), Null, Null), Custom String(
			"Change Camera", Null, Null, Null), Custom String("Press Reload", Null, Null, Null), Left, -1.000, White, White, White,
			Visible To and String, Default Visibility);
		Create HUD Text(All Players(All Teams), Custom String("{0}", Icon String(Exclamation Mark), Null, Null), Custom String(
			"Avoid hitting walls", Null, Null, Null), Custom String("(Unless you have a shield)", Null, Null, Null), Left, -2.000, Yellow,
			White, White, Visible To and String, Default Visibility);
	}
}

disabled rule("Debug - UI")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		Create HUD Text(Host Player, Null, Null, Custom String("{0} (Current load)
{1} (Average load) 
{2} (Peak load)", Server Load,
			Server Load Average, Server Load Peak), Left, 99, White, White, White, Visible To and String, Default Visibility);
	}
}

disabled rule("Debug - World")
{
	event
	{
		Ongoing - Global;
	}

	conditions
	{
		Total Time Elapsed > 3;
	}

	actions
	{
		Create Effect(Host Player, Light Shaft, White, Vector(0, 0, 0), 1, None);
		Create Beam Effect(Host Player, Bad Beam, Vector(0, 1, 0), Vector(5, 1, 0), Green, Visible To Position and Radius);
		Create Beam Effect(Host Player, Good Beam, Vector(0, 1, 0), Vector(0, 1, 5), Blue, Visible To Position and Radius);
		For Global Variable(Temp_index, 0, Count Of(Global Variable(Initial_spawn_positions)), 1);
			Create Effect(All Players(All Teams), Sphere, White, Value In Array(Global Variable(Initial_spawn_positions), Global Variable(
				Temp_index)), 2, Visible To);
		End;
	}
}

disabled rule("Debug - Player")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	actions
	{
		disabled Set Player Variable(Event Player, B, Velocity Of(Event Player));
		disabled Wait(0.050, Ignore Condition);
		disabled Loop;
	}
}

rule("Have Fun! -CuddlyFlower")
{
	event
	{
		Ongoing - Global;
	}
}

Changelog

3 months ago 1.0.0

  • Disabled debug rules for first 1.0 release

HHTS9
click to copy
3 months ago 0.9.2

  • Fixed crash after player leaving, should be more stable now in general

9HYEX
click to copy
3 months ago 0.9.1

  • Fixed a variety of bugs
  • Added first power up, which gives additional points when collected (green spheres)

VT7SY
click to copy
3 months ago 0.9.0

This revision contains no notes

Z0J3M
click to copy