It's Cow Game! Version 2.04!
This commit is contained in:
commit
a9e1ed9ddd
3148 changed files with 95332 additions and 0 deletions
87
Interactions/Arson/Arsonable.gd
Normal file
87
Interactions/Arson/Arsonable.gd
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
extends Interaction
|
||||
|
||||
var fireScene = preload("res://Skills/Arson/Fire.tscn")
|
||||
var smokeScene = preload("res://Skills/Arson/Smoke.tscn")
|
||||
|
||||
@export var ashItemClass:Resource
|
||||
|
||||
@export var flammability = 0
|
||||
@export var weight = 0
|
||||
|
||||
var ashDropLocation:Vector2
|
||||
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
var flintSoundPlayer
|
||||
var lastSoundIndex = -1
|
||||
var flintSounds = []
|
||||
|
||||
func _ready():
|
||||
add_action("Burn", burn)
|
||||
initialize_flint_sounds()
|
||||
|
||||
func initialize_flint_sounds():
|
||||
flintSoundPlayer = $FlintSounds
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint1.mp3"))
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint2.mp3"))
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint3.mp3"))
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint4.mp3"))
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint5.mp3"))
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint6.mp3"))
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint7.mp3"))
|
||||
flintSounds.append(load("res://Sounds/SFX/Fire/Flint/flint8.mp3"))
|
||||
|
||||
func burn():
|
||||
play_flint_sound()
|
||||
|
||||
if "item" in get_parent():
|
||||
flammability = get_parent().item.flammability
|
||||
weight = get_parent().item.weight
|
||||
|
||||
var fireChance = LevelManager.get_skill("arson").get_ignition_chance_by_stats(flammability, weight)
|
||||
if rng.randf_range(0, 100) <= fireChance:
|
||||
light_up()
|
||||
get_tree().call_group("FlagManager", "Arsoned")
|
||||
elif fireChance >= 0.5:
|
||||
smoke()
|
||||
|
||||
func play_flint_sound():
|
||||
var newIndex = rng.randi_range(0, flintSounds.size() - 1)
|
||||
|
||||
if newIndex == lastSoundIndex:
|
||||
newIndex = rng.randi_range(0, flintSounds.size() - 1)
|
||||
|
||||
flintSoundPlayer.stream = flintSounds[newIndex]
|
||||
flintSoundPlayer.play()
|
||||
lastSoundIndex = newIndex
|
||||
|
||||
func light_up():
|
||||
GlobalEvents.itemBurnt.emit(get_parent().item)
|
||||
|
||||
var newFire = fireScene.instantiate()
|
||||
newFire.set_item_burning(get_parent().item)
|
||||
|
||||
AchievementManager.burn_achievement_checks(get_parent().item)
|
||||
|
||||
var target_global_pos = get_parent().global_position + Vector2(0, 5)
|
||||
get_parent().get_parent().add_child(newFire)
|
||||
newFire.global_position = target_global_pos
|
||||
|
||||
newFire.set_item_burning(get_parent().item)
|
||||
|
||||
if get_parent() == GameVariables.player.currentInteractingGroundItem:
|
||||
GameVariables.player.change_state("Idle")
|
||||
|
||||
get_parent().queue_free()
|
||||
|
||||
func smoke():
|
||||
var newSmoke = smokeScene.instantiate()
|
||||
newSmoke.position = position + Vector2(0, -20)
|
||||
newSmoke.emitting = true
|
||||
get_parent().add_child(newSmoke)
|
||||
|
||||
func generate_ash():
|
||||
if ashItemClass == null:
|
||||
var baseItem = get_parent().item
|
||||
var ash = AshGenerator.generate_ash(baseItem)
|
||||
get_parent().set_item(ash)
|
||||
14
Interactions/Arson/arsonable.tscn
Normal file
14
Interactions/Arson/arsonable.tscn
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://twerpkipa0v8"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_sas5q"]
|
||||
[ext_resource type="Script" path="res://Interactions/Arson/Arsonable.gd" id="2_iex02"]
|
||||
|
||||
[node name="Arsonable" instance=ExtResource("1_sas5q")]
|
||||
script = ExtResource("2_iex02")
|
||||
ashItemClass = null
|
||||
flammability = 0
|
||||
weight = 0
|
||||
|
||||
[node name="FlintSounds" type="AudioStreamPlayer2D" parent="." index="1"]
|
||||
max_distance = 400.0
|
||||
bus = &"SFX"
|
||||
BIN
Interactions/Arson/fire.png
Normal file
BIN
Interactions/Arson/fire.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
34
Interactions/Arson/fire.png.import
Normal file
34
Interactions/Arson/fire.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dkpoh87sg45k2"
|
||||
path="res://.godot/imported/fire.png-6196b70097a88fd173a19acc5ecf6a1c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Interactions/Arson/fire.png"
|
||||
dest_files=["res://.godot/imported/fire.png-6196b70097a88fd173a19acc5ecf6a1c.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
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/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
|
||||
7
Interactions/AshBarrel/AshBarrelInteraction.gd
Normal file
7
Interactions/AshBarrel/AshBarrelInteraction.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
extends Interaction
|
||||
|
||||
func _ready():
|
||||
add_action("Add Ash", add_ash)
|
||||
|
||||
func add_ash():
|
||||
get_parent().show_ash_barrel_window ()
|
||||
7
Interactions/AshBarrel/AshBarrelInteraction.tscn
Normal file
7
Interactions/AshBarrel/AshBarrelInteraction.tscn
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bqf30ut0hvmn4"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cgfdtagfd85h0" path="res://Interactions/BasketStorage/BasketStorage.tscn" id="1_xhs42"]
|
||||
[ext_resource type="Script" path="res://Interactions/AshBarrel/AshBarrelInteraction.gd" id="2_k8rjc"]
|
||||
|
||||
[node name="AshBarrelInteraction" instance=ExtResource("1_xhs42")]
|
||||
script = ExtResource("2_k8rjc")
|
||||
11
Interactions/BasketStorage/BasketStorage.gd
Normal file
11
Interactions/BasketStorage/BasketStorage.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
extends Interaction
|
||||
|
||||
func _ready():
|
||||
add_action("Place Basket", place_basket)
|
||||
add_action("Storage", open_storage)
|
||||
|
||||
func place_basket():
|
||||
get_parent().show_basket_changing_window()
|
||||
|
||||
func open_storage():
|
||||
get_parent().show_basket_storage_window()
|
||||
7
Interactions/BasketStorage/BasketStorage.tscn
Normal file
7
Interactions/BasketStorage/BasketStorage.tscn
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://cgfdtagfd85h0"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_geerp"]
|
||||
[ext_resource type="Script" path="res://Interactions/BasketStorage/BasketStorage.gd" id="2_im426"]
|
||||
|
||||
[node name="BasketStorage" instance=ExtResource("1_geerp")]
|
||||
script = ExtResource("2_im426")
|
||||
10
Interactions/BeachHole/BeachHole.gd
Normal file
10
Interactions/BeachHole/BeachHole.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
extends Interaction
|
||||
|
||||
@onready var holeInterface:Window = $BeachHoleMenu
|
||||
|
||||
func _ready():
|
||||
add_action("Reach In", open_hole_window)
|
||||
|
||||
func open_hole_window():
|
||||
holeInterface.popup_centered()
|
||||
holeInterface.opened()
|
||||
11
Interactions/BeachHole/BeachHoleInteraction.tscn
Normal file
11
Interactions/BeachHole/BeachHoleInteraction.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dr1lpq37n4qar"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_w616a"]
|
||||
[ext_resource type="Script" path="res://Interactions/BeachHole/BeachHole.gd" id="2_jywrk"]
|
||||
[ext_resource type="PackedScene" uid="uid://baol6qs3m4f1h" path="res://UI/BeachHole/BeachHoleMenu.tscn" id="3_455h4"]
|
||||
|
||||
[node name="BeachHoleInteraction" instance=ExtResource("1_w616a")]
|
||||
script = ExtResource("2_jywrk")
|
||||
|
||||
[node name="BeachHoleMenu" parent="." index="1" instance=ExtResource("3_455h4")]
|
||||
visible = false
|
||||
31
Interactions/Building/BuildingSpot/Buildable.gd
Normal file
31
Interactions/Building/BuildingSpot/Buildable.gd
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
extends Interaction
|
||||
|
||||
func _ready():
|
||||
add_action("Plan", plan, plan_check)
|
||||
add_action("Build", build, build_check)
|
||||
add_action("Arson", arson, arson_check)
|
||||
add_action("Demolish", demolish, demolish_check)
|
||||
|
||||
func build():
|
||||
get_parent().build()
|
||||
|
||||
func build_check():
|
||||
return get_parent().build_check()
|
||||
|
||||
func plan():
|
||||
get_parent().plan()
|
||||
|
||||
func plan_check():
|
||||
return get_parent().plan_check()
|
||||
|
||||
func demolish():
|
||||
get_parent().demolish()
|
||||
|
||||
func demolish_check():
|
||||
return get_parent().demolish_check()
|
||||
|
||||
func arson():
|
||||
get_parent().arson()
|
||||
|
||||
func arson_check():
|
||||
return get_parent().arson_check()
|
||||
7
Interactions/Building/BuildingSpot/Buildable.tscn
Normal file
7
Interactions/Building/BuildingSpot/Buildable.tscn
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://cf3aqkjfurrjs"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_ui8jv"]
|
||||
[ext_resource type="Script" path="res://Interactions/Building/BuildingSpot/Buildable.gd" id="2_5uan7"]
|
||||
|
||||
[node name="Buildable" instance=ExtResource("1_ui8jv")]
|
||||
script = ExtResource("2_5uan7")
|
||||
24
Interactions/Building/BuildingSpot/SandcastleBuildable.gd
Normal file
24
Interactions/Building/BuildingSpot/SandcastleBuildable.gd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
extends Interaction
|
||||
|
||||
func _ready():
|
||||
add_action("Plan", plan, plan_check)
|
||||
add_action("Build", build, build_check)
|
||||
add_action("Demolish", demolish, demolish_check)
|
||||
|
||||
func build():
|
||||
get_parent().build()
|
||||
|
||||
func build_check():
|
||||
return get_parent().build_check()
|
||||
|
||||
func plan():
|
||||
get_parent().plan()
|
||||
|
||||
func plan_check():
|
||||
return get_parent().plan_check()
|
||||
|
||||
func demolish():
|
||||
get_parent().demolish()
|
||||
|
||||
func demolish_check():
|
||||
return get_parent().demolish_check()
|
||||
10
Interactions/Cleaning/CleaningInteration.gd
Normal file
10
Interactions/Cleaning/CleaningInteration.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
extends Interaction
|
||||
|
||||
@onready var cleaningInterface:Window = $CleaningMenu
|
||||
|
||||
func _ready():
|
||||
add_action("Dry Cleaning", open_cleaning_window)
|
||||
|
||||
func open_cleaning_window():
|
||||
cleaningInterface.popup_centered()
|
||||
cleaningInterface.opened()
|
||||
11
Interactions/Cleaning/CleaningInteration.tscn
Normal file
11
Interactions/Cleaning/CleaningInteration.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://bopvdfj5s3eax"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_k8kth"]
|
||||
[ext_resource type="Script" path="res://Interactions/Cleaning/CleaningInteration.gd" id="2_74q3p"]
|
||||
[ext_resource type="PackedScene" uid="uid://7jnt7eg1d70y" path="res://UI/Cleaning/CleaningMenu.tscn" id="3_k884r"]
|
||||
|
||||
[node name="CleaningInteraction" instance=ExtResource("1_k8kth")]
|
||||
script = ExtResource("2_74q3p")
|
||||
|
||||
[node name="CleaningMenu" parent="." index="1" instance=ExtResource("3_k884r")]
|
||||
visible = false
|
||||
16
Interactions/Delivery/Deliverable.gd
Normal file
16
Interactions/Delivery/Deliverable.gd
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
extends Interaction
|
||||
|
||||
@onready var deliveryInterface:Window = $DeliveryInteface
|
||||
|
||||
var shopInventory = []
|
||||
|
||||
func _ready():
|
||||
add_action("Deliver", open_delivery)
|
||||
#instantiate_shop_inventory()
|
||||
|
||||
func open_delivery():
|
||||
deliveryInterface.popup_centered()
|
||||
deliveryInterface.opened()
|
||||
|
||||
func instantiate_shop_inventory():
|
||||
$DeliveryInteface.shopItems = shopInventory
|
||||
21
Interactions/Delivery/Deliverable.tscn
Normal file
21
Interactions/Delivery/Deliverable.tscn
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://b01n0ke0n613i"]
|
||||
|
||||
[ext_resource type="Script" path="res://Interactions/Delivery/Deliverable.gd" id="1_1dope"]
|
||||
[ext_resource type="Script" path="res://Interactions/Delivery/DeliveryInteface.gd" id="2_tcgba"]
|
||||
[ext_resource type="Script" path="res://Items/Foods/Fruits/Orange.gd" id="3_2iqt2"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_dyv8m"]
|
||||
radius = 85.0235
|
||||
|
||||
[node name="Deliverable" type="Node2D"]
|
||||
script = ExtResource("1_1dope")
|
||||
|
||||
[node name="InteractionArea" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractionArea"]
|
||||
shape = SubResource("CircleShape2D_dyv8m")
|
||||
|
||||
[node name="DeliveryInteface" type="Window" parent="."]
|
||||
visible = false
|
||||
script = ExtResource("2_tcgba")
|
||||
DeliveryItems = Array[Resource]([ExtResource("3_2iqt2")])
|
||||
152
Interactions/Delivery/DeliveryInteface.gd
Normal file
152
Interactions/Delivery/DeliveryInteface.gd
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
extends Window
|
||||
|
||||
var itemShopDisplayScene = preload("res://UI/Shopping/ItemShopDisplay.tscn")
|
||||
@onready var inventoryItemDisplayer = $"VBoxContainer/Invs/Inventory/ItemZone/Items"
|
||||
@onready var shopItemDisplayer = $"VBoxContainer/Invs/Shop/ItemZone/Items"
|
||||
@onready var playerTradeItemDisplayer = $"VBoxContainer/TradeZone/TradeSides/PlayerSide/ItemZone/Items"
|
||||
@onready var shopTradeItemDisplayer = $"VBoxContainer/TradeZone/TradeSides/ShopSide/ItemZone/Items"
|
||||
|
||||
@onready var costDisplay = $VBoxContainer/CostDisplay
|
||||
|
||||
@export var DeliveryItems:Array[Resource]
|
||||
|
||||
var shopItems = []
|
||||
|
||||
var playerTradeItems:Inventory
|
||||
var shopTradeItems:Inventory
|
||||
|
||||
func _ready():
|
||||
inventoryItemDisplayer.buttonPressed.connect(add_to_player_trade)
|
||||
playerTradeItemDisplayer.buttonPressed.connect(remove_from_player_trade)
|
||||
|
||||
shopItemDisplayer.buttonPressed.connect(add_to_shop_trade)
|
||||
shopTradeItemDisplayer.buttonPressed.connect(remove_from_shop_trade)
|
||||
|
||||
shopItemDisplayer.quantitiesShown = false
|
||||
|
||||
playerTradeItemDisplayer.negativeOptions = true
|
||||
shopTradeItemDisplayer.negativeOptions = true
|
||||
|
||||
playerTradeItemDisplayer.positiveOptions = false
|
||||
shopTradeItemDisplayer.positiveOptions = false
|
||||
|
||||
func opened():
|
||||
get_tree().paused = true
|
||||
set_up_inventory()
|
||||
set_up_shop_inventory()
|
||||
|
||||
playerTradeItems = Inventory.new()
|
||||
shopTradeItems = Inventory.new()
|
||||
|
||||
update_cost_display()
|
||||
|
||||
func set_up_inventory():
|
||||
var inv = InventoryManager.get_inventory()
|
||||
for item in inv.items:
|
||||
if DeliveryItems.has(item):
|
||||
inventoryItemDisplayer.inventory.items.append(item)
|
||||
pass
|
||||
inventoryItemDisplayer.update_display()
|
||||
|
||||
func set_up_shop_inventory():
|
||||
shopItemDisplayer.inventory.items = shopItems
|
||||
for i in shopItems.size():
|
||||
shopItemDisplayer.inventory.quantities.append(1)
|
||||
|
||||
shopItemDisplayer.update_display()
|
||||
|
||||
func add_to_shop_trade(item):
|
||||
shopTradeItems.add_item(item)
|
||||
|
||||
shopTradeItemDisplayer.inventory = shopTradeItems
|
||||
shopTradeItemDisplayer.update_display()
|
||||
|
||||
update_cost_display()
|
||||
|
||||
func remove_from_shop_trade(item):
|
||||
shopTradeItems.remove_item(item)
|
||||
|
||||
shopTradeItemDisplayer.inventory = shopTradeItems
|
||||
shopTradeItemDisplayer.update_display()
|
||||
|
||||
update_cost_display()
|
||||
|
||||
func add_to_player_trade(item):
|
||||
InventoryManager.remove_item_from_inventory(item)
|
||||
playerTradeItems.add_item(item)
|
||||
|
||||
playerTradeItemDisplayer.inventory = playerTradeItems
|
||||
playerTradeItemDisplayer.update_display()
|
||||
inventoryItemDisplayer.update_display()
|
||||
|
||||
update_cost_display()
|
||||
|
||||
func remove_from_player_trade(item):
|
||||
InventoryManager.add_item_to_inventory(item)
|
||||
playerTradeItems.remove_item(item)
|
||||
|
||||
playerTradeItemDisplayer.inventory = playerTradeItems
|
||||
playerTradeItemDisplayer.update_display()
|
||||
inventoryItemDisplayer.update_display()
|
||||
|
||||
update_cost_display()
|
||||
|
||||
func update_cost_display():
|
||||
var cost = get_cost()
|
||||
costDisplay.set_display(cost)
|
||||
|
||||
func get_cost():
|
||||
var playerOffering = 0
|
||||
var shopOffering = 0
|
||||
|
||||
for i in range(playerTradeItems.items.size()):
|
||||
playerOffering += playerTradeItems.items[i].value * playerTradeItems.quantities[i]
|
||||
|
||||
for i in range(shopTradeItems.items.size()):
|
||||
shopOffering += shopTradeItems.items[i].value * shopTradeItems.quantities[i]
|
||||
|
||||
return playerOffering - shopOffering
|
||||
|
||||
func reset_items():
|
||||
for i in range(playerTradeItems.items.size()):
|
||||
var currentItem = playerTradeItems.items[i]
|
||||
InventoryManager.add_item_to_inventory(currentItem, playerTradeItems.quantities[i])
|
||||
|
||||
playerTradeItems = Inventory.new()
|
||||
playerTradeItemDisplayer.inventory = playerTradeItems
|
||||
playerTradeItemDisplayer.update_display()
|
||||
|
||||
shopTradeItems = Inventory.new()
|
||||
shopTradeItemDisplayer.inventory = shopTradeItems
|
||||
shopTradeItemDisplayer.update_display()
|
||||
|
||||
func _on_leave_button_pressed():
|
||||
reset_items()
|
||||
get_tree().paused = false
|
||||
hide()
|
||||
|
||||
func _on_confirm_button_pressed():
|
||||
var currentCost = get_cost()*-1
|
||||
var currentGrapesOwned = InventoryManager.get_grape_count()
|
||||
|
||||
if currentGrapesOwned >= currentCost:
|
||||
confirm_trade()
|
||||
|
||||
func confirm_trade():
|
||||
var currentCost = get_cost()
|
||||
InventoryManager.alter_grape_count(currentCost)
|
||||
|
||||
for i in range(shopTradeItems.items.size()):
|
||||
InventoryManager.add_item_to_inventory(shopTradeItems.items[i], shopTradeItems.quantities[i])
|
||||
|
||||
playerTradeItems = Inventory.new()
|
||||
playerTradeItemDisplayer.inventory = playerTradeItems
|
||||
playerTradeItemDisplayer.update_display()
|
||||
|
||||
shopTradeItems = Inventory.new()
|
||||
shopTradeItemDisplayer.inventory = shopTradeItems
|
||||
shopTradeItemDisplayer.update_display()
|
||||
|
||||
inventoryItemDisplayer.update_display()
|
||||
|
||||
update_cost_display()
|
||||
39
Interactions/GardeningSpot/GardeningSpot.gd
Normal file
39
Interactions/GardeningSpot/GardeningSpot.gd
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
extends Interaction
|
||||
|
||||
func _ready():
|
||||
add_action("Plant", plant, plant_check)
|
||||
add_action("Dig Up", dig_up, dig_up_check)
|
||||
add_action("Fertilize", fertilize, fertilize_check)
|
||||
add_action("Harvest", harvest, harvest_check)
|
||||
|
||||
func plant():
|
||||
get_parent().open_planting_menu()
|
||||
|
||||
func plant_check():
|
||||
if get_parent().currentState == PlantingSpot.PlantState.Empty:
|
||||
return true
|
||||
return false
|
||||
|
||||
func dig_up():
|
||||
get_parent().dig_up()
|
||||
|
||||
func dig_up_check():
|
||||
if get_parent().currentState == PlantingSpot.PlantState.Planted or get_parent().currentState == PlantingSpot.PlantState.GrownTree:
|
||||
return true
|
||||
return false
|
||||
|
||||
func fertilize():
|
||||
get_parent().open_fertilization_menu()
|
||||
|
||||
func fertilize_check():
|
||||
if get_parent().currentState == PlantingSpot.PlantState.Planted:
|
||||
return true
|
||||
return false
|
||||
|
||||
func harvest():
|
||||
get_parent().harvest()
|
||||
|
||||
func harvest_check():
|
||||
if get_parent().currentState == PlantingSpot.PlantState.GrownTree:
|
||||
return true
|
||||
return false
|
||||
7
Interactions/GardeningSpot/GardeningSpot.tscn
Normal file
7
Interactions/GardeningSpot/GardeningSpot.tscn
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://cjocgnhcqft5t"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_2irft"]
|
||||
[ext_resource type="Script" path="res://Interactions/GardeningSpot/GardeningSpot.gd" id="2_otk8g"]
|
||||
|
||||
[node name="GardeningSpot" instance=ExtResource("1_2irft")]
|
||||
script = ExtResource("2_otk8g")
|
||||
10
Interactions/Hole/Hole.gd
Normal file
10
Interactions/Hole/Hole.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
extends Interaction
|
||||
|
||||
@onready var holeInterface:Window = $HoleMenu
|
||||
|
||||
func _ready():
|
||||
add_action("Throw Stuff in There", open_hole_window)
|
||||
|
||||
func open_hole_window():
|
||||
holeInterface.popup_centered()
|
||||
holeInterface.opened()
|
||||
10
Interactions/Hole/HoleInteraction.tscn
Normal file
10
Interactions/Hole/HoleInteraction.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://bsralfmn77824"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_d14gh"]
|
||||
[ext_resource type="Script" path="res://Interactions/Hole/Hole.gd" id="2_jdexc"]
|
||||
[ext_resource type="PackedScene" uid="uid://bn16f7m6ev1is" path="res://UI/Hole/HoleMenu.tscn" id="3_7q82x"]
|
||||
|
||||
[node name="Hole" instance=ExtResource("1_d14gh")]
|
||||
script = ExtResource("2_jdexc")
|
||||
|
||||
[node name="HoleMenu" parent="." index="1" instance=ExtResource("3_7q82x")]
|
||||
51
Interactions/Interactable/Action_Menu.gd
Normal file
51
Interactions/Interactable/Action_Menu.gd
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
extends Node2D
|
||||
|
||||
signal action_selected(ID)
|
||||
|
||||
var next_ID = 1
|
||||
var availabilityChecks = {}
|
||||
|
||||
var defaultOptionsAdded = false
|
||||
|
||||
var shortcuts = [KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9]
|
||||
var action_ids
|
||||
|
||||
func _process(delta):
|
||||
var popupMenu:PopupMenu = $PopupMenu
|
||||
if popupMenu.visible:
|
||||
for i in range(popupMenu.item_count):
|
||||
var currentID = popupMenu.get_item_id(i)
|
||||
if currentID < shortcuts.size() and Input.is_action_just_pressed(str(currentID)):
|
||||
_on_popup_menu_id_pressed(currentID)
|
||||
if currentID == popupMenu.item_count:
|
||||
popupMenu.hide()
|
||||
break
|
||||
|
||||
func appear():
|
||||
var popupMenu:PopupMenu = $PopupMenu
|
||||
popupMenu.show()
|
||||
|
||||
for i in range(popupMenu.item_count):
|
||||
var currentID = popupMenu.get_item_id(i)
|
||||
|
||||
if currentID in availabilityChecks.keys():
|
||||
var result = availabilityChecks[currentID].call()
|
||||
popupMenu.set_item_disabled(i, !result)
|
||||
|
||||
if !defaultOptionsAdded:
|
||||
defaultOptionsAdded = true
|
||||
add_action("Cancel")
|
||||
|
||||
func add_availability_check(ID, availabilityCheck):
|
||||
availabilityChecks[ID] = availabilityCheck
|
||||
|
||||
func add_action(actionName):
|
||||
$PopupMenu.add_item(actionName, next_ID)
|
||||
|
||||
var last_ID = next_ID
|
||||
next_ID += 1
|
||||
|
||||
return last_ID
|
||||
|
||||
func _on_popup_menu_id_pressed(id):
|
||||
action_selected.emit(id)
|
||||
18
Interactions/Interactable/Interactable.gd
Normal file
18
Interactions/Interactable/Interactable.gd
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
extends Node2D
|
||||
|
||||
var WindowSize = Vector2(880,620)
|
||||
|
||||
func _on_panel_gui_input(event):
|
||||
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
||||
$ActionMenu.appear()
|
||||
$ActionMenu.get_node("PopupMenu").position = GetPopUpPos()
|
||||
|
||||
func GetPopUpPos():
|
||||
var MousePos = get_viewport().get_mouse_position()
|
||||
var PopUpPos = MousePos
|
||||
var MenuSize = get_node("ActionMenu/PopupMenu").size
|
||||
|
||||
if MenuSize.x + MousePos.x > WindowSize.x: PopUpPos.x -= MenuSize.x
|
||||
if MenuSize.y + MousePos.y > WindowSize.y: PopUpPos.y -= MenuSize.y
|
||||
|
||||
return PopUpPos
|
||||
29
Interactions/Interactable/Interaction.gd
Normal file
29
Interactions/Interactable/Interaction.gd
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
extends Node2D
|
||||
|
||||
class_name Interaction
|
||||
|
||||
@export var disableAddingActions:bool = false
|
||||
|
||||
var IDs = []
|
||||
var actionFunctions = []
|
||||
|
||||
func add_action(interactionName:String, action_function, availabilityCheck = null):
|
||||
if disableAddingActions:
|
||||
return
|
||||
|
||||
var actionMenu = get_parent().get_node("Interactable/ActionMenu")
|
||||
|
||||
var newID = actionMenu.add_action(interactionName)
|
||||
actionMenu.action_selected.connect(action_chosen)
|
||||
|
||||
IDs.append(newID)
|
||||
actionFunctions.append(action_function)
|
||||
|
||||
if availabilityCheck != null:
|
||||
actionMenu.add_availability_check(newID, availabilityCheck)
|
||||
|
||||
func action_chosen(ID:int):
|
||||
for i in range(0, IDs.size()):
|
||||
if IDs[i] == ID:
|
||||
var cow = get_tree().get_root().get_node("MainGame/Cow")
|
||||
cow.interact(self, actionFunctions[i], $InteractionArea.global_position)
|
||||
11
Interactions/Interactable/action_menu.tscn
Normal file
11
Interactions/Interactable/action_menu.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://bln4jur7glsny"]
|
||||
|
||||
[ext_resource type="Script" path="res://Interactions/Interactable/Action_Menu.gd" id="1_3sydg"]
|
||||
|
||||
[node name="ActionMenu" type="Node2D"]
|
||||
script = ExtResource("1_3sydg")
|
||||
|
||||
[node name="PopupMenu" type="PopupMenu" parent="."]
|
||||
size = Vector2i(100, 50)
|
||||
|
||||
[connection signal="id_pressed" from="PopupMenu" to="." method="_on_popup_menu_id_pressed"]
|
||||
25
Interactions/Interactable/interactable.tscn
Normal file
25
Interactions/Interactable/interactable.tscn
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://bqibe7ha6r5ls"]
|
||||
|
||||
[ext_resource type="Script" path="res://Interactions/Interactable/Interactable.gd" id="1_wos4h"]
|
||||
[ext_resource type="PackedScene" uid="uid://bln4jur7glsny" path="res://Interactions/Interactable/action_menu.tscn" id="2_qa6qc"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_514te"]
|
||||
|
||||
[node name="Interactable" type="Node2D"]
|
||||
script = ExtResource("1_wos4h")
|
||||
|
||||
[node name="ActionMenu" parent="." instance=ExtResource("2_qa6qc")]
|
||||
|
||||
[node name="PopupMenu" parent="ActionMenu" index="0"]
|
||||
allow_search = false
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
offset_left = -101.0
|
||||
offset_top = -102.0
|
||||
offset_right = 102.0
|
||||
offset_bottom = 103.0
|
||||
theme_override_styles/panel = SubResource("StyleBoxEmpty_514te")
|
||||
|
||||
[connection signal="gui_input" from="Panel" to="." method="_on_panel_gui_input"]
|
||||
|
||||
[editable path="ActionMenu"]
|
||||
11
Interactions/Interactable/interactable_tutorialExit.gd
Normal file
11
Interactions/Interactable/interactable_tutorialExit.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
extends "res://Interactions/Interactable/Interactable.gd"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
12
Interactions/Interactable/interaction.tscn
Normal file
12
Interactions/Interactable/interaction.tscn
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://c5ded8kcouyci"]
|
||||
|
||||
[ext_resource type="Script" path="res://Interactions/Interactable/Interaction.gd" id="1_421lg"]
|
||||
|
||||
[node name="Interaction" type="Node2D"]
|
||||
script = ExtResource("1_421lg")
|
||||
|
||||
[node name="InteractionArea" type="Area2D" parent="."]
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractionArea"]
|
||||
10
Interactions/Juicing/Juicer.gd
Normal file
10
Interactions/Juicing/Juicer.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
extends Interaction
|
||||
|
||||
@onready var juicerInterface:Window = $JuicingMenu
|
||||
|
||||
func _ready():
|
||||
add_action("Juice", open_juicing_window)
|
||||
|
||||
func open_juicing_window():
|
||||
juicerInterface.popup_centered()
|
||||
juicerInterface.opened()
|
||||
11
Interactions/Juicing/juicer.tscn
Normal file
11
Interactions/Juicing/juicer.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://ce073wnh6shlq"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_wbtyj"]
|
||||
[ext_resource type="PackedScene" uid="uid://dodoaqx11kq4o" path="res://UI/Juicing/juicing_menu.tscn" id="2_gg6iq"]
|
||||
[ext_resource type="Script" path="res://Interactions/Juicing/Juicer.gd" id="2_ugit7"]
|
||||
|
||||
[node name="Juicer" instance=ExtResource("1_wbtyj")]
|
||||
script = ExtResource("2_ugit7")
|
||||
|
||||
[node name="JuicingMenu" parent="." index="0" instance=ExtResource("2_gg6iq")]
|
||||
visible = false
|
||||
17
Interactions/Pickupable/Pickupable.gd
Normal file
17
Interactions/Pickupable/Pickupable.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
extends Interaction
|
||||
|
||||
func _ready():
|
||||
add_action("Pick Up", pickUp)
|
||||
|
||||
func pickUp():
|
||||
var item = get_parent().item
|
||||
|
||||
var player = GameVariables.player
|
||||
if player.currentInteractingItem == item:
|
||||
player.change_state("Idle")
|
||||
|
||||
if get_parent().keyItem:
|
||||
InventoryManager.add_item_to_inventory(item, 1, "keyItems")
|
||||
else:
|
||||
InventoryManager.add_item_to_inventory(item)
|
||||
get_parent().queue_free()
|
||||
7
Interactions/Pickupable/Pickupable.tscn
Normal file
7
Interactions/Pickupable/Pickupable.tscn
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bt2n0yqtg4rdu"]
|
||||
|
||||
[ext_resource type="PackedScene" path="res://Interactions/Interactable/interaction.tscn" id="1_sas5q"]
|
||||
[ext_resource type="Script" path="res://Interactions/Pickupable/Pickupable.gd" id="2_v4ydm"]
|
||||
|
||||
[node name="Pickupable" instance=ExtResource("1_sas5q")]
|
||||
script = ExtResource("2_v4ydm")
|
||||
10
Interactions/Refilling/RefillingInteration.gd
Normal file
10
Interactions/Refilling/RefillingInteration.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
extends Interaction
|
||||
|
||||
@onready var refillingInterface:Window = $RefillingMenu
|
||||
|
||||
func _ready():
|
||||
add_action("Refill", open_refilling_window)
|
||||
|
||||
func open_refilling_window():
|
||||
refillingInterface.popup_centered()
|
||||
refillingInterface.opened()
|
||||
11
Interactions/Refilling/RefillingInteration.tscn
Normal file
11
Interactions/Refilling/RefillingInteration.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://0ltsucnpwie2"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_lxel4"]
|
||||
[ext_resource type="Script" path="res://Interactions/Refilling/RefillingInteration.gd" id="2_fs7te"]
|
||||
[ext_resource type="PackedScene" uid="uid://crynlveb561db" path="res://UI/Refilling/RefillingMenu.tscn" id="3_32j1o"]
|
||||
|
||||
[node name="RefillingInteraction" instance=ExtResource("1_lxel4")]
|
||||
script = ExtResource("2_fs7te")
|
||||
|
||||
[node name="RefillingMenu" parent="." index="1" instance=ExtResource("3_32j1o")]
|
||||
visible = false
|
||||
9
Interactions/Rideable/Rideable.gd
Normal file
9
Interactions/Rideable/Rideable.gd
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
extends Interaction
|
||||
|
||||
func _ready():
|
||||
add_action("Ride", ride)
|
||||
|
||||
func ride():
|
||||
GameVariables.player.change_state("Riding")
|
||||
GameVariables.player.play_animation("Idle")
|
||||
get_parent().ride()
|
||||
7
Interactions/Rideable/Rideable.tscn
Normal file
7
Interactions/Rideable/Rideable.tscn
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://0adfy6rcgp1q"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_8mshb"]
|
||||
[ext_resource type="Script" path="res://Interactions/Rideable/Rideable.gd" id="2_kd18a"]
|
||||
|
||||
[node name="Rideable" instance=ExtResource("1_8mshb")]
|
||||
script = ExtResource("2_kd18a")
|
||||
13
Interactions/Scavenging/LogScavengeable.gd
Normal file
13
Interactions/Scavenging/LogScavengeable.gd
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
extends "res://Interactions/Scavenging/scavengeable.gd"
|
||||
|
||||
func item_scavenged():
|
||||
if SaveManager.get_save_value("ambiQuestStarted", false) and InventoryManager.get_item_count_by_name("Basket Plan 3", "keyItems") <= 0:
|
||||
give_basket_note()
|
||||
else:
|
||||
super.item_scavenged()
|
||||
|
||||
func give_basket_note():
|
||||
var basketNote = preload("res://Items/Paper/BasketPlan3.gd").new()
|
||||
InventoryManager.add_item_to_inventory(basketNote, 1, "keyItems")
|
||||
MessageManager.item_popup(basketNote.duplicate())
|
||||
get_tree().get_root().get_node("MainGame/PuzzleCompleteAudio").play()
|
||||
101
Interactions/Scavenging/scavengeable.gd
Normal file
101
Interactions/Scavenging/scavengeable.gd
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
extends Interaction
|
||||
|
||||
@export var scavengeDifficulty:int = 5
|
||||
@export var dropItemClasses:Array[Resource]
|
||||
@export var dropItemProbabilities:Array[int]
|
||||
@export var xpRewards:Array[int]
|
||||
@export var dropItemLocationOffsets:Array[Vector2]
|
||||
|
||||
var groundItemScene = preload("res://Objects/GroundItems/GroundItem.tscn")
|
||||
|
||||
var nextDropLocationIndex = 0
|
||||
var dropItems:Array[Item]
|
||||
|
||||
var itemsDropped = []
|
||||
var scavengeProgress = 0
|
||||
|
||||
var scavenging = false
|
||||
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
func _ready():
|
||||
add_action("Scavenge", scavenge)
|
||||
initialize_items()
|
||||
initialize_dropped_items_array()
|
||||
|
||||
$ScavengeBar.max_value = scavengeDifficulty
|
||||
|
||||
GameVariables.player.moved.connect(stop_scavenging)
|
||||
|
||||
func scavenge():
|
||||
if itemsDropped == []:
|
||||
return
|
||||
scavenging = true
|
||||
$ScavengeBar.visible = true
|
||||
$ScavengeBar.global_position = GameVariables.player.global_position + Vector2(-70, -120)
|
||||
|
||||
func _process(delta):
|
||||
if scavenging:
|
||||
progress_scavenging(delta)
|
||||
|
||||
func stop_scavenging():
|
||||
scavenging = false
|
||||
scavengeProgress = 0
|
||||
$ScavengeBar.visible = false
|
||||
|
||||
func progress_scavenging(delta):
|
||||
var scavengeSpeed = LevelManager.get_skill("scavenging").get_scavenging_speed(scavengeDifficulty)
|
||||
scavengeProgress += scavengeSpeed * delta
|
||||
|
||||
if scavengeProgress >= scavengeDifficulty:
|
||||
scavengeProgress = 0
|
||||
item_scavenged()
|
||||
|
||||
update_scavenge_bar()
|
||||
|
||||
func update_scavenge_bar():
|
||||
$ScavengeBar.value = scavengeProgress
|
||||
|
||||
func item_scavenged():
|
||||
var totalProbabilities = 0
|
||||
for probability in dropItemProbabilities:
|
||||
totalProbabilities += probability
|
||||
|
||||
var itemResult = randi_range(1, totalProbabilities)
|
||||
var percentageChecked = 0
|
||||
for i in range(dropItemProbabilities.size()):
|
||||
var currentChance = dropItemProbabilities[i]
|
||||
percentageChecked += currentChance
|
||||
if itemResult <= percentageChecked:
|
||||
spawn_item(dropItems[i])
|
||||
award_xp(i)
|
||||
break
|
||||
|
||||
func award_xp(itemIndex):
|
||||
LevelManager.add_XP("scavenging", xpRewards[itemIndex])
|
||||
|
||||
func spawn_item(item:Item):
|
||||
var itemInSpot = itemsDropped[nextDropLocationIndex]
|
||||
if is_instance_valid(itemInSpot) and itemInSpot != null:
|
||||
itemInSpot.queue_free()
|
||||
|
||||
var newGroundItem = groundItemScene.instantiate()
|
||||
newGroundItem.set_item(item.duplicate())
|
||||
|
||||
newGroundItem.position = dropItemLocationOffsets[nextDropLocationIndex]
|
||||
get_parent().add_child(newGroundItem)
|
||||
|
||||
itemsDropped[nextDropLocationIndex] = newGroundItem
|
||||
|
||||
nextDropLocationIndex += 1
|
||||
if nextDropLocationIndex >= dropItemLocationOffsets.size():
|
||||
nextDropLocationIndex = 0
|
||||
get_tree().call_group("FlagManager", "Scavanged")
|
||||
|
||||
func initialize_items():
|
||||
for script in dropItemClasses:
|
||||
dropItems.append(script.new())
|
||||
|
||||
func initialize_dropped_items_array():
|
||||
for i in dropItemLocationOffsets:
|
||||
itemsDropped.append(null)
|
||||
1040
Interactions/Scavenging/scavengeable.tscn
Normal file
1040
Interactions/Scavenging/scavengeable.tscn
Normal file
File diff suppressed because one or more lines are too long
16
Interactions/Shopping/ShopHaver.gd
Normal file
16
Interactions/Shopping/ShopHaver.gd
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
extends Interaction
|
||||
|
||||
@onready var shopInterface:Window = $ShopInterface
|
||||
|
||||
var shopInventory = []
|
||||
|
||||
func _ready():
|
||||
add_action("Shop", open_shop)
|
||||
instantiate_shop_inventory()
|
||||
|
||||
func open_shop():
|
||||
shopInterface.popup_centered()
|
||||
shopInterface.opened()
|
||||
|
||||
func instantiate_shop_inventory():
|
||||
$ShopInterface.shopItems = shopInventory
|
||||
11
Interactions/Shopping/ShopHaver.tscn
Normal file
11
Interactions/Shopping/ShopHaver.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dkcbmgfe3yk6y"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://oe2gkhrdpuh2" path="res://Interactions/Interactable/interaction.tscn" id="1_2ps32"]
|
||||
[ext_resource type="Script" path="res://Interactions/Shopping/ShopHaver.gd" id="2_egsw3"]
|
||||
[ext_resource type="PackedScene" uid="uid://b52b85cx77aoq" path="res://UI/Shopping/ShopInterface.tscn" id="3_qdqe7"]
|
||||
|
||||
[node name="ShopHaver" instance=ExtResource("1_2ps32")]
|
||||
script = ExtResource("2_egsw3")
|
||||
|
||||
[node name="ShopInterface" parent="." index="0" instance=ExtResource("3_qdqe7")]
|
||||
visible = false
|
||||
24
Interactions/Shopping/VeggieStandShop.gd
Normal file
24
Interactions/Shopping/VeggieStandShop.gd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
extends "res://Interactions/Shopping/ShopHaver.gd"
|
||||
|
||||
func instantiate_shop_inventory():
|
||||
var turnip = load("res://Items/Foods/Veggie/Turnip.gd").new()
|
||||
var eggplant = load("res://Items/Foods/Veggie/Eggplant.gd").new()
|
||||
var carrot = load("res://Items/Foods/Veggie/Carrot.gd").new()
|
||||
var tomato = load("res://Items/Foods/Fruits/Tomato.gd").new()
|
||||
var broccoli = load("res://Items/Foods/Veggie/Broccoli.gd").new()
|
||||
var cucumber = load("res://Items/Foods/Veggie/Cucumber.gd").new()
|
||||
var corn = load("res://Items/Foods/Veggie/Corn.gd").new()
|
||||
var mustardSeed = load("res://Items/Foods/Seeds/MustardSeed.gd").new()
|
||||
|
||||
shopInventory = []
|
||||
|
||||
shopInventory.append(turnip)
|
||||
shopInventory.append(eggplant)
|
||||
shopInventory.append(carrot)
|
||||
shopInventory.append(tomato)
|
||||
shopInventory.append(broccoli)
|
||||
shopInventory.append(cucumber)
|
||||
shopInventory.append(corn)
|
||||
shopInventory.append(mustardSeed)
|
||||
|
||||
super.instantiate_shop_inventory()
|
||||
7
Interactions/Spinable/Spinable.gd
Normal file
7
Interactions/Spinable/Spinable.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
extends Interaction
|
||||
|
||||
func _ready():
|
||||
add_action("Spin", spin)
|
||||
|
||||
func spin():
|
||||
get_parent().spin()
|
||||
7
Interactions/Spinable/Spinable.tscn
Normal file
7
Interactions/Spinable/Spinable.tscn
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://1syjvoev4qjn"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_r5ach"]
|
||||
[ext_resource type="Script" path="res://Interactions/Spinable/Spinable.gd" id="2_awma5"]
|
||||
|
||||
[node name="Spinable" instance=ExtResource("1_r5ach")]
|
||||
script = ExtResource("2_awma5")
|
||||
10
Interactions/SunningRock/SunningRockInteration.gd
Normal file
10
Interactions/SunningRock/SunningRockInteration.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
extends Interaction
|
||||
|
||||
@onready var dryingInterface:Window = $DryingMenu
|
||||
|
||||
func _ready():
|
||||
add_action("Dry", open_drying_window)
|
||||
|
||||
func open_drying_window():
|
||||
dryingInterface.popup_centered()
|
||||
dryingInterface.opened()
|
||||
11
Interactions/SunningRock/SunningRockInteration.tscn
Normal file
11
Interactions/SunningRock/SunningRockInteration.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dcmfjvp8h6k33"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_t86f7"]
|
||||
[ext_resource type="Script" path="res://Interactions/SunningRock/SunningRockInteration.gd" id="2_fj5d5"]
|
||||
[ext_resource type="PackedScene" uid="uid://bmse1b3qcae7m" path="res://UI/Drying/DryingMenu.tscn" id="3_rpnda"]
|
||||
|
||||
[node name="SunningRockInteraction" instance=ExtResource("1_t86f7")]
|
||||
script = ExtResource("2_fj5d5")
|
||||
|
||||
[node name="DryingMenu" parent="." index="1" instance=ExtResource("3_rpnda")]
|
||||
visible = false
|
||||
11
Interactions/Talking/Talkable.gd
Normal file
11
Interactions/Talking/Talkable.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
extends Interaction
|
||||
|
||||
func _ready():
|
||||
add_action("Talk", talk)
|
||||
|
||||
func talk():
|
||||
var dialogue = get_parent().get_dialogue()
|
||||
|
||||
if dialogue != null:
|
||||
DialogueBoxManager.set_current_speaker(get_parent())
|
||||
DialogueBoxManager.start_dialogue(dialogue)
|
||||
7
Interactions/Talking/Talkable.tscn
Normal file
7
Interactions/Talking/Talkable.tscn
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://c31736waactb2"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_ugxae"]
|
||||
[ext_resource type="Script" path="res://Interactions/Talking/Talkable.gd" id="2_5c1kw"]
|
||||
|
||||
[node name="Talkable" instance=ExtResource("1_ugxae")]
|
||||
script = ExtResource("2_5c1kw")
|
||||
9
Interactions/Trampoline/Trampolinable.gd
Normal file
9
Interactions/Trampoline/Trampolinable.gd
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
extends Interaction
|
||||
|
||||
func _ready():
|
||||
add_action("Trampoline", ride)
|
||||
|
||||
func ride():
|
||||
GameVariables.player.change_state("Riding")
|
||||
GameVariables.player.play_animation("Idle")
|
||||
get_parent().ride()
|
||||
7
Interactions/Trampoline/Trampolinable.tscn
Normal file
7
Interactions/Trampoline/Trampolinable.tscn
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://b5bu1x4r3cyy6"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_yhpwg"]
|
||||
[ext_resource type="Script" path="res://Interactions/Trampoline/Trampolinable.gd" id="2_c0yg7"]
|
||||
|
||||
[node name="Trampolinable" instance=ExtResource("1_yhpwg")]
|
||||
script = ExtResource("2_c0yg7")
|
||||
14
Interactions/Travel/Traveller.gd
Normal file
14
Interactions/Travel/Traveller.gd
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
extends Interaction
|
||||
|
||||
@export var destinationNames:Array[String]
|
||||
@export var destinationLocations:Array[LocationManager.Locations]
|
||||
@export var destinationEntranceID:Array[int]
|
||||
|
||||
@export var movementVerb = "Walk To"
|
||||
|
||||
func _ready():
|
||||
for i in destinationNames.size():
|
||||
add_action(movementVerb + " " + destinationNames[i], movement.bind(i))
|
||||
|
||||
func movement(destinationIndex:int):
|
||||
LocationManager.changeLocation(destinationLocations[destinationIndex], destinationEntranceID[destinationIndex])
|
||||
10
Interactions/Travel/Traveller.tscn
Normal file
10
Interactions/Travel/Traveller.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dhmmocu2rnhov"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://oe2gkhrdpuh2" path="res://Interactions/Interactable/interaction.tscn" id="1_w7dtd"]
|
||||
[ext_resource type="Script" path="res://Interactions/Travel/Traveller.gd" id="2_ntso1"]
|
||||
|
||||
[node name="Traveller" instance=ExtResource("1_w7dtd")]
|
||||
script = ExtResource("2_ntso1")
|
||||
destinationNames = Array[String]([])
|
||||
destinationPaths = Array[String]([])
|
||||
destinationEntranceID = Array[String]([])
|
||||
67
Interactions/Travel/TutorialTraveller.gd
Normal file
67
Interactions/Travel/TutorialTraveller.gd
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
extends "res://Interactions/Travel/Traveller.gd"
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
for i in destinationNames.size():
|
||||
var actionMenu = get_parent().get_node("Interactable/ActionMenu")
|
||||
|
||||
var newID = actionMenu.add_action("Exit Tutorial Boat")
|
||||
actionMenu.action_selected.connect(action_chosen)
|
||||
|
||||
# Somehow confirm you want to exit
|
||||
|
||||
IDs.append(newID)
|
||||
actionFunctions.append(exit_tutorial.bind(0))
|
||||
|
||||
func exit_tutorial(_Deez):
|
||||
var remainingKnowledgers = []
|
||||
|
||||
if !SaveManager.get_save_value("tutorialAlligatorDone", false):
|
||||
remainingKnowledgers.append("Arson Alligator")
|
||||
|
||||
if !SaveManager.get_save_value("tutorialJaguarDone", false):
|
||||
remainingKnowledgers.append("Juicing Jaguar")
|
||||
|
||||
if !SaveManager.get_save_value("tutorialSheepDone", false):
|
||||
remainingKnowledgers.append("Scavenging Sheep")
|
||||
|
||||
if !SaveManager.get_save_value("tutorialToadDone", false):
|
||||
remainingKnowledgers.append("Trading Toad")
|
||||
|
||||
if !SaveManager.get_save_value("tutorialTapirDone", false):
|
||||
remainingKnowledgers.append("Tutorial Tapir")
|
||||
|
||||
var remainingMessage = ""
|
||||
for i in range(remainingKnowledgers.size()):
|
||||
var currentKnowledge = remainingKnowledgers[i]
|
||||
|
||||
if i > 0 and i == remainingKnowledgers.size() - 1:
|
||||
remainingMessage += "and "
|
||||
|
||||
remainingMessage += currentKnowledge
|
||||
|
||||
if i != remainingKnowledgers.size() - 1:
|
||||
if remainingKnowledgers.size() == 2:
|
||||
remainingMessage += " "
|
||||
else:
|
||||
remainingMessage += ", "
|
||||
|
||||
if remainingKnowledgers.size() > 0:
|
||||
if remainingKnowledgers.size() == 1:
|
||||
remainingMessage += " still has wisdom for you."
|
||||
else:
|
||||
remainingMessage += " still have wisdom for you."
|
||||
|
||||
if remainingKnowledgers.size() > 0:
|
||||
$Popup/VBoxContainer/TutorialPopupText.text = "Are you sure you want to leave?\n" + remainingMessage
|
||||
$Popup.popup_centered()
|
||||
$Popup.visible = true
|
||||
else:
|
||||
_on_confirm_pressed()
|
||||
|
||||
func _on_cancel_pressed():
|
||||
$Popup.visible = false
|
||||
|
||||
func _on_confirm_pressed():
|
||||
LocationManager.changeLocation(LocationManager.Locations.Pier,0)
|
||||
|
||||
9
Interactions/Weavable/Weavable.gd
Normal file
9
Interactions/Weavable/Weavable.gd
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
extends Interaction
|
||||
|
||||
func _ready():
|
||||
add_action("Weave", weave)
|
||||
|
||||
func weave():
|
||||
GameVariables.player.currentInteractingGroundItem = get_parent()
|
||||
GameVariables.player.weave_item(get_parent().item)
|
||||
|
||||
7
Interactions/Weavable/Weavable.tscn
Normal file
7
Interactions/Weavable/Weavable.tscn
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dxru24e0y16p2"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c5ded8kcouyci" path="res://Interactions/Interactable/interaction.tscn" id="1_cpdnf"]
|
||||
[ext_resource type="Script" path="res://Interactions/Weavable/Weavable.gd" id="2_d512x"]
|
||||
|
||||
[node name="Weavable" instance=ExtResource("1_cpdnf")]
|
||||
script = ExtResource("2_d512x")
|
||||
Loading…
Add table
Add a link
Reference in a new issue