Skip to content

Commit

Permalink
feat: fixes and improvements (read info) (#26)
Browse files Browse the repository at this point in the history
* fix: min-floor-step
fix: multi tooltips
feat: prettier tooltip
feat: add fade when panels change
feat: add some particles to walk
fix: typo in actions (3,4,5,6)
feat: prepare global config script (and advance settings)
chore: disable CI build for PRs
feat: add text command (/goto or /go)

* fix: map shader and popup window

* fix clippy
  • Loading branch information
leanmendoza authored Jul 13, 2023
1 parent f6c58bb commit 376bbc9
Show file tree
Hide file tree
Showing 30 changed files with 942 additions and 191 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:

build:
name: Build and test
# Commented to test if: ${{ github.ref == 'refs/heads/main' }}
if: ${{ github.ref == 'refs/heads/main' }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
Expand Down
Binary file not shown.
47 changes: 36 additions & 11 deletions godot/assets/test_player/player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,30 @@ extends CharacterBody3D
@onready var animation_player: AnimationPlayer = $PlayerVisuals/AnimationPlayer
@onready var direction: Vector3 = Vector3(0, 0, 0)
@onready var visuals = $PlayerVisuals
@onready var particles_move = $PlayerVisuals/GPUParticles3D_Move
@onready var particles_jump = $PlayerVisuals/GPUParticles3D_Jump
@onready var particles_land = $PlayerVisuals/GPUParticles3D_Land

var first_person: bool = true
var _mouse_position = Vector2(0.0, 0.0)
var captured: bool = true

var is_on_air: bool

@export var vertical_sens: float = 0.5
@export var horizontal_sens: float = 0.5


func _ready():
camera.current = true

if is_on_floor():
is_on_air = false
particles_move.emitting = false
if captured:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)

first_person = false
var tween_out = create_tween()
tween_out.tween_property(camera, "position", Vector3(0.5, 0, 4), 0.25).set_ease(
Tween.EASE_IN_OUT
Expand All @@ -26,15 +41,6 @@ func _ready():

floor_snap_length = 0.2

# Fix the Idle animation


# var idle_anim := animation_player.get_animation("Idle")
# for i in range(idle_anim.get_track_count()):
# var original_path: NodePath = idle_anim.track_get_path(i)
# var bone_name: StringName = original_path.get_name(original_path.get_name_count() - 1)
# idle_anim.track_set_path(i, NodePath("Armature/Skeleton3D:" + bone_name))


func _input(event):
# Receives mouse motion
Expand All @@ -45,10 +51,12 @@ func _input(event):
mount_camera.rotate_x(deg_to_rad(-_mouse_position.y) * vertical_sens)
if first_person:
mount_camera.rotation.x = clamp(
mount_camera.rotation.x, deg_to_rad(-60), deg_to_rad(60)
mount_camera.rotation.x, deg_to_rad(-60), deg_to_rad(90)
)
else:
mount_camera.rotation.x = clamp(mount_camera.rotation.x, deg_to_rad(-60), deg_to_rad(5))
mount_camera.rotation.x = clamp(
mount_camera.rotation.x, deg_to_rad(-70), deg_to_rad(45)
)

# Release mouse
if event is InputEventKey:
Expand Down Expand Up @@ -87,15 +95,31 @@ func _physics_process(delta: float) -> void:
var input_dir := Input.get_vector("ia_left", "ia_right", "ia_forward", "ia_backward")
direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()

if is_on_floor():
if not is_on_floor() == is_on_air:
particles_jump.emitting = true
is_on_air = is_on_floor()
else:
if not is_on_floor() == is_on_air:
particles_land.emitting = true
is_on_air = is_on_floor()

if not is_on_floor():
particles_move.emitting = false
if Input.is_action_pressed("double_gravity"):
velocity.y -= GRAVITY * delta * .5
else:
velocity.y -= GRAVITY * delta

elif Input.is_action_just_pressed("ia_jump"):
velocity.y = JUMP_VELOCITY_0

if direction:
if is_on_floor():
particles_move.emitting = true
else:
particles_move.emitting = false

if Input.is_action_pressed("ia_walk"):
if animation_player.current_animation != "Walk":
animation_player.play("Walk")
Expand All @@ -111,6 +135,7 @@ func _physics_process(delta: float) -> void:
visuals.look_at(direction + position)

else:
particles_move.emitting = false
if animation_player.current_animation != "Idle":
animation_player.play("Idle")
velocity.x = move_toward(velocity.x, 0, WALK_SPEED)
Expand Down
77 changes: 73 additions & 4 deletions godot/assets/test_player/player.tscn
Original file line number Diff line number Diff line change
@@ -1,19 +1,57 @@
[gd_scene load_steps=4 format=3 uid="uid://blv7r5folt1d5"]
[gd_scene load_steps=10 format=3 uid="uid://blv7r5folt1d5"]

[ext_resource type="Script" path="res://assets/test_player/player.gd" id="1_5bfm2"]
[ext_resource type="PackedScene" uid="uid://n0dpindtmshg" path="res://assets/test_player/player_visuals.tscn" id="2_0hdg3"]

[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_pxti1"]
margin = 0.05
radius = 0.25
height = 1.50214

[sub_resource type="SeparationRayShape3D" id="SeparationRayShape3D_3217e"]
length = 1.0779

[sub_resource type="Curve" id="Curve_ps6qo"]
_data = [Vector2(0, 0.190909), 0.0, 0.0, 0, 0, Vector2(0.623809, 0.390909), 0.0, 0.0, 0, 0, Vector2(1, 0.0636363), 0.0, 0.0, 0, 0]
point_count = 3

[sub_resource type="CurveTexture" id="CurveTexture_lroyk"]
curve = SubResource("Curve_ps6qo")

[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_c6405"]
emission_shape = 3
emission_box_extents = Vector3(0.1, 0, 0.1)
direction = Vector3(0, 0, 0)
spread = 90.0
gravity = Vector3(0, 0.1, 0)
initial_velocity_max = 0.2
radial_accel_min = 0.5
radial_accel_max = 1.0
damping_max = 0.85
scale_min = 0.0
scale_max = 1.5
scale_curve = SubResource("CurveTexture_lroyk")

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6htl0"]
albedo_color = Color(0.913725, 0.886275, 0.839216, 1)

[sub_resource type="SphereMesh" id="SphereMesh_e8vgg"]
material = SubResource("StandardMaterial3D_6htl0")
radius = 0.1
height = 0.1

[node name="Player" type="CharacterBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.11208, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.1, 0)
script = ExtResource("1_5bfm2")

[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.1, 0)
[node name="CollisionShape3D_Body" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.053255, 0)
shape = SubResource("CapsuleShape3D_pxti1")

[node name="CollisionShape3D_ContactPoint" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0)
shape = SubResource("SeparationRayShape3D_3217e")

[node name="Mount" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.610448, 0)

Expand All @@ -22,3 +60,34 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.85493e-08, 0, -0.212179)
current = true

[node name="PlayerVisuals" parent="." instance=ExtResource("2_0hdg3")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0441519, 0)

[node name="GPUParticles3D_Move" type="GPUParticles3D" parent="PlayerVisuals"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.02931, -0.00253904)
amount = 2
lifetime = 0.5
visibility_aabb = AABB(-4, -3.88281, -4, 8, 8, 8)
process_material = SubResource("ParticleProcessMaterial_c6405")
draw_pass_1 = SubResource("SphereMesh_e8vgg")

[node name="GPUParticles3D_Jump" type="GPUParticles3D" parent="PlayerVisuals"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.02931, -0.00253904)
emitting = false
amount = 10
lifetime = 0.5
one_shot = true
explosiveness = 1.0
visibility_aabb = AABB(-4, -3.88281, -4, 8, 8, 8)
process_material = SubResource("ParticleProcessMaterial_c6405")
draw_pass_1 = SubResource("SphereMesh_e8vgg")

[node name="GPUParticles3D_Land" type="GPUParticles3D" parent="PlayerVisuals"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.02931, -0.00253904)
emitting = false
amount = 10
lifetime = 0.5
one_shot = true
explosiveness = 1.0
visibility_aabb = AABB(-4, -3.88281, -4, 8, 8, 8)
process_material = SubResource("ParticleProcessMaterial_c6405")
draw_pass_1 = SubResource("SphereMesh_e8vgg")
18 changes: 14 additions & 4 deletions godot/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,22 @@ ia_secondary={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"key_label":0,"unicode":102,"echo":false,"script":null)
]
}
ia_action3={
ia_action_3={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":49,"key_label":0,"unicode":49,"echo":false,"script":null)
]
}
ia_action4={
ia_action_4={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":50,"key_label":0,"unicode":50,"echo":false,"script":null)
]
}
ia_action5={
ia_action_5={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":51,"key_label":0,"unicode":51,"echo":false,"script":null)
]
}
ia_action6={
ia_action_6={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":52,"key_label":0,"unicode":52,"echo":false,"script":null)
]
Expand All @@ -118,6 +118,16 @@ double_gravity={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194326,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
interact={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"echo":false,"script":null)
]
}
use={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":85,"key_label":0,"unicode":117,"echo":false,"script":null)
]
}

[layer_names]

Expand Down
58 changes: 58 additions & 0 deletions godot/src/global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,63 @@ func add_raycast(id: int, time: float, from: Vector3, to: Vector3) -> void:
raycast_debugger.add_raycast(id, time, from, to)


var config_dictionary: Dictionary = {
"gravity": 55.0,
"jump_velocity": 12.0,
"walk_velocity": 12.0,
"run_velocity": 20.0,
"process_tick_quota": 1,
"scene_radius": 1,
}

signal config_changed


func _load():
pass


func _save():
emit_signal("config_changed")
pass


func _default():
pass


func get_resolution():
return (
config_dictionary
. get(
"resolution",
)
)


func get_gravity():
return config_dictionary.get("gravity", 55.0)


func get_jump_velocity():
return config_dictionary.get("jump_velocity", 12.0)


func get_walk_velocity():
return config_dictionary.get("walk_velocity", 12.0)


func get_run_velocity():
return config_dictionary.get("run_velocity", 20.0)


func get_process_tick_quota():
return config_dictionary.get("process_tick_quota", 1)


func get_scene_radius():
return config_dictionary.get("scene_radius", 1)


func get_tls_client():
return TLSOptions.client_unsafe()
2 changes: 1 addition & 1 deletion godot/src/logic/content_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func process_loading_gltf(content: Dictionary, finished_downloads: Array[Request
return true


func split_animations(gltf_node: Node) -> void:
func split_animations(_gltf_node: Node) -> void:
pass


Expand Down
62 changes: 62 additions & 0 deletions godot/src/ui/components/advance_settings/advance_settings.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
extends Control

@onready
var h_slider_process_tick_quota = $VBoxContainer_General/VBoxContainer_ProcessTickQuota/HBoxContainer/HSlider_ProcessTickQuota
@onready
var label_process_tick_quota_value = $VBoxContainer_General/VBoxContainer_ProcessTickQuota/HBoxContainer/Label_ProcessTickQuotaValue
@onready
var h_slider_scene_radius = $VBoxContainer_General/VBoxContainer_SceneRadius/HBoxContainer/HSlider_SceneRadius
@onready
var label_scene_radius_value = $VBoxContainer_General/VBoxContainer_SceneRadius/HBoxContainer/Label_SceneRadiusValue
@onready
var line_edit_gravity = $VBoxContainer_General/HBoxContainer/HBoxContainer_Gravity/LineEdit_Gravity
@onready
var line_edit_jump_velocity = $VBoxContainer_General/HBoxContainer/HBoxContainer_JumpVelocity/LineEdit_JumpVelocity
@onready
var line_edit_run_speed = $VBoxContainer_General/HBoxContainer2/HBoxContainer_RunSpeed/LineEdit_RunSpeed
@onready
var line_edit_walk_speed = $VBoxContainer_General/HBoxContainer2/HBoxContainer_WalkSpeed/LineEdit_WalkSpeed

var gravity: float
var walk_velocity: float
var run_velocity: float
var jump_velocity: float
var scene_radius: int
var process_tick_quota: int


func _ready():
get_config_dictionary()
refresh_values()


func get_config_dictionary():
gravity = Global.get_gravity()
walk_velocity = Global.get_walk_velocity()
run_velocity = Global.get_run_velocity()
jump_velocity = Global.get_jump_velocity()
scene_radius = Global.get_scene_radius()
process_tick_quota = Global.get_process_tick_quota()


func refresh_values():
line_edit_gravity.text = str(gravity).pad_decimals(1)
line_edit_walk_speed.text = str(walk_velocity).pad_decimals(1)
line_edit_run_speed.text = str(run_velocity).pad_decimals(1)
line_edit_jump_velocity.text = str(jump_velocity).pad_decimals(1)
h_slider_process_tick_quota.set_value_no_signal(process_tick_quota)
h_slider_scene_radius.set_value_no_signal(scene_radius)
label_process_tick_quota_value.text = str(process_tick_quota)
label_scene_radius_value.text = str(scene_radius)


func apply_changes():
pass


func _on_h_slider_process_tick_quota_value_changed(value):
label_process_tick_quota_value.text = str(value)


func _on_h_slider_scene_radius_value_changed(value):
label_scene_radius_value.text = str(value)
Loading

0 comments on commit 376bbc9

Please sign in to comment.