Added Colours and Damage support
parent
8b05248180
commit
3722c73a15
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Models/spaceship_model_modified.tscn (Stored with Git LFS)
BIN
Models/spaceship_model_modified.tscn (Stored with Git LFS)
Binary file not shown.
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Scripts/Arena.gd" type="Script" id=1]
|
[ext_resource path="res://Scripts/Arena.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Scripts/Camera.gd" type="Script" id=2]
|
[ext_resource path="res://Scripts/Camera.gd" type="Script" id=2]
|
||||||
|
[ext_resource path="res://Models/space_arena.tscn" type="PackedScene" id=3]
|
||||||
|
|
||||||
[node name="Arena" type="Spatial"]
|
[node name="Arena" type="Spatial"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
@ -9,3 +10,5 @@ script = ExtResource( 1 )
|
||||||
[node name="Camera" type="Camera" parent="."]
|
[node name="Camera" type="Camera" parent="."]
|
||||||
transform = Transform( 1, 0, 0, 0, 0.942566, 0.334021, 0, -0.334021, 0.942566, 0, 0.462908, 1.26081 )
|
transform = Transform( 1, 0, 0, 0, 0.942566, 0.334021, 0, -0.334021, 0.942566, 0, 0.462908, 1.26081 )
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="space_arena" parent="." instance=ExtResource( 3 )]
|
||||||
|
|
|
@ -16,6 +16,23 @@ margin_left = -100.0
|
||||||
margin_right = 100.0
|
margin_right = 100.0
|
||||||
margin_bottom = 25.0
|
margin_bottom = 25.0
|
||||||
placeholder_text = "Enter IP Address of Server"
|
placeholder_text = "Enter IP Address of Server"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="NameLineEdit" type="LineEdit" parent="."]
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.3
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.3
|
||||||
|
margin_left = -100.0
|
||||||
|
margin_top = -40.0
|
||||||
|
margin_right = 100.0
|
||||||
|
margin_bottom = -15.0
|
||||||
|
placeholder_text = "Enter Display Name"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
[node name="StartButton" type="Button" parent="."]
|
[node name="StartButton" type="Button" parent="."]
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
|
@ -30,3 +47,13 @@ text = "Start"
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[node name="ColorPicker" type="ColorPicker" parent="."]
|
||||||
|
anchor_left = 0.05
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.05
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
grow_vertical = 2
|
||||||
|
edit_alpha = false
|
||||||
|
presets_enabled = false
|
||||||
|
presets_visible = false
|
||||||
|
|
|
@ -132,20 +132,21 @@ shape = SubResource( 1 )
|
||||||
visible = false
|
visible = false
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
margin_left = -390.0
|
margin_left = -350.0
|
||||||
margin_top = 15.0
|
margin_top = 15.0
|
||||||
margin_right = 390.0
|
margin_right = 350.0
|
||||||
margin_bottom = 50.0
|
margin_bottom = 85.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="TimeBar" type="HSlider" parent="MainPanel"]
|
[node name="TimeBar" type="HSlider" parent="MainPanel"]
|
||||||
anchor_top = 0.5
|
anchor_top = 0.25
|
||||||
anchor_right = 0.5
|
anchor_right = 1.0
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.25
|
||||||
margin_left = 10.0
|
margin_left = 10.0
|
||||||
|
margin_right = -10.0
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
max_value = 5.0
|
max_value = 5.0
|
||||||
step = 0.01
|
step = 0.01
|
||||||
|
@ -156,10 +157,10 @@ __meta__ = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="AddButton" type="Button" parent="MainPanel"]
|
[node name="AddButton" type="Button" parent="MainPanel"]
|
||||||
anchor_left = 0.6
|
anchor_left = 0.333
|
||||||
anchor_top = 0.5
|
anchor_top = 0.75
|
||||||
anchor_right = 0.7
|
anchor_right = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.75
|
||||||
margin_left = 6.0
|
margin_left = 6.0
|
||||||
margin_right = -1.0
|
margin_right = -1.0
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
@ -169,10 +170,9 @@ __meta__ = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="PlayButton" type="Button" parent="MainPanel"]
|
[node name="PlayButton" type="Button" parent="MainPanel"]
|
||||||
anchor_left = 0.5
|
anchor_top = 0.75
|
||||||
anchor_top = 0.5
|
anchor_right = 0.167
|
||||||
anchor_right = 0.6
|
anchor_bottom = 0.75
|
||||||
anchor_bottom = 0.5
|
|
||||||
margin_left = 6.0
|
margin_left = 6.0
|
||||||
margin_right = -1.0
|
margin_right = -1.0
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
@ -181,11 +181,24 @@ __meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[node name="PlayLastButton" type="Button" parent="MainPanel"]
|
||||||
|
anchor_left = 0.167
|
||||||
|
anchor_top = 0.75
|
||||||
|
anchor_right = 0.333
|
||||||
|
anchor_bottom = 0.75
|
||||||
|
margin_left = 6.0
|
||||||
|
margin_right = -1.0
|
||||||
|
grow_vertical = 2
|
||||||
|
text = "Play Last"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
[node name="RemoveButton" type="Button" parent="MainPanel"]
|
[node name="RemoveButton" type="Button" parent="MainPanel"]
|
||||||
anchor_left = 0.7
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.75
|
||||||
anchor_right = 0.8
|
anchor_right = 0.667
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.75
|
||||||
margin_left = 5.0
|
margin_left = 5.0
|
||||||
margin_right = -3.0
|
margin_right = -3.0
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
@ -195,10 +208,10 @@ __meta__ = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="ClearButton" type="Button" parent="MainPanel"]
|
[node name="ClearButton" type="Button" parent="MainPanel"]
|
||||||
anchor_left = 0.8
|
anchor_left = 0.667
|
||||||
anchor_top = 0.5
|
anchor_top = 0.75
|
||||||
anchor_right = 0.9
|
anchor_right = 0.833
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.75
|
||||||
margin_left = 3.0
|
margin_left = 3.0
|
||||||
margin_right = -5.0
|
margin_right = -5.0
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
@ -208,10 +221,10 @@ __meta__ = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="EndTurnButton" type="Button" parent="MainPanel"]
|
[node name="EndTurnButton" type="Button" parent="MainPanel"]
|
||||||
anchor_left = 0.9
|
anchor_left = 0.833
|
||||||
anchor_top = 0.5
|
anchor_top = 0.75
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.75
|
||||||
margin_left = 1.0
|
margin_left = 1.0
|
||||||
margin_right = -6.0
|
margin_right = -6.0
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
@ -419,6 +432,17 @@ step = 0.001
|
||||||
tick_count = 3
|
tick_count = 3
|
||||||
ticks_on_borders = true
|
ticks_on_borders = true
|
||||||
|
|
||||||
|
[node name="ResetButton" type="Button" parent="ThrustPanel"]
|
||||||
|
anchor_left = 0.1
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.1
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
grow_vertical = 2
|
||||||
|
text = "Reset"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
[node name="TurnEndBanner" type="TextureRect" parent="."]
|
[node name="TurnEndBanner" type="TextureRect" parent="."]
|
||||||
visible = false
|
visible = false
|
||||||
modulate = Color( 1, 1, 1, 0 )
|
modulate = Color( 1, 1, 1, 0 )
|
||||||
|
@ -534,9 +558,30 @@ margin_bottom = 40.0
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[node name="InfoPanel" type="Panel" parent="."]
|
||||||
|
visible = false
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
margin_left = -200.0
|
||||||
|
margin_bottom = 100.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="InfoPanel"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_left = 10.0
|
||||||
|
margin_top = 10.0
|
||||||
|
margin_right = -10.0
|
||||||
|
margin_bottom = -10.0
|
||||||
|
[connection signal="mouse_entered" from="." to="." method="_on_Player_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="." to="." method="_on_Player_mouse_exited"]
|
||||||
[connection signal="value_changed" from="MainPanel/TimeBar" to="." method="_on_TimeBar_value_changed"]
|
[connection signal="value_changed" from="MainPanel/TimeBar" to="." method="_on_TimeBar_value_changed"]
|
||||||
[connection signal="pressed" from="MainPanel/AddButton" to="." method="_on_AddButton_pressed"]
|
[connection signal="pressed" from="MainPanel/AddButton" to="." method="_on_AddButton_pressed"]
|
||||||
[connection signal="pressed" from="MainPanel/PlayButton" to="." method="_on_PlayButton_pressed"]
|
[connection signal="pressed" from="MainPanel/PlayButton" to="." method="_on_PlayButton_pressed"]
|
||||||
|
[connection signal="pressed" from="MainPanel/PlayLastButton" to="." method="_on_PlayLastButton_pressed"]
|
||||||
[connection signal="pressed" from="MainPanel/RemoveButton" to="." method="_on_RemoveButton_pressed"]
|
[connection signal="pressed" from="MainPanel/RemoveButton" to="." method="_on_RemoveButton_pressed"]
|
||||||
[connection signal="pressed" from="MainPanel/ClearButton" to="." method="_on_ClearButton_pressed"]
|
[connection signal="pressed" from="MainPanel/ClearButton" to="." method="_on_ClearButton_pressed"]
|
||||||
[connection signal="pressed" from="MainPanel/EndTurnButton" to="." method="_on_EndTurnButton_pressed"]
|
[connection signal="pressed" from="MainPanel/EndTurnButton" to="." method="_on_EndTurnButton_pressed"]
|
||||||
|
@ -546,3 +591,4 @@ __meta__ = {
|
||||||
[connection signal="value_changed" from="ThrustPanel/YRot" to="." method="_on_YRot_value_changed"]
|
[connection signal="value_changed" from="ThrustPanel/YRot" to="." method="_on_YRot_value_changed"]
|
||||||
[connection signal="value_changed" from="ThrustPanel/ZLin" to="." method="_on_ZLin_value_changed"]
|
[connection signal="value_changed" from="ThrustPanel/ZLin" to="." method="_on_ZLin_value_changed"]
|
||||||
[connection signal="value_changed" from="ThrustPanel/ZRot" to="." method="_on_ZRot_value_changed"]
|
[connection signal="value_changed" from="ThrustPanel/ZRot" to="." method="_on_ZRot_value_changed"]
|
||||||
|
[connection signal="pressed" from="ThrustPanel/ResetButton" to="." method="_on_ResetButton_pressed"]
|
||||||
|
|
|
@ -16,7 +16,8 @@ remote func place_player(player_id : int, position : Vector3, rotation : Vector3
|
||||||
if player_id == get_tree().get_network_unique_id():
|
if player_id == get_tree().get_network_unique_id():
|
||||||
player.is_local = true
|
player.is_local = true
|
||||||
get_parent().console_print('Setting player with id (' + String(player_id) + ') as local')
|
get_parent().console_print('Setting player with id (' + String(player_id) + ') as local')
|
||||||
player.init()
|
player.init(player_id, get_parent().color_dict[player_id])
|
||||||
|
$Camera.register_player(player)
|
||||||
|
|
||||||
func init():
|
func init():
|
||||||
get_parent().arena_ready()
|
get_parent().arena_ready()
|
||||||
|
@ -24,3 +25,10 @@ func init():
|
||||||
func play_full_plans():
|
func play_full_plans():
|
||||||
for player in players.values():
|
for player in players.values():
|
||||||
player.play_full_plan()
|
player.play_full_plan()
|
||||||
|
|
||||||
|
func mouse_enter(player_obj : RigidBody):
|
||||||
|
players[get_tree().get_network_unique_id()].display_data(player_obj)
|
||||||
|
|
||||||
|
func mouse_exit(player_obj : RigidBody):
|
||||||
|
players[get_tree().get_network_unique_id()].clear_info_panel()
|
||||||
|
|
||||||
|
|
|
@ -3,28 +3,56 @@ extends Camera
|
||||||
const TRANSLATION_SPEED : float = 0.1
|
const TRANSLATION_SPEED : float = 0.1
|
||||||
const ROTATION_SPEED : float = 0.025
|
const ROTATION_SPEED : float = 0.025
|
||||||
|
|
||||||
|
var players = []
|
||||||
|
var index : int = 0
|
||||||
|
var locked : bool = false
|
||||||
|
|
||||||
|
func register_player(player):
|
||||||
|
players.append(player)
|
||||||
|
|
||||||
func _physics_process(delta : float) -> void:
|
func _physics_process(delta : float) -> void:
|
||||||
if Input.is_action_pressed("camera_forward"):
|
if Input.is_action_pressed("camera_forward"):
|
||||||
translate(TRANSLATION_SPEED * Vector3(0, 0, -1))
|
translate(TRANSLATION_SPEED * Vector3(0, 0, -1)); locked = false
|
||||||
if Input.is_action_pressed("camera_backward"):
|
if Input.is_action_pressed("camera_backward"):
|
||||||
translate(TRANSLATION_SPEED * Vector3(0, 0, 1))
|
translate(TRANSLATION_SPEED * Vector3(0, 0, 1)); locked = false
|
||||||
if Input.is_action_pressed("camera_strafe_up"):
|
if Input.is_action_pressed("camera_strafe_up"):
|
||||||
translate(TRANSLATION_SPEED * Vector3(0, 1, 0))
|
translate(TRANSLATION_SPEED * Vector3(0, 1, 0)); locked = false
|
||||||
if Input.is_action_pressed("camera_strafe_down"):
|
if Input.is_action_pressed("camera_strafe_down"):
|
||||||
translate(TRANSLATION_SPEED * Vector3(0, -1, 0))
|
translate(TRANSLATION_SPEED * Vector3(0, -1, 0)); locked = false
|
||||||
if Input.is_action_pressed("camera_strafe_right"):
|
if Input.is_action_pressed("camera_strafe_right"):
|
||||||
translate(TRANSLATION_SPEED * Vector3(1, 0, 0))
|
translate(TRANSLATION_SPEED * Vector3(1, 0, 0)); locked = false
|
||||||
if Input.is_action_pressed("camera_strafe_left"):
|
if Input.is_action_pressed("camera_strafe_left"):
|
||||||
translate(TRANSLATION_SPEED * Vector3(-1, 0, 0))
|
translate(TRANSLATION_SPEED * Vector3(-1, 0, 0)); locked = false
|
||||||
if Input.is_action_pressed("camera_pitch_down"):
|
if Input.is_action_pressed("camera_pitch_down"):
|
||||||
rotate_object_local(Vector3(1,0,0), -ROTATION_SPEED)
|
rotate_object_local(Vector3(1,0,0), -ROTATION_SPEED); locked = false
|
||||||
if Input.is_action_pressed("camera_pitch_up"):
|
if Input.is_action_pressed("camera_pitch_up"):
|
||||||
rotate_object_local(Vector3(1,0,0), ROTATION_SPEED)
|
rotate_object_local(Vector3(1,0,0), ROTATION_SPEED); locked = false
|
||||||
if Input.is_action_pressed("camera_roll_left"):
|
if Input.is_action_pressed("camera_roll_left"):
|
||||||
rotate_object_local(Vector3(0,0,1), ROTATION_SPEED)
|
rotate_object_local(Vector3(0,0,1), ROTATION_SPEED); locked = false
|
||||||
if Input.is_action_pressed("camera_roll_right"):
|
if Input.is_action_pressed("camera_roll_right"):
|
||||||
rotate_object_local(Vector3(0,0,1), -ROTATION_SPEED)
|
rotate_object_local(Vector3(0,0,1), -ROTATION_SPEED); locked = false
|
||||||
if Input.is_action_pressed("camera_yaw_left"):
|
if Input.is_action_pressed("camera_yaw_left"):
|
||||||
rotate_object_local(Vector3(0,1,0), ROTATION_SPEED)
|
rotate_object_local(Vector3(0,1,0), ROTATION_SPEED); locked = false
|
||||||
if Input.is_action_pressed("camera_yaw_right"):
|
if Input.is_action_pressed("camera_yaw_right"):
|
||||||
rotate_object_local(Vector3(0,1,0), -ROTATION_SPEED)
|
rotate_object_local(Vector3(0,1,0), -ROTATION_SPEED); locked = false
|
||||||
|
if Input.is_action_just_pressed("camera_switch_player"):
|
||||||
|
move_to_player(index % len(players))
|
||||||
|
index += 1
|
||||||
|
locked = true
|
||||||
|
if locked:
|
||||||
|
move_to_player(index % len(players))
|
||||||
|
|
||||||
|
func move_to_player(index : int):
|
||||||
|
translation = players[index].translation
|
||||||
|
rotation = players[index].rotation
|
||||||
|
translate(Vector3(0, -0.8, -2))
|
||||||
|
rotate_object_local(Vector3(1,0,0), PI-0.3)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
extends RigidBody
|
extends RigidBody
|
||||||
|
|
||||||
|
var player_id : int
|
||||||
|
|
||||||
|
var mouse_over_player : RigidBody = null
|
||||||
|
|
||||||
var thrust_plan : Plan = Plan.new()
|
var thrust_plan : Plan = Plan.new()
|
||||||
var weapons_plan : Plan = Plan.new()
|
var weapons_plan : Plan = Plan.new()
|
||||||
var is_local : bool = false
|
var is_local : bool = false
|
||||||
|
@ -13,6 +17,11 @@ var initial_velocity : Vector3 = Vector3(0,0,0)
|
||||||
var initial_rotational_velocity : Vector3 = Vector3(0,0,0)
|
var initial_rotational_velocity : Vector3 = Vector3(0,0,0)
|
||||||
var enable_physics : bool = false
|
var enable_physics : bool = false
|
||||||
|
|
||||||
|
var end_translation : Vector3 = Vector3.ZERO
|
||||||
|
var end_rotation : Vector3 = Vector3.ZERO
|
||||||
|
var end_linear_velocity : Vector3 = Vector3.ZERO
|
||||||
|
var end_rotational_velocity : Vector3 = Vector3.ZERO
|
||||||
|
|
||||||
var round_time : float = 0.0
|
var round_time : float = 0.0
|
||||||
var end_of_round_translation : Vector3 = get_translation()
|
var end_of_round_translation : Vector3 = get_translation()
|
||||||
var end_of_round_rotation : Vector3 = get_rotation()
|
var end_of_round_rotation : Vector3 = get_rotation()
|
||||||
|
@ -28,9 +37,10 @@ onready var turn_end_banner : TextureRect = $TurnEndBanner
|
||||||
|
|
||||||
const TIME_STEP : float = 0.01
|
const TIME_STEP : float = 0.01
|
||||||
const MAX_LIN_THRUST : float = 1.0
|
const MAX_LIN_THRUST : float = 1.0
|
||||||
const MAX_ROT_THRUST : float = 1.0
|
const MAX_ROT_THRUST : float = 0.01
|
||||||
|
|
||||||
func init() -> void:
|
func init(id : int, color : Color) -> void:
|
||||||
|
player_id = id
|
||||||
last_rotation = get_rotation()
|
last_rotation = get_rotation()
|
||||||
last_translation = get_translation()
|
last_translation = get_translation()
|
||||||
initial_rotation = get_rotation()
|
initial_rotation = get_rotation()
|
||||||
|
@ -41,6 +51,8 @@ func init() -> void:
|
||||||
$MainPanel.visible = true
|
$MainPanel.visible = true
|
||||||
$ThrustPanel.visible = true
|
$ThrustPanel.visible = true
|
||||||
$WeaponsPanel.visible = true
|
$WeaponsPanel.visible = true
|
||||||
|
$InfoPanel.visible = true
|
||||||
|
set_colors(color)
|
||||||
|
|
||||||
func send_thrust_plan() -> void:
|
func send_thrust_plan() -> void:
|
||||||
for element in thrust_plan.current_elements:
|
for element in thrust_plan.current_elements:
|
||||||
|
@ -71,9 +83,18 @@ remote func add_weapons_element(time : float, firing : bool) -> void:
|
||||||
get_parent().get_parent().console_print(String(is_local) + ": Adding weapons element with the following params: time = " + String(time) + ", firing = " + String(firing))
|
get_parent().get_parent().console_print(String(is_local) + ": Adding weapons element with the following params: time = " + String(time) + ", firing = " + String(firing))
|
||||||
weapons_plan.add_element(element)
|
weapons_plan.add_element(element)
|
||||||
|
|
||||||
remote func r_end_turn(r_time_of_death : float) -> void:
|
remote func r_end_turn(
|
||||||
|
r_time_of_death : float,
|
||||||
|
r_end_translation : Vector3,
|
||||||
|
r_end_rotation : Vector3,
|
||||||
|
r_end_linear_velocity : Vector3,
|
||||||
|
r_end_rotational_velocity : Vector3) -> void:
|
||||||
self._on_PlayButton_pressed()
|
self._on_PlayButton_pressed()
|
||||||
time_of_death = r_time_of_death
|
time_of_death = r_time_of_death
|
||||||
|
end_translation = r_end_translation
|
||||||
|
end_rotation = r_end_rotation
|
||||||
|
end_linear_velocity = r_end_linear_velocity
|
||||||
|
end_rotational_velocity = r_end_rotational_velocity
|
||||||
if is_local:
|
if is_local:
|
||||||
$MainPanel/EndTurnButton.disabled = false
|
$MainPanel/EndTurnButton.disabled = false
|
||||||
$MainPanel/TimeBar.value = 0
|
$MainPanel/TimeBar.value = 0
|
||||||
|
@ -161,10 +182,10 @@ func _update_rotate_arrow() -> void:
|
||||||
rotate_arrow_scale_obj.scale = Vector3(rotational_thrust_magnitude, rotational_thrust_magnitude, rotational_thrust_magnitude)
|
rotate_arrow_scale_obj.scale = Vector3(rotational_thrust_magnitude, rotational_thrust_magnitude, rotational_thrust_magnitude)
|
||||||
|
|
||||||
func get_linear_vector() -> Vector3:
|
func get_linear_vector() -> Vector3:
|
||||||
return Vector3($ThrustPanel/XLin.value, $ThrustPanel/YLin.value, $ThrustPanel/ZLin.value) * MAX_LIN_THRUST
|
return Vector3($ThrustPanel/XLin.value, -$ThrustPanel/YLin.value, $ThrustPanel/ZLin.value) * MAX_LIN_THRUST
|
||||||
|
|
||||||
func get_rotational_vector() -> Vector3:
|
func get_rotational_vector() -> Vector3:
|
||||||
return Vector3($ThrustPanel/XRot.value, $ThrustPanel/YRot.value, $ThrustPanel/ZRot.value) * MAX_ROT_THRUST
|
return Vector3($ThrustPanel/XRot.value, -$ThrustPanel/YRot.value, $ThrustPanel/ZRot.value) * MAX_ROT_THRUST
|
||||||
|
|
||||||
func _on_XLin_value_changed(value : float) -> void:
|
func _on_XLin_value_changed(value : float) -> void:
|
||||||
self._update_arrow()
|
self._update_arrow()
|
||||||
|
@ -208,6 +229,14 @@ func _on_ZRot_value_changed(value : float) -> void:
|
||||||
$ThrustPanel/ZRot.value = sign($ThrustPanel/ZRot.value) * \
|
$ThrustPanel/ZRot.value = sign($ThrustPanel/ZRot.value) * \
|
||||||
sqrt(1 - pow($ThrustPanel/YRot.value, 2) - pow($ThrustPanel/XRot.value, 2))
|
sqrt(1 - pow($ThrustPanel/YRot.value, 2) - pow($ThrustPanel/XRot.value, 2))
|
||||||
|
|
||||||
|
func _on_ResetButton_pressed():
|
||||||
|
$ThrustPanel/XLin.value = 0
|
||||||
|
$ThrustPanel/XRot.value = 0
|
||||||
|
$ThrustPanel/YLin.value = 0
|
||||||
|
$ThrustPanel/YRot.value = 0
|
||||||
|
$ThrustPanel/ZLin.value = 0
|
||||||
|
$ThrustPanel/ZRot.value = 0
|
||||||
|
|
||||||
func _get_current_plan_element(all_elements) -> PlanElement:
|
func _get_current_plan_element(all_elements) -> PlanElement:
|
||||||
var summed_time : float = 0.0
|
var summed_time : float = 0.0
|
||||||
for element in all_elements:
|
for element in all_elements:
|
||||||
|
@ -276,6 +305,10 @@ func _physics_process(delta : float) -> void:
|
||||||
|
|
||||||
plan_time += delta
|
plan_time += delta
|
||||||
|
|
||||||
|
func _process(delta : float) -> void:
|
||||||
|
if mouse_over_player:
|
||||||
|
display_data(mouse_over_player)
|
||||||
|
|
||||||
func disable_all_engine_particles() -> void:
|
func disable_all_engine_particles() -> void:
|
||||||
var engine_particles = [
|
var engine_particles = [
|
||||||
$"EngineParticleContainer/S-X,R+Y",
|
$"EngineParticleContainer/S-X,R+Y",
|
||||||
|
@ -300,84 +333,84 @@ func update_engine_particles(linear_thrust : Vector3, rotational_thrust : Vector
|
||||||
var engine_particles : Particles = $"EngineParticleContainer/S-X,R-Y"
|
var engine_particles : Particles = $"EngineParticleContainer/S-X,R-Y"
|
||||||
if linear_thrust.x < 0 or rotational_thrust.y > 0:
|
if linear_thrust.x < 0 or rotational_thrust.y > 0:
|
||||||
engine_particles.emitting = true
|
engine_particles.emitting = true
|
||||||
engine_particles.scale = Vector3.ONE * (max(-linear_thrust.x / MAX_LIN_THRUST, 0)+max(rotational_thrust.y / MAX_ROT_THRUST, 0)) * 0.005
|
engine_particles.scale = Vector3.ONE * (max(-linear_thrust.x, 0)+max(rotational_thrust.y, 0)) * 0.005
|
||||||
else:
|
else:
|
||||||
engine_particles.emitting = false
|
engine_particles.emitting = false
|
||||||
|
|
||||||
engine_particles = $"EngineParticleContainer/S+X,R+Y"
|
engine_particles = $"EngineParticleContainer/S+X,R+Y"
|
||||||
if linear_thrust.x > 0 or rotational_thrust.y < 0:
|
if linear_thrust.x > 0 or rotational_thrust.y < 0:
|
||||||
engine_particles.emitting = true
|
engine_particles.emitting = true
|
||||||
engine_particles.scale = Vector3.ONE * (max(linear_thrust.x / MAX_LIN_THRUST, 0)+max(-rotational_thrust.y / MAX_ROT_THRUST, 0)) * 0.005
|
engine_particles.scale = Vector3.ONE * (max(linear_thrust.x, 0)+max(-rotational_thrust.y, 0)) * 0.005
|
||||||
else:
|
else:
|
||||||
engine_particles.emitting = false
|
engine_particles.emitting = false
|
||||||
|
|
||||||
engine_particles = $"EngineParticleContainer/S-X,R+Y"
|
engine_particles = $"EngineParticleContainer/S-X,R+Y"
|
||||||
if linear_thrust.x < 0 or rotational_thrust.y < 0:
|
if linear_thrust.x < 0 or rotational_thrust.y < 0:
|
||||||
engine_particles.emitting = true
|
engine_particles.emitting = true
|
||||||
engine_particles.scale = Vector3.ONE * (max(-linear_thrust.x / MAX_LIN_THRUST, 0)+max(-rotational_thrust.y / MAX_ROT_THRUST, 0)) * 0.005
|
engine_particles.scale = Vector3.ONE * (max(-linear_thrust.x, 0)+max(-rotational_thrust.y, 0)) * 0.005
|
||||||
else:
|
else:
|
||||||
engine_particles.emitting = false
|
engine_particles.emitting = false
|
||||||
|
|
||||||
engine_particles = $"EngineParticleContainer/S+X,R-Y"
|
engine_particles = $"EngineParticleContainer/S+X,R-Y"
|
||||||
if linear_thrust.x > 0 or rotational_thrust.y > 0:
|
if linear_thrust.x > 0 or rotational_thrust.y > 0:
|
||||||
engine_particles.emitting = true
|
engine_particles.emitting = true
|
||||||
engine_particles.scale = Vector3.ONE * (max(linear_thrust.x / MAX_LIN_THRUST, 0)+max(rotational_thrust.y / MAX_ROT_THRUST, 0)) * 0.005
|
engine_particles.scale = Vector3.ONE * (max(linear_thrust.x, 0)+max(rotational_thrust.y, 0)) * 0.005
|
||||||
else:
|
else:
|
||||||
engine_particles.emitting = false
|
engine_particles.emitting = false
|
||||||
|
|
||||||
engine_particles = $"EngineParticleContainer/S-Y,R+Z,R+X"
|
engine_particles = $"EngineParticleContainer/S-Y,R+Z,R+X"
|
||||||
if linear_thrust.y < 0 or rotational_thrust.z > 0 or rotational_thrust.x > 0:
|
if linear_thrust.y < 0 or rotational_thrust.z > 0 or rotational_thrust.x > 0:
|
||||||
engine_particles.emitting = true
|
engine_particles.emitting = true
|
||||||
engine_particles.scale = Vector3.ONE * (max(-linear_thrust.y / MAX_LIN_THRUST, 0)+max(rotational_thrust.z / MAX_ROT_THRUST, 0)+max(rotational_thrust.x / MAX_ROT_THRUST, 0)) * 0.01/3
|
engine_particles.scale = Vector3.ONE * (max(-linear_thrust.y, 0)+max(rotational_thrust.z, 0)+max(rotational_thrust.x, 0)) * 0.01/3
|
||||||
else:
|
else:
|
||||||
engine_particles.emitting = false
|
engine_particles.emitting = false
|
||||||
|
|
||||||
engine_particles = $"EngineParticleContainer/S-Y,R-Z,R+X"
|
engine_particles = $"EngineParticleContainer/S-Y,R-Z,R+X"
|
||||||
if linear_thrust.y < 0 or rotational_thrust.z < 0 or rotational_thrust.x > 0:
|
if linear_thrust.y < 0 or rotational_thrust.z < 0 or rotational_thrust.x > 0:
|
||||||
engine_particles.emitting = true
|
engine_particles.emitting = true
|
||||||
engine_particles.scale = Vector3.ONE * (max(-linear_thrust.y / MAX_LIN_THRUST, 0)+max(-rotational_thrust.z / MAX_ROT_THRUST, 0)+max(rotational_thrust.x / MAX_ROT_THRUST, 0)) * 0.01/3
|
engine_particles.scale = Vector3.ONE * (max(-linear_thrust.y, 0)+max(-rotational_thrust.z, 0)+max(rotational_thrust.x, 0)) * 0.01/3
|
||||||
else:
|
else:
|
||||||
engine_particles.emitting = false
|
engine_particles.emitting = false
|
||||||
|
|
||||||
engine_particles = $"EngineParticleContainer/S-Y,R-Z,R-X"
|
engine_particles = $"EngineParticleContainer/S-Y,R-Z,R-X"
|
||||||
if linear_thrust.y < 0 or rotational_thrust.z < 0 or rotational_thrust.x < 0:
|
if linear_thrust.y < 0 or rotational_thrust.z < 0 or rotational_thrust.x < 0:
|
||||||
engine_particles.emitting = true
|
engine_particles.emitting = true
|
||||||
engine_particles.scale = Vector3.ONE * (max(-linear_thrust.y / MAX_LIN_THRUST, 0)+max(-rotational_thrust.z / MAX_ROT_THRUST, 0)+max(-rotational_thrust.x / MAX_ROT_THRUST, 0)) * 0.01/3
|
engine_particles.scale = Vector3.ONE * (max(-linear_thrust.y, 0)+max(-rotational_thrust.z, 0)+max(-rotational_thrust.x, 0)) * 0.01/3
|
||||||
else:
|
else:
|
||||||
engine_particles.emitting = false
|
engine_particles.emitting = false
|
||||||
|
|
||||||
engine_particles = $"EngineParticleContainer/S-Y,R+Z,R-X"
|
engine_particles = $"EngineParticleContainer/S-Y,R+Z,R-X"
|
||||||
if linear_thrust.y < 0 or rotational_thrust.z > 0 or rotational_thrust.x < 0:
|
if linear_thrust.y < 0 or rotational_thrust.z > 0 or rotational_thrust.x < 0:
|
||||||
engine_particles.emitting = true
|
engine_particles.emitting = true
|
||||||
engine_particles.scale = Vector3.ONE * (max(-linear_thrust.y / MAX_LIN_THRUST, 0)+max(rotational_thrust.z / MAX_ROT_THRUST, 0)+max(-rotational_thrust.x / MAX_ROT_THRUST, 0)) * 0.01/3
|
engine_particles.scale = Vector3.ONE * (max(-linear_thrust.y, 0)+max(rotational_thrust.z, 0)+max(-rotational_thrust.x, 0)) * 0.01/3
|
||||||
else:
|
else:
|
||||||
engine_particles.emitting = false
|
engine_particles.emitting = false
|
||||||
|
|
||||||
engine_particles = $"EngineParticleContainer/S+Y,R-Z,R+X"
|
engine_particles = $"EngineParticleContainer/S+Y,R-Z,R+X"
|
||||||
if linear_thrust.y > 0 or rotational_thrust.z < 0 or rotational_thrust.x > 0:
|
if linear_thrust.y > 0 or rotational_thrust.z < 0 or rotational_thrust.x > 0:
|
||||||
engine_particles.emitting = true
|
engine_particles.emitting = true
|
||||||
engine_particles.scale = Vector3.ONE * (max(linear_thrust.y / MAX_LIN_THRUST, 0)+max(-rotational_thrust.z / MAX_ROT_THRUST, 0)+max(rotational_thrust.x / MAX_ROT_THRUST, 0)) * 0.01/3
|
engine_particles.scale = Vector3.ONE * (max(linear_thrust.y, 0)+max(-rotational_thrust.z, 0)+max(rotational_thrust.x, 0)) * 0.01/3
|
||||||
else:
|
else:
|
||||||
engine_particles.emitting = false
|
engine_particles.emitting = false
|
||||||
|
|
||||||
engine_particles = $"EngineParticleContainer/S+Y,R+Z,R+X"
|
engine_particles = $"EngineParticleContainer/S+Y,R+Z,R+X"
|
||||||
if linear_thrust.y > 0 or rotational_thrust.z > 0 or rotational_thrust.x > 0:
|
if linear_thrust.y > 0 or rotational_thrust.z > 0 or rotational_thrust.x > 0:
|
||||||
engine_particles.emitting = true
|
engine_particles.emitting = true
|
||||||
engine_particles.scale = Vector3.ONE * (max(linear_thrust.y / MAX_LIN_THRUST, 0)+max(rotational_thrust.z / MAX_ROT_THRUST, 0)+max(rotational_thrust.x / MAX_ROT_THRUST, 0)) * 0.01/3
|
engine_particles.scale = Vector3.ONE * (max(linear_thrust.y, 0)+max(rotational_thrust.z, 0)+max(rotational_thrust.x, 0)) * 0.01/3
|
||||||
else:
|
else:
|
||||||
engine_particles.emitting = false
|
engine_particles.emitting = false
|
||||||
|
|
||||||
engine_particles = $"EngineParticleContainer/S+Y,R-Z,R-X"
|
engine_particles = $"EngineParticleContainer/S+Y,R-Z,R-X"
|
||||||
if linear_thrust.y > 0 or rotational_thrust.z < 0 or rotational_thrust.x < 0:
|
if linear_thrust.y > 0 or rotational_thrust.z < 0 or rotational_thrust.x < 0:
|
||||||
engine_particles.emitting = true
|
engine_particles.emitting = true
|
||||||
engine_particles.scale = Vector3.ONE * (max(linear_thrust.y / MAX_LIN_THRUST, 0)+max(-rotational_thrust.z / MAX_ROT_THRUST, 0)+max(-rotational_thrust.x / MAX_ROT_THRUST, 0)) * 0.01/3
|
engine_particles.scale = Vector3.ONE * (max(linear_thrust.y, 0)+max(-rotational_thrust.z, 0)+max(-rotational_thrust.x, 0)) * 0.01/3
|
||||||
else:
|
else:
|
||||||
engine_particles.emitting = false
|
engine_particles.emitting = false
|
||||||
|
|
||||||
engine_particles = $"EngineParticleContainer/S+Y,R+Z,R-X"
|
engine_particles = $"EngineParticleContainer/S+Y,R+Z,R-X"
|
||||||
if linear_thrust.y > 0 or rotational_thrust.z > 0 or rotational_thrust.x < 0:
|
if linear_thrust.y > 0 or rotational_thrust.z > 0 or rotational_thrust.x < 0:
|
||||||
engine_particles.emitting = true
|
engine_particles.emitting = true
|
||||||
engine_particles.scale = Vector3.ONE * (max(linear_thrust.y / MAX_LIN_THRUST, 0)+max(rotational_thrust.z / MAX_ROT_THRUST, 0)+max(-rotational_thrust.x / MAX_ROT_THRUST, 0)) * 0.01/3
|
engine_particles.scale = Vector3.ONE * (max(linear_thrust.y, 0)+max(rotational_thrust.z, 0)+max(-rotational_thrust.x, 0)) * 0.01/3
|
||||||
else:
|
else:
|
||||||
engine_particles.emitting = false
|
engine_particles.emitting = false
|
||||||
|
|
||||||
|
@ -389,19 +422,25 @@ func update_engine_particles(linear_thrust : Vector3, rotational_thrust : Vector
|
||||||
var modz : float = linear_thrust.z
|
var modz : float = linear_thrust.z
|
||||||
if modz < 0:
|
if modz < 0:
|
||||||
modz = -modz
|
modz = -modz
|
||||||
engine_particles.scale = Vector3.ONE * (modz / MAX_ROT_THRUST) * 0.02
|
engine_particles.scale = Vector3.ONE * (modz) * 0.02
|
||||||
engine_particles2.scale = Vector3.ONE * (modz / MAX_ROT_THRUST) * 0.02
|
engine_particles2.scale = Vector3.ONE * (modz) * 0.02
|
||||||
else:
|
else:
|
||||||
engine_particles.emitting = false
|
engine_particles.emitting = false
|
||||||
engine_particles2.emitting = false
|
engine_particles2.emitting = false
|
||||||
|
|
||||||
func play_current_plan():
|
func play_current_plan() -> void:
|
||||||
pass
|
set_linear_velocity(end_linear_velocity)
|
||||||
|
set_angular_velocity(end_rotational_velocity)
|
||||||
|
set_translation(end_translation)
|
||||||
|
set_rotation(end_rotation)
|
||||||
|
|
||||||
func play_all_plans():
|
running_plan = true
|
||||||
|
plan_time = 5 * len(thrust_plan.elements)
|
||||||
|
|
||||||
|
func play_all_plans() -> void:
|
||||||
get_parent().play_full_plans()
|
get_parent().play_full_plans()
|
||||||
|
|
||||||
func play_full_plan():
|
func play_full_plan() -> void:
|
||||||
set_linear_velocity(initial_velocity)
|
set_linear_velocity(initial_velocity)
|
||||||
set_angular_velocity(initial_rotational_velocity)
|
set_angular_velocity(initial_rotational_velocity)
|
||||||
set_translation(initial_translation)
|
set_translation(initial_translation)
|
||||||
|
@ -409,23 +448,74 @@ func play_full_plan():
|
||||||
running_plan = true
|
running_plan = true
|
||||||
plan_time = 0.0
|
plan_time = 0.0
|
||||||
|
|
||||||
func _on_PlayButton_pressed():
|
func _on_PlayButton_pressed() -> void:
|
||||||
play_all_plans()
|
play_all_plans()
|
||||||
|
|
||||||
func _update_battery_visuals(value : float):
|
func _update_battery_visuals(value : float) -> void:
|
||||||
# Assume value is between 0 and 100
|
# Assume value is between 0 and 100
|
||||||
$WeaponsPanel/FillingBlocker.margin_bottom = 65 - (value * 1.2)
|
$WeaponsPanel/FillingBlocker.margin_bottom = 65 - (value * 1.2)
|
||||||
|
|
||||||
func _update_laser(length : float):
|
func _update_laser(length : float) -> void:
|
||||||
$GunContainer/RayCast/CSGCylinder.height = length
|
$GunContainer/RayCast/CSGCylinder.height = length
|
||||||
$GunContainer/RayCast/CSGCylinder.translation = Vector3(0, length/2, 0)
|
$GunContainer/RayCast/CSGCylinder.translation = Vector3(0, length/2, 0)
|
||||||
|
|
||||||
func _fire_gun():
|
func _fire_gun() -> void:
|
||||||
$GunContainer.visible = true
|
$GunContainer.visible = true
|
||||||
if $GunContainer/RayCast.is_colliding():
|
if $GunContainer/RayCast.is_colliding():
|
||||||
var raycast_pos : Vector3 = $GunContainer/RayCast.global_transform.origin
|
var raycast_pos : Vector3 = $GunContainer/RayCast.global_transform.origin
|
||||||
var target_pos : Vector3 = $GunContainer/RayCast.get_collision_point()
|
var target_pos : Vector3 = $GunContainer/RayCast.get_collision_point()
|
||||||
var diff : Vector3 = raycast_pos - target_pos
|
_update_laser(raycast_pos.distance_to(target_pos))
|
||||||
_update_laser(diff.length())
|
|
||||||
else:
|
else:
|
||||||
_update_laser($GunContainer/RayCast.cast_to.y)
|
_update_laser($GunContainer/RayCast.cast_to.y)
|
||||||
|
|
||||||
|
func get_display_name() -> String:
|
||||||
|
return get_parent().get_parent().name_dict[player_id]
|
||||||
|
|
||||||
|
func get_human_readable_vector(vector : Vector3) -> String:
|
||||||
|
return "(" + String(round(vector.x * 10)/10) + ", " + \
|
||||||
|
String(round(vector.y * 10)/10) + ", " + \
|
||||||
|
String(round(vector.z * 10)/10) + ")"
|
||||||
|
|
||||||
|
func display_data(player_obj : RigidBody) -> void:
|
||||||
|
var text = "Name: " + player_obj.get_display_name() + "\n"
|
||||||
|
text += "Position: " + get_human_readable_vector(player_obj.translation) + "\n"
|
||||||
|
text += "Rotation: " + get_human_readable_vector(player_obj.rotation_degrees) + "\n"
|
||||||
|
text += "Attitude: Hostile"
|
||||||
|
|
||||||
|
$InfoPanel/Label.text = text
|
||||||
|
mouse_over_player = player_obj
|
||||||
|
|
||||||
|
func clear_info_panel() -> void:
|
||||||
|
$InfoPanel/Label.text = ""
|
||||||
|
mouse_over_player = null
|
||||||
|
|
||||||
|
func _on_Player_mouse_entered():
|
||||||
|
get_parent().mouse_enter(self)
|
||||||
|
|
||||||
|
func _on_Player_mouse_exited():
|
||||||
|
get_parent().mouse_exit(self)
|
||||||
|
|
||||||
|
func _on_PlayLastButton_pressed():
|
||||||
|
if len(thrust_plan.elements) == 0:
|
||||||
|
play_full_plan()
|
||||||
|
else:
|
||||||
|
play_current_plan()
|
||||||
|
|
||||||
|
func set_colors(color : Color):
|
||||||
|
var insideMaterial : Material = preload("res://Shaders/InsideSpaceship.tres").duplicate()
|
||||||
|
insideMaterial.emission = color
|
||||||
|
|
||||||
|
var outsideMaterial : Material = preload("res://Shaders/OutsideSpaceship.material").duplicate()
|
||||||
|
outsideMaterial.emission = color
|
||||||
|
outsideMaterial.albedo_color = color
|
||||||
|
|
||||||
|
var particleMaterial : Material = preload("res://Shaders/ParticleSpaceship.tres").duplicate()
|
||||||
|
particleMaterial.emission = color
|
||||||
|
|
||||||
|
for child in $EngineParticleContainer.get_children():
|
||||||
|
child.draw_pass_1.material = particleMaterial
|
||||||
|
for child in $spaceship.get_children():
|
||||||
|
if child.name == "Cube":
|
||||||
|
child.set_surface_material(0, insideMaterial)
|
||||||
|
else:
|
||||||
|
child.set_surface_material(0, outsideMaterial)
|
||||||
|
|
|
@ -5,6 +5,10 @@ const PORT : int = 9374
|
||||||
const Arena = preload("res://Scenes/Arena.tscn")
|
const Arena = preload("res://Scenes/Arena.tscn")
|
||||||
var console_output : TextEdit = null
|
var console_output : TextEdit = null
|
||||||
var peer : NetworkedMultiplayerENet = null
|
var peer : NetworkedMultiplayerENet = null
|
||||||
|
var display_name : String = ""
|
||||||
|
var player_color : Color = Color.white
|
||||||
|
var name_dict = {}
|
||||||
|
var color_dict = {}
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
get_tree().connect("connected_to_server", self, "_connected_to_server")
|
get_tree().connect("connected_to_server", self, "_connected_to_server")
|
||||||
|
@ -19,6 +23,8 @@ func _process(delta : float) -> void:
|
||||||
|
|
||||||
func _connected_to_server() -> void:
|
func _connected_to_server() -> void:
|
||||||
self.console_print("Connected to server") # Let the server know all about us (eg name)
|
self.console_print("Connected to server") # Let the server know all about us (eg name)
|
||||||
|
rpc("set_display_name", peer.get_unique_id(), display_name)
|
||||||
|
rpc("set_player_color", peer.get_unique_id(), player_color)
|
||||||
|
|
||||||
func _server_disconnected() -> void:
|
func _server_disconnected() -> void:
|
||||||
var button : Button = $Lobby/StartButton
|
var button : Button = $Lobby/StartButton
|
||||||
|
@ -45,6 +51,8 @@ func toggle_console() -> bool:
|
||||||
func _on_StartButton_pressed() -> void:
|
func _on_StartButton_pressed() -> void:
|
||||||
var button : Button = $Lobby/StartButton
|
var button : Button = $Lobby/StartButton
|
||||||
var ip_addr : String = $Lobby/IPLineEdit.text
|
var ip_addr : String = $Lobby/IPLineEdit.text
|
||||||
|
display_name = $Lobby/NameLineEdit.text
|
||||||
|
player_color = $Lobby/ColorPicker.color
|
||||||
button.disabled = true
|
button.disabled = true
|
||||||
peer = NetworkedMultiplayerENet.new()
|
peer = NetworkedMultiplayerENet.new()
|
||||||
peer.create_client(ip_addr, PORT)
|
peer.create_client(ip_addr, PORT)
|
||||||
|
@ -60,3 +68,18 @@ remote func start_game() -> void:
|
||||||
arena.init()
|
arena.init()
|
||||||
console_print('Starting Game...')
|
console_print('Starting Game...')
|
||||||
|
|
||||||
|
remote func add_name_to_dict(id : int, display_name : String):
|
||||||
|
name_dict[id] = display_name
|
||||||
|
|
||||||
|
remote func add_color_to_dict(id : int, color : Color):
|
||||||
|
color_dict[id] = color
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
[gd_resource type="SpatialMaterial" format=2]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
flags_transparent = true
|
||||||
|
albedo_color = Color( 1, 1, 1, 0.231373 )
|
||||||
|
metallic = 1.0
|
||||||
|
metallic_specular = 1.0
|
||||||
|
roughness = 0.05
|
||||||
|
emission_enabled = true
|
||||||
|
emission = Color( 0.309804, 0.776471, 0.905882, 1 )
|
||||||
|
emission_energy = 0.05
|
||||||
|
emission_operator = 0
|
||||||
|
emission_on_uv2 = false
|
||||||
|
depth_enabled = true
|
||||||
|
depth_scale = 0.05
|
||||||
|
depth_deep_parallax = false
|
||||||
|
depth_flip_tangent = false
|
||||||
|
depth_flip_binormal = false
|
||||||
|
subsurf_scatter_enabled = true
|
||||||
|
subsurf_scatter_strength = 0.28
|
||||||
|
transmission_enabled = true
|
||||||
|
transmission = Color( 0, 0, 0, 1 )
|
||||||
|
refraction_enabled = true
|
||||||
|
refraction_scale = 0.5
|
||||||
|
refraction_texture_channel = 0
|
Binary file not shown.
|
@ -0,0 +1,9 @@
|
||||||
|
[gd_resource type="SpatialMaterial" format=2]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
albedo_color = Color( 0, 0, 0, 1 )
|
||||||
|
emission_enabled = true
|
||||||
|
emission = Color( 0, 0.905882, 1, 1 )
|
||||||
|
emission_energy = 16.0
|
||||||
|
emission_operator = 0
|
||||||
|
emission_on_uv2 = false
|
|
@ -162,6 +162,11 @@ camera_yaw_left={
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":74,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":74,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
camera_switch_player={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777218,"unicode":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[locale]
|
[locale]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue