Add sample custom resources

This commit is contained in:
antimundo 2025-04-26 19:07:10 +02:00
parent c8f68b6b1d
commit a235066cd9
11 changed files with 205 additions and 1 deletions

View file

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://bcxmumw1sxc6j"
path="res://.godot/imported/test_sound.ogg-8748a89a83ffa108e70ca73d1ef6f7ff.oggvorbisstr"
[deps]
source_file="res://assets/sample_custom_resources/destroy_sounds/test_sound.ogg"
dest_files=["res://.godot/imported/test_sound.ogg-8748a89a83ffa108e70ca73d1ef6f7ff.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View file

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="400"
height="200"
viewBox="0 0 400 200"
version="1.1"
xml:space="preserve"
style="clip-rule:evenodd;fill-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"
id="svg21"
sodipodi:docname="icon.svg"
inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs21" /><sodipodi:namedview
id="namedview21"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
inkscape:zoom="1.7203037"
inkscape:cx="81.962272"
inkscape:cy="78.474516"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg21" />&#10; &#10; &#10;<g
id="g2"
transform="matrix(1.3836532,0,0,1.3836532,131.02418,30.81734)"
style="fill:#455a64;fill-opacity:1;stroke-width:0.722724"><path
d="m 44,61 v 25.054 c 0,3.284 2.716,5.946 6,5.946 3.283,0 6,-2.662 6,-5.946 V 61 Z"
id="path1"
style="fill:#607d8b;fill-opacity:1;stroke-width:0.722724" /><circle
cx="52.174999"
cy="54.608002"
r="3.7160001"
id="circle1"
style="fill:#607d8b;fill-opacity:1;stroke-width:0.722724" /><circle
cx="46.229"
cy="41.229"
r="2.2290001"
id="circle2"
style="fill:#607d8b;fill-opacity:1;stroke-width:0.722724" /><path
d="M 63.919,4 60,8.231 V 49.505 86.107 C 60,86.107 59.893,96 50,96 40.107,96 40,86.107 40,86.107 V 49.506 8.231 L 36.031,4 H 64 M 63.58,0 H 36.031 C 34.44,0 33,0.942 32.364,2.4 31.728,3.858 32.038,5.554 33.12,6.72 L 36,9.802 V 49.506 86.108 C 36,91.691 39.808,100 50,100 60.192,100 64,91.691 64,86.107 V 49.506 9.775 L 66.672,6.687 C 67.735,5.515 67.943,3.826 67.302,2.379 66.661,0.933 65.194,0 63.612,0 Z"
id="path2-1"
style="fill:#455a64;fill-opacity:1;stroke-width:0.722724" /></g></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dokjso5ltbuyu"
path="res://.godot/imported/icon.svg-4ae02ec4eb0d50783fca7a86c86d1e1a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/sample_custom_resources/scenarios/test/icon.svg"
dest_files=["res://.godot/imported/icon.svg-4ae02ec4eb0d50783fca7a86c86d1e1a.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View file

@ -0,0 +1,13 @@
[metadata]
id = "test_scenario"
title = "Test scenario"
description = "A sample scenario for developers to experiment with."
[settings]
time = 30
player_movement = true
shoot_machinegun = false
[score]
score_per_hit = 1
accuracy_multiplier = false

View file

@ -0,0 +1,31 @@
[gd_scene load_steps=6 format=3 uid="uid://cfx4p10bfw2v7"]
[ext_resource type="Script" uid="uid://eap3623705g4" path="res://scenes/game_world/scenario/scenario.gd" id="1_xogef"]
[ext_resource type="PackedScene" uid="uid://dagqtbldaccgh" path="res://scenes/game_world/scenario/sample_world_geometry.tscn" id="2_xogef"]
[ext_resource type="Script" uid="uid://7eouyjvbgjo0" path="res://scenes/game_world/target_spawner.gd" id="3_tfn8e"]
[ext_resource type="Script" uid="uid://bxhkdvu8k5owt" path="res://scenes/target/behavior/behavior_linearmovement.gd" id="4_aotl8"]
[sub_resource type="Resource" id="Resource_ncddh"]
script = ExtResource("4_aotl8")
max_velocity = Vector3(5, 0, 0)
metadata/_custom_type_script = "uid://bxhkdvu8k5owt"
[node name="Scenario" type="Node3D" node_paths=PackedStringArray("_light")]
script = ExtResource("1_xogef")
_light = NodePath("DirectionalLight3D")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.998198, 0.0464176, 0.0380308, -0.0421491, 0.0912349, 0.994937, 0.0427129, -0.994747, 0.093027, 0, 20, 0)
light_color = Color(0.360784, 0.615686, 1, 1)
light_bake_mode = 1
[node name="Geometry" parent="." instance=ExtResource("2_xogef")]
[node name="TargetSpawner" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.999848, -0.0174524, 0, 0.0174524, 0.999848, 0, 2, -10)
script = ExtResource("3_tfn8e")
initial_targets = 2
size = Vector2(1, 4)
min_position = Vector3(-10, -2, 0)
max_position = Vector3(10, 2, 0)
behavior = SubResource("Resource_ncddh")

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cdolf8bnfp2fj"
path="res://.godot/imported/test_texture.png-9b578a69cab5fa7c4dbf25c1b163b728.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/sample_custom_resources/world_textures/test_texture.png"
dest_files=["res://.godot/imported/test_texture.png-9b578a69cab5fa7c4dbf25c1b163b728.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View file

@ -52,6 +52,9 @@ func get_sound(full_path: String) -> AudioStream:
return load(full_path)
return AudioStreamOggVorbis.load_from_file(full_path)
func copy_sample_custom_resources() -> void:
_copy_dir_recursively("res://assets/sample_custom_resources/", USER_PATH)
func _ensure_path_is_partial(path :String) -> String:
if path.begins_with(USER_PATH):
return path.right(-USER_PATH.length())
@ -95,3 +98,17 @@ func _extension_matches(path: String, extension: String) -> bool:
if extension == "":
return true
return path.get_extension() == extension
## Copies a complete file structure into another location
func _copy_dir_recursively(source: String, destination: String) -> void:
DirAccess.make_dir_recursive_absolute(destination)
var source_dir = DirAccess.open(source)
for filename in source_dir.get_files():
if filename.get_extension() != "import" and \
!FileAccess.file_exists(destination + filename):
source_dir.copy(source + filename, destination + filename)
for dir in source_dir.get_directories():
_copy_dir_recursively(source + dir + "/", destination + dir + "/")

View file

@ -9,6 +9,7 @@ var current_scenario : Dictionary
func _ready() -> void:
Input.set_use_accumulated_input(false)
CustomResourceManager.copy_sample_custom_resources()
_load_scenarios()
## Returns the value of a key of the current scenario

View file

@ -21,7 +21,7 @@ func _on_world_texture_item_selected(index) -> void:
func _ready() -> void:
var i = 0
for path:String in Global.get_world_textures():
for path: String in Global.get_world_textures():
world_texture.add_icon_item(CustomResourceManager.get_image(path), path.get_file(), i)
world_texture.set_item_metadata(i, path)
i+=1