generated from krampus/template-godot4
Shot projection is configurable in settings
This commit is contained in:
parent
906e161b67
commit
508e9d593b
|
@ -19,6 +19,9 @@ SETTINGS_GAME_ACCESSIBILITY_HEADING,Accessibility
|
|||
SETTINGS_GAME_CAMERA_HEADING,Camera
|
||||
SETTINGS_SCREEN_SHAKE,"Enable Screen Shake"
|
||||
SETTINGS_HIT_LAG,"Enable Hit Lag Effect"
|
||||
SETTINGS_GAME_GAMEPLAY_HEADING,Gameplay
|
||||
SETTINGS_PROJECTION_COLLISIONS,"Enable Shot Projection Collisions"
|
||||
SETTINGS_PROJECTION_GRAVITY,"Use Local Gravity for Shot Projection"
|
||||
SETTINGS_FREE_CAMERA_SPEED,"Free Camera Speed"
|
||||
SETTINGS_SENSITIVITY_X,"Sensitivity, Horizontal"
|
||||
SETTINGS_SENSITIVITY_Y,"Sensitivity, Vertical"
|
||||
|
|
|
|
@ -62,6 +62,8 @@ config/controls/camera/invert_pitch=false
|
|||
config/accessibility/enable_screen_shake=true
|
||||
config/accessibility/enable_hit_lag=true
|
||||
audio/buses/override_bus_layout="user://audio_bus_layout.tres"
|
||||
config/gameplay/projection/detect_collision=true
|
||||
config/gameplay/projection/use_local_gravity=true
|
||||
|
||||
[global_group]
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@ var invert_pitch: bool
|
|||
var enable_screen_shake: bool
|
||||
var enable_hit_lag: bool
|
||||
|
||||
var projection_collisions: bool
|
||||
var projection_gravity: bool
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
ProjectSettings.settings_changed.connect(_read_settings)
|
||||
|
@ -36,6 +39,13 @@ func _read_settings() -> void:
|
|||
)
|
||||
enable_hit_lag = ProjectSettings.get_setting("game/config/accessibility/enable_hit_lag")
|
||||
|
||||
projection_collisions = ProjectSettings.get_setting(
|
||||
"game/config/gameplay/projection/detect_collision"
|
||||
)
|
||||
projection_gravity = ProjectSettings.get_setting(
|
||||
"game/config/gameplay/projection/use_local_gravity"
|
||||
)
|
||||
|
||||
|
||||
func _load_audio_bus_override() -> void:
|
||||
# Load override audio bus file
|
||||
|
|
|
@ -79,7 +79,7 @@ func _process(_delta: float) -> void:
|
|||
|
||||
# Get local gravity if enabled
|
||||
var local_gravity := gravity * gravity_vec
|
||||
if check_gravity:
|
||||
if check_gravity and Game.settings.projection_gravity:
|
||||
local_gravity = _get_gravity(pos)
|
||||
|
||||
# Integrate projectile path
|
||||
|
@ -87,7 +87,7 @@ func _process(_delta: float) -> void:
|
|||
var next_pos := pos + vel * time_step
|
||||
|
||||
# Collision
|
||||
if check_collision:
|
||||
if check_collision and Game.settings.projection_collisions:
|
||||
var ray_params := PhysicsRayQueryParameters3D.create(
|
||||
pos, next_pos, collision_mask, excluded_rid
|
||||
)
|
||||
|
|
|
@ -16,10 +16,9 @@ script = ExtResource("1_lbcn7")
|
|||
|
||||
[node name="TabContainer" type="TabContainer" parent="."]
|
||||
layout_mode = 2
|
||||
current_tab = 1
|
||||
current_tab = 0
|
||||
|
||||
[node name="SETTINGS_GAME" type="MarginContainer" parent="TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"SettingsPageContainer"
|
||||
metadata/_tab_index = 0
|
||||
|
@ -81,6 +80,32 @@ key = &"game/config/accessibility/enable_hit_lag"
|
|||
[node name="SettingLabel" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/HitLag" index="1"]
|
||||
text = "SETTINGS_HIT_LAG"
|
||||
|
||||
[node name="GameplayHeading" type="HBoxContainer" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/GameplayHeading"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderMedium"
|
||||
text = "SETTINGS_GAME_GAMEPLAY_HEADING"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/GameplayHeading"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ProjectionCollision" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList" groups=["Settings"] instance=ExtResource("2_f274v")]
|
||||
layout_mode = 2
|
||||
key = &"game/config/gameplay/projection/detect_collision"
|
||||
|
||||
[node name="SettingLabel" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/ProjectionCollision" index="1"]
|
||||
text = "SETTINGS_PROJECTION_COLLISIONS"
|
||||
|
||||
[node name="ProjectionGravity" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList" groups=["Settings"] instance=ExtResource("2_f274v")]
|
||||
layout_mode = 2
|
||||
key = &"game/config/gameplay/projection/use_local_gravity"
|
||||
|
||||
[node name="SettingLabel" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/ProjectionGravity" index="1"]
|
||||
text = "SETTINGS_PROJECTION_GRAVITY"
|
||||
|
||||
[node name="CameraHeading" type="HBoxContainer" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList"]
|
||||
layout_mode = 2
|
||||
|
||||
|
@ -160,6 +185,7 @@ key = &"game/config/controls/camera/invert_pitch"
|
|||
text = "SETTINGS_INVERT_PITCH"
|
||||
|
||||
[node name="SETTINGS_GRAPHICS" type="MarginContainer" parent="TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"SettingsPageContainer"
|
||||
metadata/_tab_index = 1
|
||||
|
@ -464,6 +490,8 @@ text = "UI_ACCEPT"
|
|||
|
||||
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/ScreenShake"]
|
||||
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/HitLag"]
|
||||
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/ProjectionCollision"]
|
||||
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/ProjectionGravity"]
|
||||
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/FreeCameraSpeed"]
|
||||
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/FreeCameraSpeed/PanelContainer/MarginContainer/NumericSlider"]
|
||||
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/SensitivityX"]
|
||||
|
|
Loading…
Reference in New Issue