diff options
Diffstat (limited to 'client/map')
| -rw-r--r-- | client/map/item_factory.gd | 6 | ||||
| -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 | 
8 files changed, 18 insertions, 229 deletions
| diff --git a/client/map/item_factory.gd b/client/map/item_factory.gd index b211a98e..24cb201f 100644 --- a/client/map/item_factory.gd +++ b/client/map/item_factory.gd @@ -18,9 +18,9 @@ class_name ItemFactory  extends Object  static func produce(name: String, owned_by: Node3D) -> Item: -	var c = name.split(":") +	var c = Array(name.split(":"))  	name = c[0] -	contents = c[1].split(",") if c.length > 1 else [] +	var contents = c[1].split(",") if c.size() > 1 else []  	match name:  		"bread-slice": return BreadSlice.new(owned_by) @@ -38,8 +38,6 @@ static func produce(name: String, owned_by: Node3D) -> Item:  		"raw-steak": return RawSteak.new(owned_by)  		"rice": return Rice.new(owned_by)  		"sliced-fish": return SlicedFish.new(owned_by) -		"sliced-tomato-plate": return PlateItems.SlicedTomatoP.new(owned_by) -		"sliced-tomato-steak-plate": return PlateItems.SlicedTomatoSteakP.new(owned_by)  		"sliced-tomato": return SlicedTomato.new(owned_by)  		"strawberry": return Strawberry.new(owned_by)  		"tomato": return Tomato.new(owned_by) 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()) | 
