From 392ec5372c1abe439ff461bdba1fed11984b432b Mon Sep 17 00:00:00 2001 From: teatov Date: Mon, 21 Oct 2024 22:12:29 +1000 Subject: [PATCH] add anthill model --- assets/models/anthill.glb | 3 ++ assets/models/anthill.glb.import | 43 +++++++++++++++++++ assets/textures/structures/anthill_albedo.png | 3 ++ .../structures/anthill_albedo.png.import | 35 +++++++++++++++ resources/materials/anthill_material.tres | 7 +++ scenes/structures/anthill.tscn | 26 ++++++----- scripts/anthill.gd | 7 +++ scripts/units/components/gathering.gd | 4 +- 8 files changed, 117 insertions(+), 11 deletions(-) create mode 100644 assets/models/anthill.glb create mode 100644 assets/models/anthill.glb.import create mode 100644 assets/textures/structures/anthill_albedo.png create mode 100644 assets/textures/structures/anthill_albedo.png.import create mode 100644 resources/materials/anthill_material.tres diff --git a/assets/models/anthill.glb b/assets/models/anthill.glb new file mode 100644 index 0000000..171f72a --- /dev/null +++ b/assets/models/anthill.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b257674e48d3ae48e4284203bb6ded33f3e795cc57c2970db6fda1aa5674137 +size 8176 diff --git a/assets/models/anthill.glb.import b/assets/models/anthill.glb.import new file mode 100644 index 0000000..e3ad1f4 --- /dev/null +++ b/assets/models/anthill.glb.import @@ -0,0 +1,43 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://b0koc3o63etu1" +path="res://.godot/imported/anthill.glb-5b6c8f58d961f196bcc8e93454476786.scn" + +[deps] + +source_file="res://assets/models/anthill.glb" +dest_files=["res://.godot/imported/anthill.glb-5b6c8f58d961f196bcc8e93454476786.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="Anthill" +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +animation/import_rest_as_RESET=false +import_script/path="" +_subresources={ +"materials": { +"anthill_mat": { +"use_external/enabled": true, +"use_external/path": "res://resources/materials/anthill_material.tres" +} +} +} +gltf/naming_version=1 +gltf/embedded_image_handling=1 diff --git a/assets/textures/structures/anthill_albedo.png b/assets/textures/structures/anthill_albedo.png new file mode 100644 index 0000000..b684b1a --- /dev/null +++ b/assets/textures/structures/anthill_albedo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:429edc052ee48b9a1f918cd8e3bf3917aafcd7531d0be281ee20a56ce0a136b5 +size 28711 diff --git a/assets/textures/structures/anthill_albedo.png.import b/assets/textures/structures/anthill_albedo.png.import new file mode 100644 index 0000000..0aad04a --- /dev/null +++ b/assets/textures/structures/anthill_albedo.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b7m104tc2wch3" +path.bptc="res://.godot/imported/anthill_albedo.png-bbaa35e5b6a354eec93c815c4147a0e5.bptc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://assets/textures/structures/anthill_albedo.png" +dest_files=["res://.godot/imported/anthill_albedo.png-bbaa35e5b6a354eec93c815c4147a0e5.bptc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=true +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +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=0 diff --git a/resources/materials/anthill_material.tres b/resources/materials/anthill_material.tres new file mode 100644 index 0000000..ef28837 --- /dev/null +++ b/resources/materials/anthill_material.tres @@ -0,0 +1,7 @@ +[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://bgc0omqgojp6n"] + +[ext_resource type="Texture2D" uid="uid://b7m104tc2wch3" path="res://assets/textures/structures/anthill_albedo.png" id="1_3h7nr"] + +[resource] +shading_mode = 0 +albedo_texture = ExtResource("1_3h7nr") diff --git a/scenes/structures/anthill.tscn b/scenes/structures/anthill.tscn index 49923bf..2be3ea6 100644 --- a/scenes/structures/anthill.tscn +++ b/scenes/structures/anthill.tscn @@ -3,8 +3,7 @@ [ext_resource type="Script" path="res://scripts/anthill.gd" id="1_8k02d"] [ext_resource type="Material" uid="uid://f0nlf4tdpvbd" path="res://resources/materials/indicators/hover_indicator_mat.tres" id="2_44p2d"] [ext_resource type="Script" path="res://scripts/sound_effects_player.gd" id="3_vp3nf"] - -[sub_resource type="CapsuleMesh" id="CapsuleMesh_x8apu"] +[ext_resource type="PackedScene" uid="uid://b0koc3o63etu1" path="res://assets/models/anthill.glb" id="4_tp2c4"] [sub_resource type="BoxShape3D" id="BoxShape3D_ruupa"] @@ -17,24 +16,31 @@ orientation = 1 collision_mask = 0 script = ExtResource("1_8k02d") -[node name="MeshInstance3D" type="MeshInstance3D" parent="."] -mesh = SubResource("CapsuleMesh_x8apu") +[node name="Anthill" parent="." instance=ExtResource("4_tp2c4")] + +[node name="Anthill" parent="Anthill" index="0"] +layers = 32 [node name="CollisionShape3D" type="CollisionShape3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0) shape = SubResource("BoxShape3D_ruupa") [node name="UiOrigin" type="Marker3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.15587, 0) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.0356, 0) [node name="HoverIndicator" type="MeshInstance3D" parent="."] -transform = Transform3D(1.62268, 0, 0, 0, 1.62268, 0, 0, 0, 1.62268, 0, 0, 0) +transform = Transform3D(2.703, 0, 0, 0, 2.703, 0, 0, 0, 2.703, 0, 0, 0) cast_shadow = 0 mesh = SubResource("QuadMesh_2gykr") -[node name="NavigationObstacle3D" type="NavigationObstacle3D" parent="."] -radius = 0.57 - [node name="SoundEffectsPlayer" type="AudioStreamPlayer3D" parent="."] unit_size = 20.0 -script = ExtResource("3_vp3nf") \ No newline at end of file +script = ExtResource("3_vp3nf") + +[node name="NavigationObstacle3D" type="NavigationObstacle3D" parent="."] +radius = 0.6 + +[node name="DepositPoint" type="Marker3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.102205, 0.382582, 0.248212) + +[editable path="Anthill"] diff --git a/scripts/anthill.gd b/scripts/anthill.gd index 10e8d2f..a636d86 100644 --- a/scripts/anthill.gd +++ b/scripts/anthill.gd @@ -13,6 +13,8 @@ var _nitwit_scene := preload("res://scenes/units/ant_nitwit.tscn") var _gatherer_scene := preload("res://scenes/units/ant_gatherer.tscn") @onready var ui_origin: Node3D = $UiOrigin +@onready var deposit_point: Node3D = $DepositPoint +@onready var animation_player: AnimationPlayer = $Anthill/AnimationPlayer @onready var audio_player: SoundEffectsPlayer = ( $SoundEffectsPlayer ) @@ -39,6 +41,8 @@ func deposit_honeydew(amount: int) -> int: leftover = new_honeydew_amount - max_honeydew else: honeydew = new_honeydew_amount + animation_player.stop() + animation_player.play("plop_down") return leftover @@ -84,5 +88,8 @@ func _create_unit( ) if ding: audio_player.play_sound(SoundManager.ding()) + animation_player.stop() + animation_player.play("plop_up") + buy_ant.emit() return new_unit diff --git a/scripts/units/components/gathering.gd b/scripts/units/components/gathering.gd index e1cb33b..81eda89 100644 --- a/scripts/units/components/gathering.gd +++ b/scripts/units/components/gathering.gd @@ -171,7 +171,9 @@ func _deposit() -> void: _unit.animation_playback.travel("plop_up") audio_player.play_sound(SoundManager.swoosh()) - await item.start_tweening(_unit.anthill.global_position).tween_finished + await item.start_tweening( + _unit.anthill.deposit_point.global_position + ).tween_finished audio_player.play_sound(SoundManager.tok()) item.remove_from_spawner()