diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f28239b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +root = true + +[*] +charset = utf-8 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore index bf83296..3ecf947 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ export_presets.cfg data_*/ mono_crash.*.json +BUILDS diff --git a/Core/player.gd b/Core/player.gd new file mode 100644 index 0000000..07aa724 --- /dev/null +++ b/Core/player.gd @@ -0,0 +1,65 @@ +extends Node3D + +@export_category("Speed") +@onready var move_speed: float = ProjectSettings.get_setting("game/controls/camera_move_speed",20.0) +@onready var zoom_speed: float = ProjectSettings.get_setting("game/controls/camera_zoom_speed",20.0) +@export_category("Limits") +@export_range(-10,10,1) var zoom_min: float = -8 +@export_range(11,50,1) var zoom_max: float = 20 +@export_range(0,0.95,0.01) var zoom_speed_damp: float = 0.5 + +@export_range(0,32,4) var edge_scrolling_margin: int = 4 +@onready var edge_scrolling_speed: float = ProjectSettings.get_setting("game/controls/edge_scrolling_speed",20.0) + +@onready var socket: Node3D = $camera_point +@onready var cam : Camera3D = %camera_player + +var zoom_direction : float = 0.0 ## 0.0 means no zoom. Use 1.0 for moving toward the floor +var move_disabled:bool = false +var zoom_disabled:bool = false +var edge_scroll_disabled:bool = ProjectSettings.get_setting("game/controls/edge_scrolling_disabled",false) + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + cam_move(delta) + cam_zoom(delta) + cam_edge_scroll(delta) + + +func _unhandled_input(event: InputEvent) -> void: + if event.is_action("scroll_up"): + zoom_direction = -1 + if event.is_action("scroll_down"): + zoom_direction = 1 + + +## Controls the movement of the player camera +func cam_move(delta:float) -> void: + if move_disabled:return + var velocity_direction := Vector3.ZERO + + if Input.is_action_pressed("cam_backward"): velocity_direction -= transform.basis.x + if Input.is_action_pressed("cam_forward"): velocity_direction += transform.basis.x + if Input.is_action_pressed("cam_left"): velocity_direction -= transform.basis.z + if Input.is_action_pressed("cam_right"): velocity_direction += transform.basis.z + + position += velocity_direction.normalized() * delta * move_speed + + +## Controls the zoom of the player camera +## [br] +## [param zoom_direction] control the direction. +## 0.0 means no zoom. Use 1.0 for moving toward the floor +func cam_zoom(delta:float) -> void: + if zoom_disabled:return + + var new_zoom: float = clamp(cam.position.z + zoom_speed * zoom_direction * delta,zoom_min,zoom_max) + print(new_zoom) + cam.position.z = new_zoom + + zoom_direction *= zoom_speed_damp #Smooth the deceleration + + +func cam_edge_scroll(delta:float) -> void: + pass diff --git a/Core/player.gd.uid b/Core/player.gd.uid new file mode 100644 index 0000000..af50fde --- /dev/null +++ b/Core/player.gd.uid @@ -0,0 +1 @@ +uid://c23s1syo7wjm8 diff --git a/Core/player.tscn b/Core/player.tscn new file mode 100644 index 0000000..a830c0c --- /dev/null +++ b/Core/player.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=2 format=3 uid="uid://djj1fc8qm10t6"] + +[ext_resource type="Script" uid="uid://c23s1syo7wjm8" path="res://Core/player.gd" id="1_e571r"] + +[node name="player_root" type="Node3D"] +script = ExtResource("1_e571r") + +[node name="camera_point" type="Node3D" parent="."] +transform = Transform3D(-4.371139e-08, 0.57357645, -0.81915206, 0, 0.81915206, 0.57357645, 1, 2.5071824e-08, -3.5806274e-08, -2, 6.452, 0) + +[node name="camera_player" type="Camera3D" parent="camera_point"] +unique_name_in_owner = true diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..fb243c5 --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,137 @@ +[preset.0] + +name="Windows Desktop - optimized" +platform="Windows Desktop" +runnable=true +advanced_options=false +dedicated_server=false +custom_features="" +export_filter="scenes" +export_files=PackedStringArray("res://Packs/Maps/gym.tscn") +include_filter="" +exclude_filter="" +export_path="BUILDS/Kenshi2.exe" +patches=PackedStringArray() +encryption_include_filters="" +encryption_exclude_filters="" +seed=0 +encrypt_pck=false +encrypt_directory=false +script_export_mode=1 + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +debug/export_console_wrapper=0 +binary_format/embed_pck=true +texture_format/s3tc_bptc=true +texture_format/etc2_astc=false +shader_baker/enabled=true +binary_format/architecture="x86_64" +codesign/enable=false +codesign/timestamp=true +codesign/timestamp_server_url="" +codesign/digest_algorithm=1 +codesign/description="" +codesign/custom_options=PackedStringArray() +application/modify_resources=true +application/icon="" +application/console_wrapper_icon="" +application/icon_interpolation=4 +application/file_version="" +application/product_version="" +application/company_name="" +application/product_name="" +application/file_description="" +application/copyright="" +application/trademarks="" +application/export_angle=0 +application/export_d3d12=0 +application/d3d12_agility_sdk_multiarch=true +ssh_remote_deploy/enabled=false +ssh_remote_deploy/host="user@host_ip" +ssh_remote_deploy/port="22" +ssh_remote_deploy/extra_args_ssh="" +ssh_remote_deploy/extra_args_scp="" +ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}' +$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}' +$trigger = New-ScheduledTaskTrigger -Once -At 00:00 +$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries +$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings +Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true +Start-ScheduledTask -TaskName godot_remote_debug +while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 } +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue" +ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue +Remove-Item -Recurse -Force '{temp_dir}'" + +[preset.1] + +name="Windows Desktop - debug" +platform="Windows Desktop" +runnable=false +advanced_options=true +dedicated_server=false +custom_features="" +export_filter="scenes" +export_files=PackedStringArray("res://Packs/Maps/gym.tscn") +include_filter="" +exclude_filter="" +export_path="BUILDS/Kenshi2_debug.exe" +patches=PackedStringArray() +encryption_include_filters="" +encryption_exclude_filters="" +seed=0 +encrypt_pck=false +encrypt_directory=false +script_export_mode=0 + +[preset.1.options] + +custom_template/debug="" +custom_template/release="" +debug/export_console_wrapper=2 +binary_format/embed_pck=false +texture_format/s3tc_bptc=true +texture_format/etc2_astc=false +shader_baker/enabled=true +binary_format/architecture="x86_64" +codesign/enable=false +codesign/timestamp=true +codesign/timestamp_server_url="" +codesign/digest_algorithm=1 +codesign/description="" +codesign/custom_options=PackedStringArray() +application/modify_resources=true +application/icon="" +application/console_wrapper_icon="" +application/icon_interpolation=4 +application/file_version="" +application/product_version="" +application/company_name="" +application/product_name="" +application/file_description="" +application/copyright="" +application/trademarks="" +application/export_angle=0 +application/export_d3d12=0 +application/d3d12_agility_sdk_multiarch=true +ssh_remote_deploy/enabled=false +ssh_remote_deploy/host="user@host_ip" +ssh_remote_deploy/port="22" +ssh_remote_deploy/extra_args_ssh="" +ssh_remote_deploy/extra_args_scp="" +ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}' +$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}' +$trigger = New-ScheduledTaskTrigger -Once -At 00:00 +$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries +$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings +Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true +Start-ScheduledTask -TaskName godot_remote_debug +while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 } +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue" +ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue +Remove-Item -Recurse -Force '{temp_dir}'" diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..c6bbb7d --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..9c7b23f --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://po0ievqdnhlm" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..22adb3e --- /dev/null +++ b/project.godot @@ -0,0 +1,78 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="Kenshi2" +run/main_scene="uid://dnmetcwb14svi" +config/features=PackedStringArray("4.5", "Forward Plus") +config/icon="res://icon.svg" + +[editor_plugins] + +enabled=PackedStringArray("res://addons/SimpleFormatOnSave/plugin.cfg") + +[file_customization] + +folder_colors={ +"res://Addons/": "red", +"res://Core/": "blue" +} + +[game] + +controls/camera_zoom_speed=20.0 +controls/camera_move_speed=20.0 + +[input] + +cam_forward={ +"deadzone": 0.2, +"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null) +, 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":87,"key_label":0,"unicode":122,"location":0,"echo":false,"script":null) +] +} +cam_backward={ +"deadzone": 0.2, +"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null) +, 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":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null) +] +} +cam_left={ +"deadzone": 0.2, +"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null) +, 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":65,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null) +] +} +cam_right={ +"deadzone": 0.2, +"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null) +, 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":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null) +] +} +scroll_up={ +"deadzone": 0.2, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":8,"position":Vector2(58, 12),"global_position":Vector2(67, 58),"factor":1.0,"button_index":4,"canceled":false,"pressed":true,"double_click":false,"script":null) +] +} +scroll_down={ +"deadzone": 0.2, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":16,"position":Vector2(681, 11),"global_position":Vector2(690, 57),"factor":1.0,"button_index":5,"canceled":false,"pressed":true,"double_click":false,"script":null) +] +} + +[physics] + +3d/run_on_separate_thread=true +3d/physics_engine="Jolt Physics" + +[rendering] + +anti_aliasing/quality/msaa_3d=2