diff options
author | Hop311 <hop3114@gmail.com> | 2023-03-31 14:53:21 +0200 |
---|---|---|
committer | Hop311 <hop3114@gmail.com> | 2023-03-31 14:53:21 +0200 |
commit | 60ddfc88fd6dc259792532fadf9cc4407f90e95f (patch) | |
tree | 1db456df58644aee8f699946c567fd0700fbc8b7 /game/src | |
parent | 4e66822327a1d964a6324bd28e068c10a7183c65 (diff) |
Removed SubViewport and made more variables export
Diffstat (limited to 'game/src')
-rw-r--r-- | game/src/GameSession/GameSession.tscn | 10 | ||||
-rw-r--r-- | game/src/GameSession/MapView.gd (renamed from game/src/GameSession/MapViewport.gd) | 16 | ||||
-rw-r--r-- | game/src/GameSession/MapView.tscn (renamed from game/src/GameSession/MapViewport.tscn) | 19 |
3 files changed, 17 insertions, 28 deletions
diff --git a/game/src/GameSession/GameSession.tscn b/game/src/GameSession/GameSession.tscn index a707b04..fb9bb3d 100644 --- a/game/src/GameSession/GameSession.tscn +++ b/game/src/GameSession/GameSession.tscn @@ -3,7 +3,7 @@ [ext_resource type="Script" path="res://src/GameSession/GameSession.gd" id="1_eklvp"] [ext_resource type="PackedScene" uid="uid://g524p8lr574w" path="res://src/GameSession/MapControlPanel.tscn" id="3_afh6d"] [ext_resource type="PackedScene" uid="uid://dvdynl6eir40o" path="res://src/GameSession/GameSessionMenu.tscn" id="3_bvmqh"] -[ext_resource type="PackedScene" uid="uid://dkehmdnuxih2r" path="res://src/GameSession/MapViewport.tscn" id="4_xkg5j"] +[ext_resource type="PackedScene" uid="uid://dkehmdnuxih2r" path="res://src/GameSession/MapView.tscn" id="4_xkg5j"] [node name="GameSession" type="Control" node_paths=PackedStringArray("_game_session_menu")] editor_description = "SS-102" @@ -16,13 +16,7 @@ grow_vertical = 2 script = ExtResource("1_eklvp") _game_session_menu = NodePath("GameSessionMenu") -[node name="MapViewport" parent="." instance=ExtResource("4_xkg5j")] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 +[node name="MapView" parent="." instance=ExtResource("4_xkg5j")] [node name="GameSessionMenu" parent="." instance=ExtResource("3_bvmqh")] visible = false diff --git a/game/src/GameSession/MapViewport.gd b/game/src/GameSession/MapView.gd index fa57163..4d06066 100644 --- a/game/src/GameSession/MapViewport.gd +++ b/game/src/GameSession/MapView.gd @@ -1,4 +1,4 @@ -extends SubViewportContainer +extends Node3D const _action_north : StringName = &"map_north" const _action_east : StringName = &"map_east" @@ -7,14 +7,14 @@ const _action_west : StringName = &"map_west" const _action_zoomin : StringName = &"map_zoomin" const _action_zoomout : StringName = &"map_zoomout" -const _move_speed : float = 1.0 +@export var _move_speed : float = 1.0 -const _zoom_target_min : float = 0.2 -const _zoom_target_max : float = 5.0 -const _zoom_target_step : float = 0.1 -const _zoom_epsilon : float = _zoom_target_step * 0.1 -const _zoom_speed : float = 5.0 -var _zoom_target : float = 1.0: +@export var _zoom_target_min : float = 0.2 +@export var _zoom_target_max : float = 5.0 +@export var _zoom_target_step : float = 0.1 +@export var _zoom_epsilon : float = _zoom_target_step * 0.1 +@export var _zoom_speed : float = 5.0 +@export var _zoom_target : float = 1.0: get: return _zoom_target set(v): _zoom_target = clamp(v, _zoom_target_min, _zoom_target_max) diff --git a/game/src/GameSession/MapViewport.tscn b/game/src/GameSession/MapView.tscn index 8a34b54..4c34035 100644 --- a/game/src/GameSession/MapViewport.tscn +++ b/game/src/GameSession/MapView.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=6 format=3 uid="uid://dkehmdnuxih2r"] -[ext_resource type="Script" path="res://src/GameSession/MapViewport.gd" id="1_exccw"] +[ext_resource type="Script" path="res://src/GameSession/MapView.gd" id="1_exccw"] [ext_resource type="Shader" path="res://src/GameSession/TerrainMap.gdshader" id="1_upocn"] [ext_resource type="Texture2D" uid="uid://cmw0pvjthnn8c" path="res://common/map/terrain/terrain.png" id="3_l8pnf"] @@ -12,20 +12,15 @@ shader_parameter/tex = ExtResource("3_l8pnf") [sub_resource type="PlaneMesh" id="PlaneMesh_skc48"] size = Vector2(10.8, 2) -[node name="MapViewportContainer" type="SubViewportContainer" node_paths=PackedStringArray("_camera", "_map_mesh")] -stretch = true +[node name="MapView" type="Node3D" node_paths=PackedStringArray("_camera", "_map_mesh")] script = ExtResource("1_exccw") -_camera = NodePath("MapViewport/Camera3D") -_map_mesh = NodePath("MapViewport/MeshInstance3D") +_camera = NodePath("MapCamera") +_map_mesh = NodePath("MapMeshInstance") -[node name="MapViewport" type="SubViewport" parent="."] -handle_input_locally = false -render_target_update_mode = 4 +[node name="MapCamera" type="Camera3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 1, 1) -[node name="MeshInstance3D" type="MeshInstance3D" parent="MapViewport"] +[node name="MapMeshInstance" type="MeshInstance3D" parent="."] transform = Transform3D(5, 0, 0, 0, 5, 0, 0, 0, 5, 0, 0, 0) material_override = SubResource("ShaderMaterial_tayeg") mesh = SubResource("PlaneMesh_skc48") - -[node name="Camera3D" type="Camera3D" parent="MapViewport"] -transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 1, 1) |