Added new item assets and updated item holder placements. Also updated rover game loot table to only give Geodes but varying quantities. Big commit. my bad.

This commit is contained in:
akshay 2022-08-20 19:19:03 -04:00
parent a2998810c1
commit e433f3851b
89 changed files with 9691 additions and 46 deletions

BIN
assets/chip/Board.material Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
assets/chip/chip.glb Normal file

Binary file not shown.

1065
assets/chip/chip.glb.import Normal file

File diff suppressed because it is too large Load Diff

5
assets/chip/chip.tscn Normal file
View File

@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/chip/chip.glb" type="PackedScene" id=1]
[node name="chip" instance=ExtResource( 1 )]

Binary file not shown.

Binary file not shown.

BIN
assets/crystal/crystal.glb Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/crystal/crystal.glb" type="PackedScene" id=1]
[node name="crystal" instance=ExtResource( 1 )]

Binary file not shown.

BIN
assets/gem/gem.glb Normal file

Binary file not shown.

1065
assets/gem/gem.glb.import Normal file

File diff suppressed because it is too large Load Diff

5
assets/gem/gem.tscn Normal file
View File

@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/gem/gem.glb" type="PackedScene" id=1]
[node name="gem" instance=ExtResource( 1 )]

Binary file not shown.

BIN
assets/geode/Rocky.material Normal file

Binary file not shown.

BIN
assets/geode/geode.glb Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

5
assets/geode/geode.tscn Normal file
View File

@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/geode/geode.glb" type="PackedScene" id=1]
[node name="geode" instance=ExtResource( 1 )]

BIN
assets/ingot/Metal.material Normal file

Binary file not shown.

BIN
assets/ingot/ingot.glb Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

5
assets/ingot/ingot.tscn Normal file
View File

@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/ingot/ingot.glb" type="PackedScene" id=1]
[node name="ingot" instance=ExtResource( 1 )]

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/metal_plate/metal_plate.glb" type="PackedScene" id=1]
[node name="metal_plate" instance=ExtResource( 1 )]

BIN
assets/ore/Metal.material Normal file

Binary file not shown.

BIN
assets/ore/Rocky.material Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/repair_kit/repair_kit.glb" type="PackedScene" id=1]
[node name="repair_kit" instance=ExtResource( 1 )]

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/repair_kit_advanced/repair_kit_advanced.glb" type="PackedScene" id=1]
[node name="repair_kit_advanced" instance=ExtResource( 1 )]

BIN
assets/yam/Root.material Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/yam_cooked/yam_cooked.glb" type="PackedScene" id=1]
[node name="yam_cooked" instance=ExtResource( 1 )]

View File

@ -1,7 +1,7 @@
[gd_resource type="Resource" load_steps=3 format=2] [gd_resource type="Resource" load_steps=3 format=2]
[ext_resource path="res://scripts/ItemType.gd" type="Script" id=1] [ext_resource path="res://scripts/ItemType.gd" type="Script" id=1]
[ext_resource path="res://assets/yam/yam.tscn" type="PackedScene" id=2] [ext_resource path="res://assets/repair_kit_advanced/repair_kit_advanced.tscn" type="PackedScene" id=2]
[resource] [resource]
script = ExtResource( 1 ) script = ExtResource( 1 )

View File

@ -1,7 +1,7 @@
[gd_resource type="Resource" load_steps=3 format=2] [gd_resource type="Resource" load_steps=3 format=2]
[ext_resource path="res://scripts/ItemType.gd" type="Script" id=1] [ext_resource path="res://scripts/ItemType.gd" type="Script" id=1]
[ext_resource path="res://assets/ore/ore.tscn" type="PackedScene" id=2] [ext_resource path="res://assets/chip/chip.tscn" type="PackedScene" id=2]
[resource] [resource]
script = ExtResource( 1 ) script = ExtResource( 1 )

View File

@ -1,7 +1,7 @@
[gd_resource type="Resource" load_steps=3 format=2] [gd_resource type="Resource" load_steps=3 format=2]
[ext_resource path="res://scripts/ItemType.gd" type="Script" id=1] [ext_resource path="res://scripts/ItemType.gd" type="Script" id=1]
[ext_resource path="res://assets/yam/yam.tscn" type="PackedScene" id=2] [ext_resource path="res://assets/yam_cooked/yam_cooked.tscn" type="PackedScene" id=2]
[resource] [resource]
script = ExtResource( 1 ) script = ExtResource( 1 )

