Skip to content

Commit

Permalink
remove test shader
Browse files Browse the repository at this point in the history
  • Loading branch information
UnseenFaith committed Apr 25, 2024
1 parent 0d61f5f commit 977aa6a
Show file tree
Hide file tree
Showing 5 changed files with 213 additions and 4 deletions.
6 changes: 5 additions & 1 deletion nodes/scenes/TestLevel.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=94 format=3 uid="uid://djq34560nwlx"]
[gd_scene load_steps=95 format=3 uid="uid://djq34560nwlx"]

[ext_resource type="Texture2D" uid="uid://0v6r74o2p5lv" path="res://art/isometric-sandbox-sheet.png" id="1_av4hw"]
[ext_resource type="Texture2D" uid="uid://bnrwpcvbm713v" path="res://art/carpet.png" id="1_rdr83"]
Expand Down Expand Up @@ -50,6 +50,7 @@
[ext_resource type="Texture2D" uid="uid://cjshxr0x0patj" path="res://art/table-animation/crafting animation27.png" id="68_b2swb"]
[ext_resource type="PackedScene" uid="uid://bayh5ptnx434p" path="res://nodes/wip/Crates/Crate.tscn" id="69_2teq6"]
[ext_resource type="Texture2D" uid="uid://byo4bej3y8y4q" path="res://art/table-animation/crafting animation28.png" id="69_3e5x2"]
[ext_resource type="PackedScene" uid="uid://h6wala3xyh6c" path="res://nodes/wip/Tubs/Tub.tscn" id="70_bb2jl"]
[ext_resource type="Texture2D" uid="uid://ldkw52t8yxi7" path="res://art/table-animation/crafting animation29.png" id="70_rnq4y"]
[ext_resource type="Texture2D" uid="uid://5ttf0w01sqsn" path="res://art/table-animation/crafting animation30.png" id="71_b8i2m"]
[ext_resource type="Texture2D" uid="uid://nltbl2wtwxuh" path="res://art/table-animation/crafting animation31.png" id="72_du6f1"]
Expand Down Expand Up @@ -1223,5 +1224,8 @@ flip_horizontally = true
z_index = 1
position = Vector2(496, 240)

[node name="Tub" parent="." instance=ExtResource("70_bb2jl")]
position = Vector2(502, 277)

[connection signal="body_entered" from="TileMap/ZIndexArea" to="TileMap" method="_on_area_2d_body_entered"]
[connection signal="body_exited" from="TileMap/ZIndexArea" to="TileMap" method="_on_area_2d_body_exited"]
2 changes: 1 addition & 1 deletion nodes/wip/Furnace/Furnace.gd
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func _ready():
recipe.add_ingredient(&"bronze_ore")
recipe.add_ingredient(&"bronze_ore")
recipe.add_ingredient(&"bronze_ore")
recipe.product = &"bronze_shield_chunk"
recipe.product = &"bronze_shield"

recipes.append(recipe)

Expand Down
112 changes: 112 additions & 0 deletions nodes/wip/Tubs/Tub.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
extends Area2D
class_name Tub

# Define the states of this block
enum TubState {
IDLE,
QUENCHING,
QUENCHED
}

@export var flip_horizontally: bool = false

@onready var collision: CollisionPolygon2D = get_node("CollisionShape")
# In the future these two will be merged into a single animatedsprite2d
@onready var sprite: Sprite2D = get_node("Sprite")
@onready var animation: AnimatedSprite2D = get_node("Animation")
@onready var toast: Node2D = get_node("InventoryToast")

var type: Enums.StationType = Enums.StationType.TUB
var inventory: PackedStringArray = PackedStringArray([])
var max_size: int = 3
var recipes: Array[Recipe] = []
var state: TubState = TubState.IDLE

var allowed_items: RegEx = RegEx.new()

func interact(player: Blacksmith, input: StringName) -> bool:
match input:
&"interaction":
match state:
TubState.IDLE:
if player.heldItem == null:
if !is_empty():
var item = remove_first_item()
player.equip_item(item)
return true
else:
if inventory.size() == max_size:
return false

var item = player.heldItem.get_groups()[0]

if allowed_items.search(item).strings.size() == 0:
return false

add_item(item)
player.unequip_item()
state = TubState.QUENCHING

var recipe = find_recipe()
if recipe != null:
print("Starting Quenching")
await get_tree().create_timer(5).timeout
print("Finished Quenching")
state = TubState.QUENCHED
return true
TubState.QUENCHED:
var recipe = find_recipe()
if recipe != null:
var item = recipe.product
inventory = []
player.equip_item(item)
return true
return false

func add_item(item: StringName) -> void:
inventory.append(item)
toast.add_material(item)

func remove_item() -> StringName:
return &"HELLO"
pass

func remove_first_item() -> StringName:
var item = inventory[0]
inventory = inventory.slice(1)
update_toast()
return item

func update_toast():
toast.clear()
for item in inventory:
toast.add_material(item)

func is_empty():
return inventory.size() == 0

func find_recipe() -> Recipe:
for recipe in recipes:
if recipe.ingredients == inventory:
return recipe
return null


# Called when the node enters the scene tree for the first time.
func _ready():
if flip_horizontally:
flip_station()

allowed_items.compile("\\b\\w+(sword|staff|shield)\\b")

var recipe = Recipe.new()
recipe.add_ingredient(&"bronze_shield")
recipe.product = &"polished_bronze_shield"

