diff --git a/common/icons/fork.svg b/common/icons/fork.svg new file mode 100644 index 0000000..3d75113 --- /dev/null +++ b/common/icons/fork.svg @@ -0,0 +1,36 @@ + + + + + + + + + diff --git a/common/icons/fork.svg.import b/common/icons/fork.svg.import new file mode 100644 index 0000000..707d120 --- /dev/null +++ b/common/icons/fork.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b32gdiufy8wqu" +path="res://.godot/imported/fork.svg-094546371d6c3cb5b7909733fcff911a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://common/icons/fork.svg" +dest_files=["res://.godot/imported/fork.svg-094546371d6c3cb5b7909733fcff911a.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=2.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/common/icons/slice.svg b/common/icons/slice.svg new file mode 100644 index 0000000..8a797af --- /dev/null +++ b/common/icons/slice.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/common/icons/slice.svg.import b/common/icons/slice.svg.import new file mode 100644 index 0000000..fb31c4c --- /dev/null +++ b/common/icons/slice.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cyoytbcdqm5d5" +path="res://.godot/imported/slice.svg-c6b36b1b2516d02286320438e4fba0d4.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://common/icons/slice.svg" +dest_files=["res://.godot/imported/slice.svg-c6b36b1b2516d02286320438e4fba0d4.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=2.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/common/icons/trowel.svg b/common/icons/trowel.svg new file mode 100644 index 0000000..3a18b85 --- /dev/null +++ b/common/icons/trowel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/common/icons/trowel.svg.import b/common/icons/trowel.svg.import new file mode 100644 index 0000000..cc3d6d8 --- /dev/null +++ b/common/icons/trowel.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dx15ft0ubv04k" +path="res://.godot/imported/trowel.svg-08d4796611ee66ea329f68678210bbdf.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://common/icons/trowel.svg" +dest_files=["res://.godot/imported/trowel.svg-08d4796611ee66ea329f68678210bbdf.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=2.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/common/inventory/scripts/items/fork.gd b/common/inventory/scripts/items/fork.gd new file mode 100644 index 0000000..b3e6e38 --- /dev/null +++ b/common/inventory/scripts/items/fork.gd @@ -0,0 +1,44 @@ +extends Item +class_name Fork + +const USE_INTERVAL = 0.15 + +func get_item_name() -> String: + return "Fork" + +func get_description() -> String: + return "Use it to harvest mature plants." + +func get_icon() -> Texture2D: + return preload("res://common/icons/fork.svg") + +func get_energy_used() -> int: + return 1 + +func get_usage_zone_radius() -> int: + return 50 + +func get_usage_object_affected(i : InspectableEntity) -> bool: + return i is Plant + +func use_text() -> String: + return "Harvest" + +func can_use(_player : Player, zone : Player.ActionZone) -> bool: + var areas = zone.get_affected_areas() + for area in areas : + if area is Plant: + return true + return false + +func use(player : Player, zone : Player.ActionZone) -> bool: + for area in zone.get_affected_areas(): + if area and area is Plant: + harvest(area, player) + await player.get_tree().create_timer(USE_INTERVAL).timeout + + return true + +func harvest(p : Plant, player: Player): + player.play_sfx("harvest") + p.harvest() diff --git a/common/inventory/scripts/items/fork.gd.uid b/common/inventory/scripts/items/fork.gd.uid new file mode 100644 index 0000000..67664bf --- /dev/null +++ b/common/inventory/scripts/items/fork.gd.uid @@ -0,0 +1 @@ +uid://cg5to3g2bqyks diff --git a/common/inventory/scripts/items/knife.gd b/common/inventory/scripts/items/knife.gd new file mode 100644 index 0000000..8268a42 --- /dev/null +++ b/common/inventory/scripts/items/knife.gd @@ -0,0 +1,19 @@ +extends Fork +class_name Knife + +const KNIFE_ZONE_RADIUS = 10 + +func get_item_name() -> String: + return "Knife" + +func get_description() -> String: + return "Use it to harvest mature plants. Do not cost energy." + +func get_energy_used() -> int: + return 0 + +func get_icon() -> Texture2D: + return preload("res://common/icons/slice.svg") + +func get_usage_zone_radius() -> int: + return KNIFE_ZONE_RADIUS \ No newline at end of file diff --git a/common/inventory/scripts/items/knife.gd.uid b/common/inventory/scripts/items/knife.gd.uid new file mode 100644 index 0000000..b33a18e --- /dev/null +++ b/common/inventory/scripts/items/knife.gd.uid @@ -0,0 +1 @@ +uid://clyixfqc8rmo diff --git a/common/inventory/scripts/items/shovel.gd b/common/inventory/scripts/items/shovel.gd index 98046fa..6e55882 100644 --- a/common/inventory/scripts/items/shovel.gd +++ b/common/inventory/scripts/items/shovel.gd @@ -1,8 +1,7 @@ -extends Item +extends Fork class_name Shovel -const USE_INTERVAL = 0.15 -const SHOVEL_ZONE_RADIUS = 30 +const SHOVEL_ZONE_RADIUS = 50 func get_item_name() -> String: return "Shovel" @@ -13,9 +12,6 @@ func get_description() -> String: func get_icon() -> Texture2D: return preload("res://common/icons/shovel.svg") -func get_energy_used() -> int: - return 1 - func get_usage_zone_radius() -> int: return SHOVEL_ZONE_RADIUS @@ -33,20 +29,16 @@ func can_use(_player : Player, zone : Player.ActionZone) -> bool: return false func use(player : Player, zone : Player.ActionZone) -> bool: - dig( - zone.get_affected_areas(), - player - ) + for area in zone.get_affected_areas(): + if area and area is Plant: + harvest(area, player) + await player.get_tree().create_timer(USE_INTERVAL).timeout + if area and area is UndergroundLoot: + dig(area, player) + await player.get_tree().create_timer(USE_INTERVAL).timeout return true -func dig(areas: Array[Area2D], player: Player): - for area in areas : - if area and area is Plant: - player.play_sfx("harvest") - area.harvest() - await player.get_tree().create_timer(USE_INTERVAL).timeout - if area and area is UndergroundLoot: - player.play_sfx("dig") - area.dig() - await player.get_tree().create_timer(USE_INTERVAL).timeout +func dig(u: UndergroundLoot, player: Player): + player.play_sfx("dig") + u.dig() \ No newline at end of file diff --git a/common/inventory/scripts/items/trowel.gd b/common/inventory/scripts/items/trowel.gd new file mode 100644 index 0000000..3004280 --- /dev/null +++ b/common/inventory/scripts/items/trowel.gd @@ -0,0 +1,21 @@ +extends Fork +class_name Trowel + +const TROWEL_ZONE_RADIUS = 50 + +func get_item_name() -> String: + return "Trowel" + +func get_description() -> String: + return "Use it to harvest mature plants, can get a [b]bonus seed[/b] from each plant." + +func get_icon() -> Texture2D: + return preload("res://common/icons/trowel.svg") + +func get_usage_zone_radius() -> int: + return TROWEL_ZONE_RADIUS + +func harvest(p : Plant, player: Player): + ProduceSeedsEffect.new(1).effect(p) + player.play_sfx("harvest") + p.harvest() \ No newline at end of file diff --git a/common/inventory/scripts/items/trowel.gd.uid b/common/inventory/scripts/items/trowel.gd.uid new file mode 100644 index 0000000..6a7990e --- /dev/null +++ b/common/inventory/scripts/items/trowel.gd.uid @@ -0,0 +1 @@ +uid://gvq5vic12srt diff --git a/entities/plants/resources/plant_types/champ.tres b/entities/plants/resources/plant_types/champ.tres index a50c22d..240996b 100644 --- a/entities/plants/resources/plant_types/champ.tres +++ b/entities/plants/resources/plant_types/champ.tres @@ -7,8 +7,9 @@ [ext_resource type="Texture2D" uid="uid://crc4aop6ajiau" path="res://entities/plants/assets/sprites/champ/mature.png" id="3_y8qve"] [ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="6_liopn"] -[sub_resource type="Resource" id="Resource_l2hi3"] +[sub_resource type="Resource" id="Resource_cf34j"] script = ExtResource("1_cf34j") +level = 1 metadata/_custom_type_script = "uid://ceqx5va1ormau" [sub_resource type="AtlasTexture" id="AtlasTexture_my6by"] @@ -23,5 +24,5 @@ default_growing_time = 3 seed_texture = SubResource("AtlasTexture_my6by") growing_texture = ExtResource("2_l2hi3") mature_texture = ExtResource("3_y8qve") -default_cyclic_effects = Array[ExtResource("1_l2hi3")]([SubResource("Resource_l2hi3")]) +default_mature_effects = Array[ExtResource("1_l2hi3")]([SubResource("Resource_cf34j")]) metadata/_custom_type_script = "uid://jnye5pe1bgqw" diff --git a/entities/player/scripts/player.gd b/entities/player/scripts/player.gd index 8c8ceb9..2a6a63a 100644 --- a/entities/player/scripts/player.gd +++ b/entities/player/scripts/player.gd @@ -178,7 +178,7 @@ func has_energy_to_use_item(item : Item): func use_item(item : Item): if can_use_item_on_zone(item, action_zone): - var is_item_used = item.use(self, action_zone) + var is_item_used = await item.use(self, action_zone) if is_item_used: energy -= item.energy_usage if item.is_one_time_use(): diff --git a/gui/game/inspector/inspector.tscn b/gui/game/inspector/inspector.tscn index f3b4768..6c2cb10 100644 --- a/gui/game/inspector/inspector.tscn +++ b/gui/game/inspector/inspector.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=10 format=3 uid="uid://d3lff5fui1k0c"] +[gd_scene load_steps=9 format=3 uid="uid://d3lff5fui1k0c"] [ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_f5bv4"] [ext_resource type="Texture2D" uid="uid://lpik6kwqgmjx" path="res://gui/game/assets/texture/tablette_resized.png" id="1_qfinp"] @@ -22,9 +22,6 @@ region = Rect2(76, 75, 124, 135) font = ExtResource("4_yijvw") font_size = 20 -[sub_resource type="LabelSettings" id="LabelSettings_c4yiu"] -font_size = 12 - [node name="Inspector" type="PanelContainer"] offset_right = 276.0 offset_bottom = 235.0 @@ -62,12 +59,12 @@ theme_override_constants/h_separation = 8 theme_override_constants/v_separation = 8 alignment = 1 -[node name="Desc" type="Label" parent="VBoxContainer"] +[node name="Desc" type="RichTextLabel" parent="VBoxContainer"] unique_name_in_owner = true layout_mode = 2 +bbcode_enabled = true text = "Very interesting description that can be very long, like 2 or 3 lines long." -label_settings = SubResource("LabelSettings_c4yiu") -autowrap_mode = 3 +fit_content = true [node name="FramedInfos" type="VBoxContainer" parent="VBoxContainer"] unique_name_in_owner = true diff --git a/stages/planet_run/planet_run.tscn b/stages/planet_run/planet_run.tscn index 376556b..f5cc334 100644 --- a/stages/planet_run/planet_run.tscn +++ b/stages/planet_run/planet_run.tscn @@ -34,8 +34,7 @@ z_index = 1000 [node name="Win" parent="CanvasLayer" instance=ExtResource("3_6guxm")] visible = false -[node name="Tutorial" parent="CanvasLayer" node_paths=PackedStringArray("camera", "player") instance=ExtResource("5_orelw")] -camera = NodePath("../../Camera") +[node name="Tutorial" parent="CanvasLayer" node_paths=PackedStringArray("player") instance=ExtResource("5_orelw")] player = NodePath("../../Entities/Player") [node name="Entities" type="Node2D" parent="."] @@ -61,8 +60,6 @@ position = Vector2(-36, -154) [node name="Planet" parent="." node_paths=PackedStringArray("import_entities_from_node") instance=ExtResource("8_t31p7")] loot_number = Array[int]([1]) loot_item_number = Array[int]([1]) -objective_first_distance = 150 -objective_between_distance = 150 import_entities_from_node = NodePath("../Entities") [node name="Camera" parent="." node_paths=PackedStringArray("following") instance=ExtResource("16_m18ms")] diff --git a/stages/terrain/truck/scripts/truck_interior.gd b/stages/terrain/truck/scripts/truck_interior.gd index 5db1aa5..7031b13 100644 --- a/stages/terrain/truck/scripts/truck_interior.gd +++ b/stages/terrain/truck/scripts/truck_interior.gd @@ -37,6 +37,14 @@ func get_possible_rewards() -> Array[Compost.Reward]: Compost.GiveItemReward.new( get_random_reward_cost(), Blueprint.new(preload("res://entities/interactables/machines/solar_pannel/solar_pannel.tres")) + ), + Compost.GiveItemReward.new( + get_random_reward_cost(), + Knife.new() + ), + Compost.GiveItemReward.new( + get_random_reward_cost(), + Trowel.new() ) ]