View File

@ -1,7 +1,7 @@
[gd_resource type="Resource" load_steps=3 format=2] [gd_resource type="Resource" load_steps=3 format=2]
[ext_resource path="res://scripts/ItemType.gd" type="Script" id=1] [ext_resource path="res://scripts/ItemType.gd" type="Script" id=1]
[ext_resource path="res://assets/ore/ore.tscn" type="PackedScene" id=2] [ext_resource path="res://assets/crystal/crystal.tscn" type="PackedScene" id=2]
[resource] [resource]
script = ExtResource( 1 ) script = ExtResource( 1 )

View File

@ -1,7 +1,7 @@
[gd_resource type="Resource" load_steps=3 format=2] [gd_resource type="Resource" load_steps=3 format=2]
[ext_resource path="res://scripts/ItemType.gd" type="Script" id=1] [ext_resource path="res://scripts/ItemType.gd" type="Script" id=1]
[ext_resource path="res://assets/ore/ore.tscn" type="PackedScene" id=2] [ext_resource path="res://assets/gem/gem.tscn" type="PackedScene" id=2]
[resource] [resource]
script = ExtResource( 1 ) script = ExtResource( 1 )

View File

@ -1,7 +1,7 @@
[gd_resource type="Resource" load_steps=3 format=2] [gd_resource type="Resource" load_steps=3 format=2]
[ext_resource path="res://scripts/ItemType.gd" type="Script" id=1] [ext_resource path="res://scripts/ItemType.gd" type="Script" id=1]
[ext_resource path="res://assets/ore/ore.tscn" type="PackedScene" id=2] [ext_resource path="res://assets/geode/geode.tscn" type="PackedScene" id=2]
[resource] [resource]
script = ExtResource( 1 ) script = ExtResource( 1 )

View File

@ -1,7 +1,7 @@
[gd_resource type="Resource" load_steps=3 format=2] [gd_resource type="Resource" load_steps=3 format=2]
[ext_resource path="res://scripts/ItemType.gd" type="Script" id=1] [ext_resource path="res://scripts/ItemType.gd" type="Script" id=1]
[ext_resource path="res://assets/ore/ore.tscn" type="PackedScene" id=2] [ext_resource path="res://assets/ingot/ingot.tscn" type="PackedScene" id=2]
[resource] [resource]
script = ExtResource( 1 ) script = ExtResource( 1 )

View File

@ -1,7 +1,7 @@
[gd_resource type="Resource" load_steps=3 format=2] [gd_resource type="Resource" load_steps=3 format=2]
[ext_resource path="res://scripts/ItemType.gd" type="Script" id=1] [ext_resource path="res://scripts/ItemType.gd" type="Script" id=1]
[ext_resource path="res://assets/ore/ore.tscn" type="PackedScene" id=2] [ext_resource path="res://assets/metal_plate/metal_plate.tscn" type="PackedScene" id=2]
[resource] [resource]
script = ExtResource( 1 ) script = ExtResource( 1 )

View File

@ -1,7 +1,7 @@
[gd_resource type="Resource" load_steps=3 format=2] [gd_resource type="Resource" load_steps=3 format=2]
[ext_resource path="res://scripts/ItemType.gd" type="Script" id=1] [ext_resource path="res://scripts/ItemType.gd" type="Script" id=1]
[ext_resource path="res://assets/yam/yam.tscn" type="PackedScene" id=2] [ext_resource path="res://assets/repair_kit/repair_kit.tscn" type="PackedScene" id=2]
[resource] [resource]
script = ExtResource( 1 ) script = ExtResource( 1 )

View File