recipes.append(recipe)

func flip_station():
var collision = get_node("CollisionShape")
collision.scale.x = collision.scale.x * -1
sprite.flip_h = true
animation.flip_h = true
95 changes: 95 additions & 0 deletions nodes/wip/Tubs/Tub.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
[gd_scene load_steps=19 format=3 uid="uid://h6wala3xyh6c"]

[ext_resource type="Script" path="res://nodes/wip/Tubs/Tub.gd" id="1_fm7tn"]
[ext_resource type="Texture2D" uid="uid://dstti4knqy3mj" path="res://art/sink.png" id="2_ejv7p"]
[ext_resource type="Texture2D" uid="uid://cvctyqo4l7db4" path="res://art/bubbles/bubbles1.png" id="3_le52v"]
[ext_resource type="Texture2D" uid="uid://diaeeoq5dcqwh" path="res://art/bubbles/bubbles2.png" id="4_cwqln"]
[ext_resource type="Texture2D" uid="uid://d1ygn2qy62opo" path="res://art/bubbles/bubbles3.png" id="5_vdeg0"]
[ext_resource type="Texture2D" uid="uid://dqle2wtqnx52o" path="res://art/bubbles/bubbles4.png" id="6_31tsq"]
[ext_resource type="Texture2D" uid="uid://dhudk1a58vwtj" path="res://art/bubbles/bubbles5.png" id="7_y50oi"]
[ext_resource type="Texture2D" uid="uid://57ba8q642swh" path="res://art/bubbles/bubbles6.png" id="8_v7fkn"]
[ext_resource type="Texture2D" uid="uid://kjcyjvtgfxhw" path="res://art/bubbles/bubbles7.png" id="9_qoyl4"]
[ext_resource type="Texture2D" uid="uid://j3whtaioiwvx" path="res://art/bubbles/bubbles8.png" id="10_gr5ci"]
[ext_resource type="Texture2D" uid="uid://bgumcmn11ime" path="res://art/bubbles/bubbles9.png" id="11_4di7n"]
[ext_resource type="Texture2D" uid="uid://ddwc5rgh0mgrs" path="res://art/bubbles/bubbles10.png" id="12_7kggy"]
[ext_resource type="Texture2D" uid="uid://dljiie3rvh0ox" path="res://art/bubbles/bubbles11.png" id="13_i5shj"]
[ext_resource type="Texture2D" uid="uid://dfl84sgui5hm8" path="res://art/bubbles/bubbles12.png" id="14_4cj5v"]
[ext_resource type="Texture2D" uid="uid://dxu3ody1pq4lh" path="res://art/bubbles/bubbles13.png" id="15_ym03a"]
[ext_resource type="Texture2D" uid="uid://cboh4hghk2qe0" path="res://art/bubbles/bubbles14.png" id="16_wh6hx"]
[ext_resource type="Texture2D" uid="uid://bt40kxkwniyww" path="res://art/bubbles/bubbles15.png" id="17_u1ggl"]

[sub_resource type="SpriteFrames" id="SpriteFrames_a2qc1"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("3_le52v")
}, {
"duration": 1.0,
"texture": ExtResource("4_cwqln")
}, {
"duration": 1.0,
"texture": ExtResource("5_vdeg0")
}, {
"duration": 1.0,
"texture": ExtResource("6_31tsq")
}, {
"duration": 1.0,
"texture": ExtResource("7_y50oi")
}, {
"duration": 1.0,
"texture": ExtResource("8_v7fkn")
}, {
"duration": 1.0,
"texture": ExtResource("9_qoyl4")
}, {
"duration": 1.0,
"texture": ExtResource("10_gr5ci")
}, {
"duration": 1.0,
"texture": ExtResource("11_4di7n")
}, {
"duration": 1.0,
"texture": ExtResource("12_7kggy")
}, {
"duration": 1.0,
"texture": ExtResource("13_i5shj")
}, {
"duration": 1.0,
"texture": ExtResource("14_4cj5v")
}, {
"duration": 1.0,
"texture": ExtResource("15_ym03a")
}, {
"duration": 1.0,
"texture": ExtResource("16_wh6hx")
}, {
"duration": 1.0,
"texture": ExtResource("17_u1ggl")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]

[node name="Tub" type="Area2D" groups=["interactable", "tub"]]
z_index = 1
y_sort_enabled = true
collision_layer = 2
collision_mask = 2
script = ExtResource("1_fm7tn")

[node name="CollisionShape" type="CollisionPolygon2D" parent="."]
polygon = PackedVector2Array(-21, -14, 9, 0, 21, -6, 21, -24, -8, -38, -21, -32)

[node name="Sprite" type="Sprite2D" parent="."]
texture_filter = 1
position = Vector2(0, -19)
texture = ExtResource("2_ejv7p")
region_enabled = true
region_rect = Rect2(0, 26, 41, 38)

[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
texture_filter = 1
position = Vector2(-3, -33)
sprite_frames = SubResource("SpriteFrames_a2qc1")
frame_progress = 0.609171
2 changes: 0 additions & 2 deletions nodes/wip/WipBlacksmith.gd
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,6 @@ func start_level():

func end_level():
set_immobile(true)

var shader = preload("res://nodes/wip/test.gdshader")

var crates = ["wood", "leather_hide", "gold_ore", "bronze_ore", "diamond_ore"]
func _physics_process(_delta) -> void:
Expand Down

0 comments on commit 977aa6a

Please sign in to comment.