diff options
author | metamuffin <metamuffin@disroot.org> | 2024-09-08 13:50:46 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-09-08 13:50:46 +0200 |
commit | 3226addea9b2228ee75b84fc5165771c1935dd99 (patch) | |
tree | 5c851120431211ca79a00ddb98f1ff95180c09a0 /client/map/items | |
parent | cd053cb7813160550bd83870c2b23604d147a8bd (diff) | |
download | hurrycurry-3226addea9b2228ee75b84fc5165771c1935dd99.tar hurrycurry-3226addea9b2228ee75b84fc5165771c1935dd99.tar.bz2 hurrycurry-3226addea9b2228ee75b84fc5165771c1935dd99.tar.zst |
add item contents
Diffstat (limited to 'client/map/items')
-rw-r--r-- | client/map/items/food_processor.gd | 5 | ||||
-rw-r--r-- | client/map/items/glass.gd | 3 | ||||
-rw-r--r-- | client/map/items/item.gd | 4 | ||||
-rw-r--r-- | client/map/items/plate.gd | 4 | ||||
-rw-r--r-- | client/map/items/plate_items.gd | 91 | ||||
-rw-r--r-- | client/map/items/pot.gd | 4 | ||||
-rw-r--r-- | client/map/items/pot_items.gd | 130 |
7 files changed, 16 insertions, 225 deletions
diff --git a/client/map/items/food_processor.gd b/client/map/items/food_processor.gd index 81886ae7..67632fb4 100644 --- a/client/map/items/food_processor.gd +++ b/client/map/items/food_processor.gd @@ -19,10 +19,13 @@ extends Item var time := 0. var processing: CPUParticles3D = load("res://map/items/processing.tscn").instantiate() -func _init(owned_by_: Node3D): +func _init(owned_by_: Node3D, contents: Array[String]): super(owned_by_) add_child(load("res://map/items/food_processor.tscn").instantiate()) add_child(processing) + # TODO + # for c in contents: + # base.add_child(ItemFactory.produce(c)) func _process(delta: float): super(delta) diff --git a/client/map/items/glass.gd b/client/map/items/glass.gd index e974abe9..cff41f18 100644 --- a/client/map/items/glass.gd +++ b/client/map/items/glass.gd @@ -16,9 +16,10 @@ class_name Glass extends Item -func _init(owned_by_: Node3D): +func _init(owned_by_: Node3D, contents: Array[String]): super(owned_by_) add_child(load("res://map/items/glass.tscn").instantiate()) + # TODO func setup_sounds(): # TODO: Add custom glass sounds; For now use plate sounds as they are similar diff --git a/client/map/items/item.gd b/client/map/items/item.gd index 11914eef..244613a8 100644 --- a/client/map/items/item.gd +++ b/client/map/items/item.gd @@ -37,6 +37,7 @@ func _init(owned_by_: Node3D): setup_sounds() @warning_ignore("static_called_on_instance") base.position = base_position() + base.name = "Base" add_child(base) owned_by = owned_by_ @@ -44,6 +45,9 @@ func _ready(): position = owned_by.global_position func _process(delta): + if owned_by.get_parent() is Item: + position = Vector3(0.,0.,0.) + return var p = owned_by.get_parent().get_parent() is Player var ispeed = 30.0 if p else 10. position = G.interpolate(position, owned_by.global_position, delta * ispeed) diff --git a/client/map/items/plate.gd b/client/map/items/plate.gd index 61e097b8..2ff62d65 100644 --- a/client/map/items/plate.gd +++ b/client/map/items/plate.gd @@ -17,9 +17,11 @@ class_name Plate extends Item -func _init(owned_by_: Node3D): +func _init(owned_by_: Node3D, contents: Array[String]): super(owned_by_) add_child(load("res://map/items/plate.tscn").instantiate()) + for c in contents: + base.add_child(ItemFactory.produce(c, base)) func setup_sounds(): take_sound.setup([preload("res://map/items/sounds/plate_take.ogg")]) diff --git a/client/map/items/plate_items.gd b/client/map/items/plate_items.gd deleted file mode 100644 index adbe7aa9..00000000 --- a/client/map/items/plate_items.gd +++ /dev/null @@ -1,91 +0,0 @@ -# Hurry Curry! - a game about cooking -# Copyright 2024 metamuffin -# Copyright 2024 nokoe -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, version 3 of the License only. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <https://www.gnu.org/licenses/>. -# -class_name PlateItems - -class BreadSliceP extends Plate: - func _init(owned_by_: Node3D): - super(owned_by_) - base.add_child(load("res://map/items/bread_slice.tscn").instantiate()) - -class BreadSliceSlicedTomatoP extends BreadSliceP: - func _init(owned_by_: Node3D): - super(owned_by_) - var tomato = load("res://map/items/sliced_tomato.tscn").instantiate() - tomato.position.y = .05 - base.add_child(tomato) - -class BreadSliceSlicedTomatoSteakP extends BreadSliceSteakP: - func _init(owned_by_: Node3D): - super(owned_by_) - var tomato = load("res://map/items/sliced_tomato.tscn").instantiate() - tomato.position.y = .15 - base.add_child(tomato) - -class BreadSliceSteakP extends BreadSliceP: - func _init(owned_by_: Node3D): - super(owned_by_) - var steak = load("res://map/items/steak.tscn").instantiate() - steak.position.y = .05 - base.add_child(steak) - -class CurryP extends PlateFill: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color(.75, .45, .1)) - -class CookedRiceCurryP extends Plate: - func _init(owned_by_: Node3D): - super(owned_by_) - var fill = load("res://map/items/cooked-rice-curry-fill.tscn").instantiate() - add_child(fill) - -class DirtyP extends Plate: - func _init(owned_by_: Node3D): - super(owned_by_) - base.add_child(load("res://map/items/dirt.tscn").instantiate()) - -class SlicedTomatoP extends Plate: - func _init(owned_by_: Node3D): - super(owned_by_) - base.add_child(load("res://map/items/sliced_tomato.tscn").instantiate()) - -class SlicedTomatoSteakP extends SteakP: - func _init(owned_by_: Node3D): - super(owned_by_) - var tomato = load("res://map/items/sliced_tomato.tscn").instantiate() - tomato.position.y = .1 - base.add_child(tomato) - -class SteakP extends Plate: - func _init(owned_by_: Node3D): - super(owned_by_) - base.add_child(load("res://map/items/steak.tscn").instantiate()) - -class StrawberryIcecreamP extends IcecreamPlate: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color(.98, .55, .71)) - -class TomatoSoupP extends PlateFill: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color(1., .3, .2)) - -class NigiriP extends Plate: - func _init(owned_by_: Node3D): - super(owned_by_) - base.add_child(load("res://map/items/nigiri.tscn").instantiate()) diff --git a/client/map/items/pot.gd b/client/map/items/pot.gd index 2bed6a5c..fb41e3d7 100644 --- a/client/map/items/pot.gd +++ b/client/map/items/pot.gd @@ -18,10 +18,12 @@ extends Item var steam: CPUParticles3D = load("res://map/items/steam.tscn").instantiate() -func _init(owned_by_: Node3D): +func _init(owned_by_: Node3D, contents: Array[String]): super(owned_by_) add_child(load("res://map/items/pot.tscn").instantiate()) base.add_child(steam) + for c in contents: + base.add_child(ItemFactory.produce(c, owned_by_)) func progress(position_: float, speed: float, warn: bool): super(position_, speed, warn) diff --git a/client/map/items/pot_items.gd b/client/map/items/pot_items.gd deleted file mode 100644 index 25fd74d3..00000000 --- a/client/map/items/pot_items.gd +++ /dev/null @@ -1,130 +0,0 @@ -# Hurry Curry! - a game about cooking -# Copyright 2024 metamuffin -# Copyright 2024 nokoe -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, version 3 of the License only. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <https://www.gnu.org/licenses/>. -# -class_name PotItems - -class MochiDoughP extends PotFill: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color(1.,1.,.3)) - -class RiceP extends Pot: - var fill: MeshInstance3D = load("res://map/items/rice_content.tscn").instantiate() - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color(1.,1.,.8)) - add_child(fill) - func set_color(c: Color): - var mat: BaseMaterial3D = fill.get_active_material(0) - mat.albedo_color = c - -class RiceFlourP extends PotFill: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color(1.,1.,.8)) - -class TomatoJuiceP extends PotFill: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color(1.,0.,0.)) - -class TomatoSoupP extends PotFill: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color(1.,.3, .2)) - -class RawSteakP extends Pot: - func _init(owned_by_: Node3D): - super(owned_by_) - base.add_child(preload("res://map/items/raw_steak.tscn").instantiate()) - - func progress(position_: float, speed: float, warn: bool): - super(position_, speed, warn) - if sound_id == null: - sound_id = Sound.item_progress(self, preload("res://map/items/sounds/frying.ogg"), null) - -class LeekP extends Pot: - func _init(owned_by_: Node3D): - super(owned_by_) - var leek: Node3D = load("res://map/items/leek.tscn").instantiate() - leek.rotation_degrees = Vector3(14.5, 0, -25) - leek.position.x = .03 - base.add_child(leek) - -class LeekTomatoJuiceP extends TomatoJuiceP: - func _init(owned_by_: Node3D): - super(owned_by_) - var leek: Node3D = load("res://map/items/leek.tscn").instantiate() - leek.rotation_degrees = Vector3(14.5, 0, -25) - leek.position.x = .03 - base.add_child(leek) - -class CookedRiceP extends RiceP: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color(1.,1.,1.)) - -class BurnedP extends PotFill: - func _init(owned_by_: Node3D): - super(owned_by_) - steam.color = Color(0.,0.,0.) - set_color(Color(.1, .1, .1)) - - func _ready(): - steam.emitting = true - -class SteakP extends Pot: - func _init(owned_by_: Node3D): - super(owned_by_) - base.add_child(load("res://map/items/steak.tscn").instantiate()) - -class TomatoP extends Pot: - func _init(owned_by_: Node3D): - super(owned_by_) - base.add_child(load("res://map/items/tomato.tscn").instantiate()) - -class LeekTomatoP extends LeekP: - func _init(owned_by_: Node3D): - super(owned_by_) - base.add_child(load("res://map/items/tomato.tscn").instantiate()) - -class CurryP extends PotFill: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color(.75, .45, .1)) - -class MilkP extends PotFill: - func _init(owned_by_: Node3D): - super(owned_by_) - set_color(Color8(250, 250, 250)) - -class LeekMilkP extends MilkP: - func _init(owned_by_: Node3D): - super(owned_by_) - var leek: Node3D = load("res://map/items/leek.tscn").instantiate() - leek.rotation_degrees = Vector3(14.5, 0, -25) - leek.position.x = .03 - base.add_child(leek) - -class LeekMilkTomatoP extends LeekMilkP: - func _init(owned_by_: Node3D): - super(owned_by_) - base.add_child(load("res://map/items/tomato.tscn").instantiate()) - -class MilkTomatoP extends MilkP: - func _init(owned_by_: Node3D): - super(owned_by_) - base.add_child(load("res://map/items/tomato.tscn").instantiate()) |