@ -88,6 +88,11 @@ _global_script_classes=[ {
"class": "RecipeDB", "class": "RecipeDB",
"language": "GDScript", "language": "GDScript",
"path": "res://scripts/RecipeDB.gd" "path": "res://scripts/RecipeDB.gd"
}, {
"base": "Reference",
"class": "SimpleLootTable",
"language": "GDScript",
"path": "res://scripts/loot_table.gd"
} ] } ]
_global_script_class_icons={ _global_script_class_icons={
"DTS": "", "DTS": "",
@ -105,7 +110,8 @@ _global_script_class_icons={
"Interface": "", "Interface": "",
"ItemType": "", "ItemType": "",
"Recipe": "", "Recipe": "",
"RecipeDB": "" "RecipeDB": "",
"SimpleLootTable": ""
} }
[application] [application]

View File

@ -13,11 +13,11 @@ script = ExtResource( 2 )
start_broken = true start_broken = true
[node name="item_slot_1" parent="." groups=["crafting_item_slots"] instance=ExtResource( 1 )] [node name="item_slot_1" parent="." groups=["crafting_item_slots"] instance=ExtResource( 1 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.553907, -0.287795, 4.17596 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.059763, -0.115891, 4.15428 )
start_with_item = ExtResource( 6 ) start_with_item = ExtResource( 6 )
[node name="item_slot_2" parent="." groups=["crafting_item_slots"] instance=ExtResource( 1 )] [node name="item_slot_2" parent="." groups=["crafting_item_slots"] instance=ExtResource( 1 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.553907, -0.287795, 2.17596 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.059763, -0.115891, 2.15428 )
[node name="coin_machine" parent="." instance=ExtResource( 3 )] [node name="coin_machine" parent="." instance=ExtResource( 3 )]
unique_name_in_owner = true unique_name_in_owner = true

View File

@ -18,7 +18,7 @@ shape = SubResource( 4 )
[node name="item_holder" parent="." instance=ExtResource( 1 )] [node name="item_holder" parent="." instance=ExtResource( 1 )]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.776869, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0491054, 0.668364, 0.0490932 )
start_with_item = ExtResource( 3 ) start_with_item = ExtResource( 3 )
[connection signal="item_changed" from="item_holder" to="." method="_on_item_holder_item_changed"] [connection signal="item_changed" from="item_holder" to="." method="_on_item_holder_item_changed"]

View File

@ -14,10 +14,10 @@ script = ExtResource( 3 )
gen_item = ExtResource( 7 ) gen_item = ExtResource( 7 )
[node name="item_slot_1" parent="." groups=["conveyor_item_slots"] instance=ExtResource( 2 )] [node name="item_slot_1" parent="." groups=["conveyor_item_slots"] instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.42151, 0.596, -1.399 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.68704, 0.739615, -1.65247 )
[node name="item_slot_2" parent="." groups=["conveyor_item_slots"] instance=ExtResource( 2 )] [node name="item_slot_2" parent="." groups=["conveyor_item_slots"] instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 4.30446, 0.596, -1.399 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 4.05952, 0.74, -1.652 )
[node name="coin_machine" parent="." instance=ExtResource( 1 )] [node name="coin_machine" parent="." instance=ExtResource( 1 )]
unique_name_in_owner = true unique_name_in_owner = true

View File

@ -16,7 +16,7 @@ script = ExtResource( 2 )
shape = SubResource( 4 ) shape = SubResource( 4 )
[node name="ItemSpawn" type="Spatial" parent="."] [node name="ItemSpawn" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.372095, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0809823, 0 )
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 1 ) stream = ExtResource( 1 )

View File

@ -92,6 +92,9 @@ __meta__ = {
[node name="CollisionShape" parent="Level/Wall_Shortest Y2/Wall_Shortest Y2" index="0"] [node name="CollisionShape" parent="Level/Wall_Shortest Y2/Wall_Shortest Y2" index="0"]
transform = Transform( 1, 0, -7.45058e-09, 0, 1, 0, 0, 0, 1, -0.0327864, -5.72205e-06, 0.855087 ) transform = Transform( 1, 0, -7.45058e-09, 0, 1, 0, 0, 0, 1, -0.0327864, -5.72205e-06, 0.855087 )
[node name="Wall_Slightly Shorter0173" parent="Level/Wall_Slightly Shorter_With Moulding002" index="2"]
transform = Transform( 1, 0, -7.45058e-09, 0, 1, 0, 0, 0, 0.2, 0, 0, 0 )
[node name="Player" parent="." instance=ExtResource( 3 )] [node name="Player" parent="." instance=ExtResource( 3 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 4.35996 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 4.35996 )
hunger_tick_time = 75.0 hunger_tick_time = 75.0
@ -285,27 +288,27 @@ modulate = Color( 0, 0, 0, 1 )
text = "Storage" text = "Storage"
[node name="item_holder" parent="Storage_Room" instance=ExtResource( 17 )] [node name="item_holder" parent="Storage_Room" instance=ExtResource( 17 )]
transform = Transform( 0.0379867, 0, 0.999278, 0, 1, 0, -0.999278, 0, 0.0379867, 0.595225, 1.14717, -8.87313 ) transform = Transform( 0.0379867, 0, 0.999278, 0, 1, 0, -0.999278, 0, 0.0379867, 0.595, 1.032, -8.873 )
start_with_item = ExtResource( 22 ) start_with_item = ExtResource( 22 )
[node name="item_holder2" parent="Storage_Room" instance=ExtResource( 17 )] [node name="item_holder2" parent="Storage_Room" instance=ExtResource( 17 )]
transform = Transform( 0.0379867, 0, 0.999278, 0, 1, 0, -0.999278, 0, 0.0379867, 3.18382, 0.988555, -8.65995 ) transform = Transform( 0.0379867, 0, 0.999278, 0, 1, 0, -0.999278, 0, 0.0379867, 3.18382, 1.03248, -8.65997 )
[node name="item_holder3" parent="Storage_Room" instance=ExtResource( 17 )] [node name="item_holder3" parent="Storage_Room" instance=ExtResource( 17 )]
transform = Transform( 0.0379867, 0, 0.999278, 0, 1, 0, -0.999278, 0, 0.0379867, -4.36385, 0.909436, -9.93777 ) transform = Transform( 0.0379867, 0, 0.999278, 0, 1, 0, -0.999278, 0, 0.0379867, -4.45302, 0.685581, -9.83969 )
[node name="item_holder4" parent="Storage_Room" instance=ExtResource( 17 )] [node name="item_holder4" parent="Storage_Room" instance=ExtResource( 17 )]
transform = Transform( 0.0379867, 0, 0.999278, 0, 1, 0, -0.999278, 0, 0.0379867, -4.17989, 1.15542, -5.03403 ) transform = Transform( 0.0379867, 0, 0.999278, 0, 1, 0, -0.999278, 0, 0.0379867, -4.16387, 1.032, -5.06669 )
start_with_item = ExtResource( 22 ) start_with_item = ExtResource( 22 )
[node name="item_holder5" parent="Storage_Room" instance=ExtResource( 17 )] [node name="item_holder5" parent="Storage_Room" instance=ExtResource( 17 )]
transform = Transform( 0.0379867, 0, 0.999278, 0, 1, 0, -0.999278, 0, 0.0379867, 4.6338, 1.01416, -9.90946 ) transform = Transform( 0.0379867, 0, 0.999278, 0, 1, 0, -0.999278, 0, 0.0379867, 4.59934, 1.032, -9.89562 )
[node name="item_holder6" parent="Storage_Room" instance=ExtResource( 17 )] [node name="item_holder6" parent="Storage_Room" instance=ExtResource( 17 )]
transform = Transform( 0.0379867, 0, 0.999278, 0, 1, 0, -0.999278, 0, 0.0379867, 3.84102, 0.99789, -4.52361 ) transform = Transform( 0.0379867, 0, 0.999278, 0, 1, 0, -0.999278, 0, 0.0379867, 3.841, 1.032, -4.524 )
[node name="item_holder7" parent="Storage_Room" instance=ExtResource( 17 )] [node name="item_holder7" parent="Storage_Room" instance=ExtResource( 17 )]
transform = Transform( 0.0341881, 0, 0.89935, 0, 0.9, 0, -0.89935, 0, 0.0341881, -2.50595, 1.21779, -9.91222 ) transform = Transform( 0.0341881, 0, 0.89935, 0, 0.9, 0, -0.89935, 0, 0.0341881, -2.55355, 1.032, -10.2179 )
[node name="Crafting_Room" type="Spatial" parent="."] [node name="Crafting_Room" type="Spatial" parent="."]
transform = Transform( -0.668793, 0, -0.743448, 0, 1, 0, 0.743448, 0, -0.668793, 6.10625, 0, 6.11932 ) transform = Transform( -0.668793, 0, -0.743448, 0, 1, 0, 0.743448, 0, -0.668793, 6.10625, 0, 6.11932 )
@ -328,6 +331,12 @@ visible = false
modulate = Color( 0, 0, 0, 1 ) modulate = Color( 0, 0, 0, 1 )
text = "TRANSFORMATRON" text = "TRANSFORMATRON"
[node name="item_holder" parent="Crafting_Room" instance=ExtResource( 17 )]
transform = Transform( 0.0379863, 0, 0.999279, 0, 1, 0, -0.999279, 0, 0.0379863, 4.67479, 0.817799, -9.1295 )
[node name="item_holder5" parent="Crafting_Room" instance=ExtResource( 17 )]
transform = Transform( 0.0379864, 0, 0.999278, 0, 1, 0, -0.999278, 0, 0.0379864, -5.01753, 1.20905, -9.643 )
[node name="Bed_Room" type="Spatial" parent="."] [node name="Bed_Room" type="Spatial" parent="."]
transform = Transform( -0.999913, 0, 0.0131247, 0, 1, 0, -0.0131247, 0, -0.999913, -0.0536704, 0, 23.0231 ) transform = Transform( -0.999913, 0, 0.0131247, 0, 1, 0, -0.0131247, 0, -0.999913, -0.0536704, 0, 23.0231 )
@ -402,7 +411,6 @@ transform = Transform( -0.707107, 0, 0.707107, 0, 1, 0, -0.707107, 0, -0.707107,
[node name="CanvasLayer" type="CanvasLayer" parent="."] [node name="CanvasLayer" type="CanvasLayer" parent="."]
pause_mode = 1 pause_mode = 1
visible = false
[node name="cheat_menu" parent="CanvasLayer" instance=ExtResource( 18 )] [node name="cheat_menu" parent="CanvasLayer" instance=ExtResource( 18 )]

View File

@ -27,7 +27,7 @@ item_count_1 = 1
[node name="item_holder" parent="." instance=ExtResource( 1 )] [node name="item_holder" parent="." instance=ExtResource( 1 )]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.14052, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.978129, 0 )
[node name="CollisionShape" type="CollisionShape" parent="item_holder"] [node name="CollisionShape" type="CollisionShape" parent="item_holder"]
shape = SubResource( 4 ) shape = SubResource( 4 )

View File

@ -714,7 +714,7 @@ mesh = SubResource( 1 )
skin = SubResource( 2 ) skin = SubResource( 2 )
[node name="head_bone" type="BoneAttachment" parent="model_transform/DungMan/Armature/Skeleton" index="1"] [node name="head_bone" type="BoneAttachment" parent="model_transform/DungMan/Armature/Skeleton" index="1"]
transform = Transform( 1, -2.19238e-16, 3.51804e-17, -3.23758e-21, 0.158425, 0.987371, -2.22043e-16, -0.987371, 0.158425, -3.30314e-16, -0.0788449, -1.5077 ) transform = Transform( 1, -2.21304e-16, -1.10964e-17, 1.63982e-18, -0.0426856, 0.999088, -2.21576e-16, -0.999088, -0.0426856, -3.31142e-16, -0.0537476, -1.50833 )
bone_name = "Item" bone_name = "Item"
[node name="ItemSpawn" type="Spatial" parent="model_transform/DungMan/Armature/Skeleton/head_bone"] [node name="ItemSpawn" type="Spatial" parent="model_transform/DungMan/Armature/Skeleton/head_bone"]

View File

@ -1,12 +1,9 @@
[gd_scene load_steps=14 format=2] [gd_scene load_steps=11 format=2]
[ext_resource path="res://scenes/rover.tscn" type="PackedScene" id=1] [ext_resource path="res://scenes/rover.tscn" type="PackedScene" id=1]
[ext_resource path="res://item_types/crystal.tres" type="Resource" id=2]
[ext_resource path="res://item_types/gem.tres" type="Resource" id=3]
[ext_resource path="res://assets/rover_level/RoverGame.glb" type="PackedScene" id=4] [ext_resource path="res://assets/rover_level/RoverGame.glb" type="PackedScene" id=4]
[ext_resource path="res://scripts/rover_camera.gd" type="Script" id=5] [ext_resource path="res://scripts/rover_camera.gd" type="Script" id=5]
[ext_resource path="res://scripts/rover_game.gd" type="Script" id=6] [ext_resource path="res://scripts/rover_game.gd" type="Script" id=6]
[ext_resource path="res://item_types/geode.tres" type="Resource" id=7]
[ext_resource path="res://assets/rover_level/Material_002.material" type="Material" id=8] [ext_resource path="res://assets/rover_level/Material_002.material" type="Material" id=8]
[ext_resource path="res://assets/rover_level/Arrow_MAT.tres" type="Material" id=9] [ext_resource path="res://assets/rover_level/Arrow_MAT.tres" type="Material" id=9]
@ -44,8 +41,10 @@ surfaces/0 = {
[node name="rover_game" type="Spatial"] [node name="rover_game" type="Spatial"]
script = ExtResource( 6 ) script = ExtResource( 6 )
arrow_viz_distance = 15.0 arrow_viz_distance = 15.0
loot_items = [ ExtResource( 7 ), ExtResource( 2 ), ExtResource( 3 ) ] geode_loot_count_per_chance = {
loot_weights = [ 60, 25, 15 ] 1: 40,
2: 60
}
[node name="RoverGame" parent="." instance=ExtResource( 4 )] [node name="RoverGame" parent="." instance=ExtResource( 4 )]
__meta__ = { __meta__ = {

View File

@ -1,16 +1,17 @@
extends Reference extends Reference
class_name SimpleLootTable
var item_map = {} var item_map = {}
var total_weight = 0 var total_weight = 0
func _init(items, weights): func _init(in_item_map : Dictionary):
item_map.clear() item_map.clear()
total_weight = 0
# Calculate total weight and accumulate the weight for each item # Calculate total weight and accumulate the weight for each item
for i in items.size(): for key in in_item_map.keys():
total_weight += weights[i] total_weight += in_item_map[key]
var item : Resource = items[i] item_map[key] = total_weight
assert(item != null)
item_map[item] = total_weight
func roll_for_loot() -> Resource: func roll_for_loot() -> Resource:
randomize() randomize()

View File

@ -1,6 +1,6 @@
extends RigidBody extends RigidBody
export var treasure: Resource export var treasure_count : int = 1;
func _ready(): func _ready():
$hit_box.set_meta("owner", self) $hit_box.set_meta("owner", self)

View File

@ -6,19 +6,20 @@ signal got_treasure(item_type)
const LootTable = preload("res://scripts/loot_table.gd") const LootTable = preload("res://scripts/loot_table.gd")
const RockScene = preload("res://scenes/rock.tscn") const RockScene = preload("res://scenes/rock.tscn")
const GeodeResource = preload("res://item_types/geode.tres")
onready var timer : Timer = $Timer onready var timer : Timer = $Timer
onready var rover = $"%rover" onready var rover = $"%rover"
onready var level_arrow = $"%LevelArrow" onready var level_arrow = $"%LevelArrow"
export var play_time: float = 20.0 export var play_time: float = 20.0
export var arrow_viz_distance = 10.0 export var arrow_viz_distance = 10.0
export (Array,Resource) var loot_items = [] export var geode_loot_count_per_chance = {}
export (Array,int) var loot_weights = []
var loot_table = null var loot_table : SimpleLootTable = null
func _ready(): func _ready():
loot_table = LootTable.new(loot_items, loot_weights) loot_table = LootTable.new(geode_loot_count_per_chance)
timer.start(play_time) timer.start(play_time)
spawn_rocks(10) spawn_rocks(10)
@ -28,14 +29,14 @@ func spawn_rocks(count: int):
for i in range(min(count, locations.size())): for i in range(min(count, locations.size())):
var location = locations[i] var location = locations[i]
var rock = RockScene.instance() var rock = RockScene.instance()
rock.treasure = loot_table.roll_for_loot() rock.treasure_count = loot_table.roll_for_loot()
assert(rock.treasure != null)
location.add_child(rock) location.add_child(rock)
func _on_collection_area_area_entered(area): func _on_collection_area_area_entered(area):
if area.has_meta("owner"): if area.has_meta("owner"):
area = area.get_meta("owner") area = area.get_meta("owner")
emit_signal("got_treasure", area.treasure) for i in area.treasure_count:
emit_signal("got_treasure", GeodeResource)
area.queue_free() area.queue_free()
func _process(delta): func _process(delta):