From b682981a264441ff62c45916e02eb8ad3e030973 Mon Sep 17 00:00:00 2001 From: Nekojimi Date: Mon, 12 May 2025 11:21:38 +0100 Subject: [PATCH] Add item pile object. --- objects/ItemPile.tscn | 52 +++++++++++++++++++++ scripts/item_pile.gd | 97 ++++++++++++++++++++++++++++++++++++++++ scripts/item_pile.gd.uid | 1 + 3 files changed, 150 insertions(+) create mode 100644 objects/ItemPile.tscn create mode 100644 scripts/item_pile.gd create mode 100644 scripts/item_pile.gd.uid diff --git a/objects/ItemPile.tscn b/objects/ItemPile.tscn new file mode 100644 index 0000000..6b630c0 --- /dev/null +++ b/objects/ItemPile.tscn @@ -0,0 +1,52 @@ +[gd_scene load_steps=8 format=3 uid="uid://b7jafay5r2ym5"] + +[ext_resource type="Script" uid="uid://b742u7cr6efqm" path="res://scripts/item_pile.gd" id="1_tosru"] +[ext_resource type="Resource" uid="uid://dbkxys3mr5u80" path="res://items/metal.tres" id="2_gcf8n"] +[ext_resource type="ArrayMesh" uid="uid://c6yj8uwsgqxv0" path="res://assets/models/Ingot.obj" id="3_ct4c2"] +[ext_resource type="Script" uid="uid://c4fquatkjmsgu" path="res://scripts/building_components/producer.gd" id="4_gcf8n"] + +[sub_resource type="CylinderMesh" id="CylinderMesh_gcf8n"] +top_radius = 0.0 +bottom_radius = 1.0 +height = 1.0 +radial_segments = 8 +rings = 1 +cap_top = false +cap_bottom = false + +[sub_resource type="CylinderShape3D" id="CylinderShape3D_suxjt"] +height = 1.0 +radius = 1.5 + +[sub_resource type="MultiMesh" id="MultiMesh_gcf8n"] +transform_format = 1 +instance_count = 321 +visible_instance_count = 321 +mesh = ExtResource("3_ct4c2") +buffer = PackedFloat32Array(1, 0, 0, 0, 0, 1, 0, 1.65901, 0, 0, 1, 0, 1, 0, 0, 0.182632, 0, 1, 0, 1.49598, 0, 0, 1, 0.316328, 1, 0, 0, -0.182632, 0, 1, 0, 1.49598, 0, 0, 1, 0.316328, 1, 0, 0, -0.365265, 0, 1, 0, 1.49598, 0, 0, 1, 1.34196e-16, 1, 0, 0, -0.182632, 0, 1, 0, 1.49598, 0, 0, 1, -0.316328, 1, 0, 0, 0.182632, 0, 1, 0, 1.49598, 0, 0, 1, -0.316328, 1, 0, 0, 0.365265, 0, 1, 0, 1.49598, 0, 0, 1, 4.69912e-16, 1, 0, 0, 0.632657, 0, 1, 0, 1.33294, 0, 0, 1, 0.365265, 1, 0, 0, 0.365265, 0, 1, 0, 1.33294, 0, 0, 1, 0.632657, 1, 0, 0, 4.02588e-16, 0, 1, 0, 1.33294, 0, 0, 1, 0.730529, 1, 0, 0, -0.365265, 0, 1, 0, 1.33294, 0, 0, 1, 0.632657, 1, 0, 0, -0.632657, 0, 1, 0, 1.33294, 0, 0, 1, 0.365265, 1, 0, 0, -0.730529, 0, 1, 0, 1.33294, 0, 0, 1, 1.745e-15, 1, 0, 0, -0.632657, 0, 1, 0, 1.33294, 0, 0, 1, -0.365265, 1, 0, 0, -0.365265, 0, 1, 0, 1.33294, 0, 0, 1, -0.632657, 1, 0, 0, -1.78973e-15, 0, 1, 0, 1.33294, 0, 0, 1, -0.730529, 1, 0, 0, 0.365265, 0, 1, 0, 1.33294, 0, 0, 1, -0.632657, 1, 0, 0, 0.632657, 0, 1, 0, 1.33294, 0, 0, 1, -0.365265, 1, 0, 0, 0.730529, 0, 1, 0, 1.33294, 0, 0, 1, -3.13215e-15, 1, 0, 0, 1.02971, 0, 1, 0, 1.1699, 0, 0, 1, 0.374784, 1, 0, 0, 0.839427, 0, 1, 0, 1.1699, 0, 0, 1, 0.704363, 1, 0, 0, 0.547897, 0, 1, 0, 1.1699, 0, 0, 1, 0.948986, 1, 0, 0, 0.190283, 0, 1, 0, 1.1699, 0, 0, 1, 1.07915, 1, 0, 0, -0.190283, 0, 1, 0, 1.1699, 0, 0, 1, 1.07915, 1, 0, 0, -0.547897, 0, 1, 0, 1.1699, 0, 0, 1, 0.948986, 1, 0, 0, -0.839427, 0, 1, 0, 1.1699, 0, 0, 1, 0.704363, 1, 0, 0, -1.02971, 0, 1, 0, 1.1699, 0, 0, 1, 0.374784, 1, 0, 0, -1.09579, 0, 1, 0, 1.1699, 0, 0, 1, 8.72546e-15, 1, 0, 0, -1.02971, 0, 1, 0, 1.1699, 0, 0, 1, -0.374784, 1, 0, 0, -0.839427, 0, 1, 0, 1.1699, 0, 0, 1, -0.704363, 1, 0, 0, -0.547897, 0, 1, 0, 1.1699, 0, 0, 1, -0.948986, 1, 0, 0, -0.190283, 0, 1, 0, 1.1699, 0, 0, 1, -1.07915, 1, 0, 0, 0.190283, 0, 1, 0, 1.1699, 0, 0, 1, -1.07915, 1, 0, 0, 0.547897, 0, 1, 0, 1.1699, 0, 0, 1, -0.948986, 1, 0, 0, 0.839427, 0, 1, 0, 1.1699, 0, 0, 1, -0.704363, 1, 0, 0, 1.02971, 0, 1, 0, 1.1699, 0, 0, 1, -0.374784, 1, 0, 0, 1.09579, 0, 1, 0, 1.1699, 0, 0, 1, -1.27527e-14, 1, 0, 0, 1.40688, 0, 1, 0, 1.00686, 0, 0, 1, 0.394189, 1, 0, 0, 1.24836, 0, 1, 0, 1.00686, 0, 0, 1, 0.759143, 1, 0, 0, 0.99725, 0, 1, 0, 1.00686, 0, 0, 1, 1.06779, 1, 0, 0, 0.672182, 0, 1, 0, 1.00686, 0, 0, 1, 1.29725, 1, 0, 0, 0.297261, 0, 1, 0, 1.00686, 0, 0, 1, 1.4305, 1, 0, 0, -0.0997062, 0, 1, 0, 1.00686, 0, 0, 1, 1.45765, 1, 0, 0, -0.489279, 0, 1, 0, 1.00686, 0, 0, 1, 1.3767, 1, 0, 0, -0.842564, 0, 1, 0, 1.00686, 0, 0, 1, 1.19364, 1, 0, 0, -1.13336, 0, 1, 0, 1.00686, 0, 0, 1, 0.922057, 1, 0, 0, -1.3401, 0, 1, 0, 1.00686, 0, 0, 1, 0.582087, 1, 0, 0, -1.44745, 0, 1, 0, 1.00686, 0, 0, 1, 0.198947, 1, 0, 0, -1.44745, 0, 1, 0, 1.00686, 0, 0, 1, -0.198947, 1, 0, 0, -1.3401, 0, 1, 0, 1.00686, 0, 0, 1, -0.582087, 1, 0, 0, -1.13336, 0, 1, 0, 1.00686, 0, 0, 1, -0.922057, 1, 0, 0, -0.842564, 0, 1, 0, 1.00686, 0, 0, 1, -1.19364, 1, 0, 0, -0.489279, 0, 1, 0, 1.00686, 0, 0, 1, -1.3767, 1, 0, 0, -0.0997062, 0, 1, 0, 1.00686, 0, 0, 1, -1.45765, 1, 0, 0, 0.297261, 0, 1, 0, 1.00686, 0, 0, 1, -1.4305, 1, 0, 0, 0.672182, 0, 1, 0, 1.00686, 0, 0, 1, -1.29725, 1, 0, 0, 0.99725, 0, 1, 0, 1.00686, 0, 0, 1, -1.06779, 1, 0, 0, 1.24836, 0, 1, 0, 1.00686, 0, 0, 1, -0.759143, 1, 0, 0, 1.40688, 0, 1, 0, 1.00686, 0, 0, 1, -0.394189, 1, 0, 0, 1.46106, 0, 1, 0, 1.00686, 0, 0, 1, 8.59217e-15, 1, 0, 0, 1.78363, 0, 1, 0, 0.843819, 0, 0, 1, 0.392606, 1, 0, 0, 1.65753, 0, 1, 0, 0.843819, 0, 0, 1, 0.766853, 1, 0, 0, 1.45392, 0, 1, 0, 0.843819, 0, 0, 1, 1.10524, 1, 0, 0, 1.18234, 0, 1, 0, 0.843819, 0, 0, 1, 1.39195, 1, 0, 0, 0.855465, 0, 1, 0, 0.843819, 0, 0, 1, 1.61358, 1, 0, 0, 0.488593, 0, 1, 0, 0.843819, 0, 0, 1, 1.75975, 1, 0, 0, 0.0988752, 0, 1, 0, 0.843819, 0, 0, 1, 1.82364, 1, 0, 0, -0.295466, 0, 1, 0, 0.843819, 0, 0, 1, 1.80226, 1, 0, 0, -0.675992, 0, 1, 0, 0.843819, 0, 0, 1, 1.69661, 1, 0, 0, -1.02491, 0, 1, 0, 0.843819, 0, 0, 1, 1.51163, 1, 0, 0, -1.3259, 0, 1, 0, 0.843819, 0, 0, 1, 1.25596, 1, 0, 0, -1.5649, 0, 1, 0, 0.843819, 0, 0, 1, 0.941568, 1, 0, 0, -1.73072, 0, 1, 0, 0.843819, 0, 0, 1, 0.583148, 1, 0, 0, -1.81562, 0, 1, 0, 0.843819, 0, 0, 1, 0.19746, 1, 0, 0, -1.81562, 0, 1, 0, 0.843819, 0, 0, 1, -0.19746, 1, 0, 0, -1.73072, 0, 1, 0, 0.843819, 0, 0, 1, -0.583148, 1, 0, 0, -1.5649, 0, 1, 0, 0.843819, 0, 0, 1, -0.941568, 1, 0, 0, -1.3259, 0, 1, 0, 0.843819, 0, 0, 1, -1.25596, 1, 0, 0, -1.02491, 0, 1, 0, 0.843819, 0, 0, 1, -1.51163, 1, 0, 0, -0.675992, 0, 1, 0, 0.843819, 0, 0, 1, -1.69661, 1, 0, 0, -0.295466, 0, 1, 0, 0.843819, 0, 0, 1, -1.80226, 1, 0, 0, 0.0988752, 0, 1, 0, 0.843819, 0, 0, 1, -1.82364, 1, 0, 0, 0.488593, 0, 1, 0, 0.843819, 0, 0, 1, -1.75975, 1, 0, 0, 0.855465, 0, 1, 0, 0.843819, 0, 0, 1, -1.61358, 1, 0, 0, 1.18234, 0, 1, 0, 0.843819, 0, 0, 1, -1.39195, 1, 0, 0, 1.45392, 0, 1, 0, 0.843819, 0, 0, 1, -1.10524, 1, 0, 0, 1.65753, 0, 1, 0, 0.843819, 0, 0, 1, -0.766853, 1, 0, 0, 1.78363, 0, 1, 0, 0.843819, 0, 0, 1, -0.392606, 1, 0, 0, 1.82632, 0, 1, 0, 0.843819, 0, 0, 1, 6.22001e-14, 1, 0, 0, 2.15637, 0, 1, 0, 0.68078, 0, 0, 1, 0.391323, 1, 0, 0, 2.05184, 0, 1, 0, 0.68078, 0, 0, 1, 0.770069, 1, 0, 0, 1.88137, 0, 1, 0, 0.68078, 0, 0, 1, 1.12406, 1, 0, 0, 1.65042, 0, 1, 0, 0.68078, 0, 0, 1, 1.44193, 1, 0, 0, 1.36643, 0, 1, 0, 0.68078, 0, 0, 1, 1.71345, 1, 0, 0, 1.03852, 0, 1, 0, 0.68078, 0, 0, 1, 1.9299, 1, 0, 0, 0.677238, 0, 1, 0, 0.68078, 0, 0, 1, 2.08432, 1, 0, 0, 0.294184, 0, 1, 0, 0.68078, 0, 0, 1, 2.17175, 1, 0, 0, -0.0983252, 0, 1, 0, 0.68078, 0, 0, 1, 2.18938, 1, 0, 0, -0.487674, 0, 1, 0, 0.68078, 0, 0, 1, 2.13664, 1, 0, 0, -0.861349, 0, 1, 0, 0.68078, 0, 0, 1, 2.01523, 1, 0, 0, -1.20734, 0, 1, 0, 0.68078, 0, 0, 1, 1.82904, 1, 0, 0, -1.51452, 0, 1, 0, 0.68078, 0, 0, 1, 1.58407, 1, 0, 0, -1.77303, 0, 1, 0, 0.68078, 0, 0, 1, 1.28818, 1, 0, 0, -1.97455, 0, 1, 0, 0.68078, 0, 0, 1, 0.950894, 1, 0, 0, -2.11261, 0, 1, 0, 0.68078, 0, 0, 1, 0.583043, 1, 0, 0, -2.18277, 0, 1, 0, 0.68078, 0, 0, 1, 0.196452, 1, 0, 0, -2.18277, 0, 1, 0, 0.68078, 0, 0, 1, -0.196452, 1, 0, 0, -2.11261, 0, 1, 0, 0.68078, 0, 0, 1, -0.583043, 1, 0, 0, -1.97455, 0, 1, 0, 0.68078, 0, 0, 1, -0.950894, 1, 0, 0, -1.77303, 0, 1, 0, 0.68078, 0, 0, 1, -1.28818, 1, 0, 0, -1.51452, 0, 1, 0, 0.68078, 0, 0, 1, -1.58407, 1, 0, 0, -1.20734, 0, 1, 0, 0.68078, 0, 0, 1, -1.82904, 1, 0, 0, -0.861349, 0, 1, 0, 0.68078, 0, 0, 1, -2.01523, 1, 0, 0, -0.487674, 0, 1, 0, 0.68078, 0, 0, 1, -2.13664, 1, 0, 0, -0.0983252, 0, 1, 0, 0.68078, 0, 0, 1, -2.18938, 1, 0, 0, 0.294184, 0, 1, 0, 0.68078, 0, 0, 1, -2.17175, 1, 0, 0, 0.677238, 0, 1, 0, 0.68078, 0, 0, 1, -2.08432, 1, 0, 0, 1.03852, 0, 1, 0, 0.68078, 0, 0, 1, -1.9299, 1, 0, 0, 1.36643, 0, 1, 0, 0.68078, 0, 0, 1, -1.71345, 1, 0, 0, 1.65042, 0, 1, 0, 0.68078, 0, 0, 1, -1.44193, 1, 0, 0, 1.88137, 0, 1, 0, 0.68078, 0, 0, 1, -1.12406, 1, 0, 0, 2.05184, 0, 1, 0, 0.68078, 0, 0, 1, -0.770069, 1, 0, 0, 2.15637, 0, 1, 0, 0.68078, 0, 0, 1, -0.391323, 1, 0, 0, 2.19159, 0, 1, 0, 0.68078, 0, 0, 1, 7.41034e-14, 1, 0, 0, 2.52689, 0, 1, 0, 0.517741, 0, 0, 1, 0.390302, 1, 0, 0, 2.43769, 0, 1, 0, 0.517741, 0, 0, 1, 0.771455, 1, 0, 0, 2.29136, 0, 1, 0, 0.517741, 0, 0, 1, 1.13453, 1, 0, 0, 2.09133, 0, 1, 0, 0.517741, 0, 0, 1, 1.47101, 1, 0, 0, 1.84227, 0, 1, 0, 0.517741, 0, 0, 1, 1.773, 1, 0, 0, 1.55003, 0, 1, 0, 0.517741, 0, 0, 1, 2.03345, 1, 0, 0, 1.22146, 0, 1, 0, 0.517741, 0, 0, 1, 2.24623, 1, 0, 0, 0.864259, 0, 1, 0, 0.517741, 0, 0, 1, 2.40636, 1, 0, 0, 0.486802, 0, 1, 0, 0.517741, 0, 0, 1, 2.51008, 1, 0, 0, 0.0979345, 0, 1, 0, 0.517741, 0, 0, 1, 2.55498, 1, 0, 0, -0.293229, 0, 1, 0, 0.517741, 0, 0, 1, 2.53998, 1, 0, 0, -0.677519, 0, 1, 0, 0.517741, 0, 0, 1, 2.46545, 1, 0, 0, -1.04593, 0, 1, 0, 0.517741, 0, 0, 1, 2.33314, 1, 0, 0, -1.38982, 0, 1, 0, 0.517741, 0, 0, 1, 2.14613, 1, 0, 0, -1.70114, 0, 1, 0, 0.517741, 0, 0, 1, 1.90883, 1, 0, 0, -1.97258, 0, 1, 0, 0.517741, 0, 0, 1, 1.62678, 1, 0, 0, -2.19779, 0, 1, 0, 0.517741, 0, 0, 1, 1.3066, 1, 0, 0, -2.37149, 0, 1, 0, 0.517741, 0, 0, 1, 0.955795, 1, 0, 0, -2.4896, 0, 1, 0, 0.517741, 0, 0, 1, 0.582588, 1, 0, 0, -2.54935, 0, 1, 0, 0.517741, 0, 0, 1, 0.195725, 1, 0, 0, -2.54935, 0, 1, 0, 0.517741, 0, 0, 1, -0.195725, 1, 0, 0, -2.4896, 0, 1, 0, 0.517741, 0, 0, 1, -0.582588, 1, 0, 0, -2.37149, 0, 1, 0, 0.517741, 0, 0, 1, -0.955795, 1, 0, 0, -2.19779, 0, 1, 0, 0.517741, 0, 0, 1, -1.3066, 1, 0, 0, -1.97258, 0, 1, 0, 0.517741, 0, 0, 1, -1.62678, 1, 0, 0, -1.70114, 0, 1, 0, 0.517741, 0, 0, 1, -1.90883, 1, 0, 0, -1.38982, 0, 1, 0, 0.517741, 0, 0, 1, -2.14613, 1, 0, 0, -1.04593, 0, 1, 0, 0.517741, 0, 0, 1, -2.33314, 1, 0, 0, -0.677519, 0, 1, 0, 0.517741, 0, 0, 1, -2.46545, 1, 0, 0, -0.293229, 0, 1, 0, 0.517741, 0, 0, 1, -2.53998, 1, 0, 0, 0.0979345, 0, 1, 0, 0.517741, 0, 0, 1, -2.55498, 1, 0, 0, 0.486802, 0, 1, 0, 0.517741, 0, 0, 1, -2.51008, 1, 0, 0, 0.864259, 0, 1, 0, 0.517741, 0, 0, 1, -2.40636, 1, 0, 0, 1.22146, 0, 1, 0, 0.517741, 0, 0, 1, -2.24623, 1, 0, 0, 1.55003, 0, 1, 0, 0.517741, 0, 0, 1, -2.03345, 1, 0, 0, 1.84227, 0, 1, 0, 0.517741, 0, 0, 1, -1.773, 1, 0, 0, 2.09133, 0, 1, 0, 0.517741, 0, 0, 1, -1.47101, 1, 0, 0, 2.29136, 0, 1, 0, 0.517741, 0, 0, 1, -1.13453, 1, 0, 0, 2.43769, 0, 1, 0, 0.517741, 0, 0, 1, -0.771455, 1, 0, 0, 2.52689, 0, 1, 0, 0.517741, 0, 0, 1, -0.390302, 1, 0, 0, 2.55685, 0, 1, 0, 0.517741, 0, 0, 1, 1.22163e-13, 1, 0, 0, 2.8949, 0, 1, 0, 0.354702, 0, 0, 1, 0.397895, 1, 0, 0, 2.81376, 0, 1, 0, 0.354702, 0, 0, 1, 0.788378, 1, 0, 0, 2.6802, 0, 1, 0, 0.354702, 0, 0, 1, 1.16417, 1, 0, 0, 2.49671, 0, 1, 0, 0.354702, 0, 0, 1, 1.51829, 1, 0, 0, 2.26672, 0, 1, 0, 0.354702, 0, 0, 1, 1.84411, 1, 0, 0, 1.9945, 0, 1, 0, 0.354702, 0, 0, 1, 2.13559, 1, 0, 0, 1.68513, 0, 1, 0, 0.354702, 0, 0, 1, 2.38728, 1, 0, 0, 1.34436, 0, 1, 0, 0.354702, 0, 0, 1, 2.5945, 1, 0, 0, 0.978558, 0, 1, 0, 0.354702, 0, 0, 1, 2.7534, 1, 0, 0, 0.594522, 0, 1, 0, 0.354702, 0, 0, 1, 2.861, 1, 0, 0, 0.199412, 0, 1, 0, 0.354702, 0, 0, 1, 2.91531, 1, 0, 0, -0.199412, 0, 1, 0, 0.354702, 0, 0, 1, 2.91531, 1, 0, 0, -0.594522, 0, 1, 0, 0.354702, 0, 0, 1, 2.861, 1, 0, 0, -0.978558, 0, 1, 0, 0.354702, 0, 0, 1, 2.7534, 1, 0, 0, -1.34436, 0, 1, 0, 0.354702, 0, 0, 1, 2.5945, 1, 0, 0, -1.68513, 0, 1, 0, 0.354702, 0, 0, 1, 2.38728, 1, 0, 0, -1.9945, 0, 1, 0, 0.354702, 0, 0, 1, 2.13559, 1, 0, 0, -2.26672, 0, 1, 0, 0.354702, 0, 0, 1, 1.84411, 1, 0, 0, -2.49671, 0, 1, 0, 0.354702, 0, 0, 1, 1.51829, 1, 0, 0, -2.6802, 0, 1, 0, 0.354702, 0, 0, 1, 1.16417, 1, 0, 0, -2.81376, 0, 1, 0, 0.354702, 0, 0, 1, 0.788378, 1, 0, 0, -2.8949, 0, 1, 0, 0.354702, 0, 0, 1, 0.397895, 1, 0, 0, -2.92212, 0, 1, 0, 0.354702, 0, 0, 1, -4.58237e-14, 1, 0, 0, -2.8949, 0, 1, 0, 0.354702, 0, 0, 1, -0.397895, 1, 0, 0, -2.81376, 0, 1, 0, 0.354702, 0, 0, 1, -0.788378, 1, 0, 0, -2.6802, 0, 1, 0, 0.354702, 0, 0, 1, -1.16417, 1, 0, 0, -2.49671, 0, 1, 0, 0.354702, 0, 0, 1, -1.51829, 1, 0, 0, -2.26672, 0, 1, 0, 0.354702, 0, 0, 1, -1.84411, 1, 0, 0, -1.9945, 0, 1, 0, 0.354702, 0, 0, 1, -2.13559, 1, 0, 0, -1.68513, 0, 1, 0, 0.354702, 0, 0, 1, -2.38728, 1, 0, 0, -1.34436, 0, 1, 0, 0.354702, 0, 0, 1, -2.5945, 1, 0, 0, -0.978558, 0, 1, 0, 0.354702, 0, 0, 1, -2.7534, 1, 0, 0, -0.594522, 0, 1, 0, 0.354702, 0, 0, 1, -2.861, 1, 0, 0, -0.199412, 0, 1, 0, 0.354702, 0, 0, 1, -2.91531, 1, 0, 0, 0.199412, 0, 1, 0, 0.354702, 0, 0, 1, -2.91531, 1, 0, 0, 0.594522, 0, 1, 0, 0.354702, 0, 0, 1, -2.861, 1, 0, 0, 0.978558, 0, 1, 0, 0.354702, 0, 0, 1, -2.7534, 1, 0, 0, 1.34436, 0, 1, 0, 0.354702, 0, 0, 1, -2.5945, 1, 0, 0, 1.68513, 0, 1, 0, 0.354702, 0, 0, 1, -2.38728, 1, 0, 0, 1.9945, 0, 1, 0, 0.354702, 0, 0, 1, -2.13559, 1, 0, 0, 2.26672, 0, 1, 0, 0.354702, 0, 0, 1, -1.84411, 1, 0, 0, 2.49671, 0, 1, 0, 0.354702, 0, 0, 1, -1.51829, 1, 0, 0, 2.6802, 0, 1, 0, 0.354702, 0, 0, 1, -1.16417, 1, 0, 0, 2.81376, 0, 1, 0, 0.354702, 0, 0, 1, -0.788378, 1, 0, 0, 2.8949, 0, 1, 0, 0.354702, 0, 0, 1, -0.397895, 1, 0, 0, 2.92212, 0, 1, 0, 0.354702, 0, 0, 1, -4.79672e-14, 1, 0, 0, 3.26341, 0, 1, 0, 0.191663, 0, 0, 1, 0.39625, 1, 0, 0, 3.19186, 0, 1, 0, 0.191663, 0, 0, 1, 0.786722, 1, 0, 0, 3.07376, 0, 1, 0, 0.191663, 0, 0, 1, 1.16572, 1, 0, 0, 2.91083, 0, 1, 0, 0.191663, 0, 0, 1, 1.52772, 1, 0, 0, 2.70546, 0, 1, 0, 0.191663, 0, 0, 1, 1.86745, 1, 0, 0, 2.46064, 0, 1, 0, 0.191663, 0, 0, 1, 2.17994, 1, 0, 0, 2.17994, 0, 1, 0, 0.191663, 0, 0, 1, 2.46064, 1, 0, 0, 1.86745, 0, 1, 0, 0.191663, 0, 0, 1, 2.70546, 1, 0, 0, 1.52772, 0, 1, 0, 0.191663, 0, 0, 1, 2.91083, 1, 0, 0, 1.16572, 0, 1, 0, 0.191663, 0, 0, 1, 3.07376, 1, 0, 0, 0.786722, 0, 1, 0, 0.191663, 0, 0, 1, 3.19186, 1, 0, 0, 0.39625, 0, 1, 0, 0.191663, 0, 0, 1, 3.26341, 1, 0, 0, 1.60832e-15, 0, 1, 0, 0.191663, 0, 0, 1, 3.28738, 1, 0, 0, -0.39625, 0, 1, 0, 0.191663, 0, 0, 1, 3.26341, 1, 0, 0, -0.786722, 0, 1, 0, 0.191663, 0, 0, 1, 3.19186, 1, 0, 0, -1.16572, 0, 1, 0, 0.191663, 0, 0, 1, 3.07376, 1, 0, 0, -1.52772, 0, 1, 0, 0.191663, 0, 0, 1, 2.91083, 1, 0, 0, -1.86745, 0, 1, 0, 0.191663, 0, 0, 1, 2.70546, 1, 0, 0, -2.17994, 0, 1, 0, 0.191663, 0, 0, 1, 2.46064, 1, 0, 0, -2.46064, 0, 1, 0, 0.191663, 0, 0, 1, 2.17994, 1, 0, 0, -2.70546, 0, 1, 0, 0.191663, 0, 0, 1, 1.86745, 1, 0, 0, -2.91083, 0, 1, 0, 0.191663, 0, 0, 1, 1.52772, 1, 0, 0, -3.07376, 0, 1, 0, 0.191663, 0, 0, 1, 1.16572, 1, 0, 0, -3.19186, 0, 1, 0, 0.191663, 0, 0, 1, 0.786722, 1, 0, 0, -3.26341, 0, 1, 0, 0.191663, 0, 0, 1, 0.39625, 1, 0, 0, -3.28738, 0, 1, 0, 0.191663, 0, 0, 1, -5.07465e-14, 1, 0, 0, -3.26341, 0, 1, 0, 0.191663, 0, 0, 1, -0.39625, 1, 0, 0, -3.19186, 0, 1, 0, 0.191663, 0, 0, 1, -0.786722, 1, 0, 0, -3.07376, 0, 1, 0, 0.191663, 0, 0, 1, -1.16572, 1, 0, 0, -2.91083, 0, 1, 0, 0.191663, 0, 0, 1, -1.52772, 1, 0, 0, -2.70546, 0, 1, 0, 0.191663, 0, 0, 1, -1.86745, 1, 0, 0, -2.46064, 0, 1, 0, 0.191663, 0, 0, 1, -2.17994, 1, 0, 0, -2.17994, 0, 1, 0, 0.191663, 0, 0, 1, -2.46064, 1, 0, 0, -1.86745, 0, 1, 0, 0.191663, 0, 0, 1, -2.70546, 1, 0, 0, -1.52772, 0, 1, 0, 0.191663, 0, 0, 1, -2.91083, 1, 0, 0, -1.16572, 0, 1, 0, 0.191663, 0, 0, 1, -3.07376, 1, 0, 0, -0.786722, 0, 1, 0, 0.191663, 0, 0, 1, -3.19186, 1, 0, 0, -0.39625, 0, 1, 0, 0.191663, 0, 0, 1, -3.26341, 1, 0, 0, 1.03101e-13, 0, 1, 0, 0.191663, 0, 0, 1, -3.28738, 1, 0, 0, 0.39625, 0, 1, 0, 0.191663, 0, 0, 1, -3.26341, 1, 0, 0, 0.786722, 0, 1, 0, 0.191663, 0, 0, 1, -3.19186, 1, 0, 0, 1.16572, 0, 1, 0, 0.191663, 0, 0, 1, -3.07376, 1, 0, 0, 1.52772, 0, 1, 0, 0.191663, 0, 0, 1, -2.91083, 1, 0, 0, 1.86745, 0, 1, 0, 0.191663, 0, 0, 1, -2.70546, 1, 0, 0, 2.17994, 0, 1, 0, 0.191663, 0, 0, 1, -2.46064, 1, 0, 0, 2.46064, 0, 1, 0, 0.191663, 0, 0, 1, -2.17994, 1, 0, 0, 2.70546, 0, 1, 0, 0.191663, 0, 0, 1, -1.86745, 1, 0, 0, 2.91083, 0, 1, 0, 0.191663, 0, 0, 1, -1.52772, 1, 0, 0, 3.07376, 0, 1, 0, 0.191663, 0, 0, 1, -1.16572, 1, 0, 0, 3.19186, 0, 1, 0, 0.191663, 0, 0, 1, -0.786722, 1, 0, 0, 3.26341, 0, 1, 0, 0.191663, 0, 0, 1, -0.39625, 1, 0, 0, 3.28738, 0, 1, 0, 0.191663, 0, 0, 1, 1.55456e-13, 1, 0, 0, 3.63123, 0, 1, 0, 0.0286242, 0, 0, 1, 0.394921, 1, 0, 0, 3.56725, 0, 1, 0, 0.0286242, 0, 0, 1, 0.785211, 1, 0, 0, 3.46144, 0, 1, 0, 0.0286242, 0, 0, 1, 1.1663, 1, 0, 0, 3.31505, 0, 1, 0, 0.0286242, 0, 0, 1, 1.53371, 1, 0, 0, 3.1298, 0, 1, 0, 0.0286242, 0, 0, 1, 1.88314, 1, 0, 0, 2.90785, 0, 1, 0, 0.0286242, 0, 0, 1, 2.21049, 1, 0, 0, 2.65181, 0, 1, 0, 0.0286242, 0, 0, 1, 2.51192, 1, 0, 0, 2.36467, 0, 1, 0, 0.0286242, 0, 0, 1, 2.78391, 1, 0, 0, 2.04982, 0, 1, 0, 0.0286242, 0, 0, 1, 3.02326, 1, 0, 0, 1.71093, 0, 1, 0, 0.0286242, 0, 0, 1, 3.22716, 1, 0, 0, 1.35198, 0, 1, 0, 0.0286242, 0, 0, 1, 3.39322, 1, 0, 0, 0.977187, 0, 1, 0, 0.0286242, 0, 0, 1, 3.51951, 1, 0, 0, 0.590932, 0, 1, 0, 0.0286242, 0, 0, 1, 3.60453, 1, 0, 0, 0.19775, 0, 1, 0, 0.0286242, 0, 0, 1, 3.64729, 1, 0, 0, -0.19775, 0, 1, 0, 0.0286242, 0, 0, 1, 3.64729, 1, 0, 0, -0.590932, 0, 1, 0, 0.0286242, 0, 0, 1, 3.60453, 1, 0, 0, -0.977187, 0, 1, 0, 0.0286242, 0, 0, 1, 3.51951, 1, 0, 0, -1.35198, 0, 1, 0, 0.0286242, 0, 0, 1, 3.39322, 1, 0, 0, -1.71093, 0, 1, 0, 0.0286242, 0, 0, 1, 3.22716, 1, 0, 0, -2.04982, 0, 1, 0, 0.0286242, 0, 0, 1, 3.02326, 1, 0, 0, -2.36467, 0, 1, 0, 0.0286242, 0, 0, 1, 2.78391, 1, 0, 0, -2.65181, 0, 1, 0, 0.0286242, 0, 0, 1, 2.51192, 1, 0, 0, -2.90785, 0, 1, 0, 0.0286242, 0, 0, 1, 2.21049, 1, 0, 0, -3.1298, 0, 1, 0, 0.0286242, 0, 0, 1, 1.88314, 1, 0, 0, -3.31505, 0, 1, 0, 0.0286242, 0, 0, 1, 1.53371, 1, 0, 0, -3.46144, 0, 1, 0, 0.0286242, 0, 0, 1, 1.1663, 1, 0, 0, -3.56725, 0, 1, 0, 0.0286242, 0, 0, 1, 0.785211, 1, 0, 0, -3.63123, 0, 1, 0, 0.0286242, 0, 0, 1, 0.394921, 1, 0, 0, -3.65265, 0, 1, 0, 0.0286242, 0, 0, 1, -3.15026e-13, 1, 0, 0, -3.63123, 0, 1, 0, 0.0286242, 0, 0, 1, -0.394921, 1, 0, 0, -3.56725, 0, 1, 0, 0.0286242, 0, 0, 1, -0.785211, 1, 0, 0, -3.46144, 0, 1, 0, 0.0286242, 0, 0, 1, -1.1663, 1, 0, 0, -3.31505, 0, 1, 0, 0.0286242, 0, 0, 1, -1.53371, 1, 0, 0, -3.1298, 0, 1, 0, 0.0286242, 0, 0, 1, -1.88314, 1, 0, 0, -2.90785, 0, 1, 0, 0.0286242, 0, 0, 1, -2.21049, 1, 0, 0, -2.65181, 0, 1, 0, 0.0286242, 0, 0, 1, -2.51192, 1, 0, 0, -2.36467, 0, 1, 0, 0.0286242, 0, 0, 1, -2.78391, 1, 0, 0, -2.04982, 0, 1, 0, 0.0286242, 0, 0, 1, -3.02326, 1, 0, 0, -1.71093, 0, 1, 0, 0.0286242, 0, 0, 1, -3.22716, 1, 0, 0, -1.35198, 0, 1, 0, 0.0286242, 0, 0, 1, -3.39322, 1, 0, 0, -0.977187, 0, 1, 0, 0.0286242, 0, 0, 1, -3.51951, 1, 0, 0, -0.590932, 0, 1, 0, 0.0286242, 0, 0, 1, -3.60453, 1, 0, 0, -0.19775, 0, 1, 0, 0.0286242, 0, 0, 1, -3.64729, 1, 0, 0, 0.19775, 0, 1, 0, 0.0286242, 0, 0, 1, -3.64729, 1, 0, 0, 0.590932, 0, 1, 0, 0.0286242, 0, 0, 1, -3.60453, 1, 0, 0, 0.977187, 0, 1, 0, 0.0286242, 0, 0, 1, -3.51951, 1, 0, 0, 1.35198, 0, 1, 0, 0.0286242, 0, 0, 1, -3.39322, 1, 0, 0, 1.71093, 0, 1, 0, 0.0286242, 0, 0, 1, -3.22716, 1, 0, 0, 2.04982, 0, 1, 0, 0.0286242, 0, 0, 1, -3.02326, 1, 0, 0, 2.36467, 0, 1, 0, 0.0286242, 0, 0, 1, -2.78391, 1, 0, 0, 2.65181, 0, 1, 0, 0.0286242, 0, 0, 1, -2.51192, 1, 0, 0, 2.90785, 0, 1, 0, 0.0286242, 0, 0, 1, -2.21049, 1, 0, 0, 3.1298, 0, 1, 0, 0.0286242, 0, 0, 1, -1.88314, 1, 0, 0, 3.31505, 0, 1, 0, 0.0286242, 0, 0, 1, -1.53371, 1, 0, 0, 3.46144, 0, 1, 0, 0.0286242, 0, 0, 1, -1.1663, 1, 0, 0, 3.56725, 0, 1, 0, 0.0286242, 0, 0, 1, -0.785211, 1, 0, 0, 3.63123, 0, 1, 0, 0.0286242, 0, 0, 1, -0.394921, 1, 0, 0, 3.65265, 0, 1, 0, 0.0286242, 0, 0, 1, 7.42814e-13) + +[node name="ItemPile" type="StaticBody3D"] +script = ExtResource("1_tosru") +item = ExtResource("2_gcf8n") +count = 3000 +item_volume = 0.008 +item_radius = 0.2 +slope_angle = 24.054 + +[node name="Cone" type="MeshInstance3D" parent="."] +transform = Transform3D(3.71678, 0, 0, 0, 1.65901, 0, 0, 0, 3.71678, 0, 0.829507, 0) +visible = false +mesh = SubResource("CylinderMesh_gcf8n") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0) +shape = SubResource("CylinderShape3D_suxjt") + +[node name="Props" type="MultiMeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.25, 0) +visibility_range_end = 100.0 +multimesh = SubResource("MultiMesh_gcf8n") + +[node name="Producer" type="Node" parent="."] +script = ExtResource("4_gcf8n") +metadata/_custom_type_script = "uid://c4fquatkjmsgu" diff --git a/scripts/item_pile.gd b/scripts/item_pile.gd new file mode 100644 index 0000000..de31b77 --- /dev/null +++ b/scripts/item_pile.gd @@ -0,0 +1,97 @@ +@tool +extends StaticBody3D + +@export var item: Item: + set(val): + item = val + if !is_node_ready(): await ready + $Props.multimesh.mesh = item.model + $Cone.material_override = item.model.surface_get_material(0) + +@export var count: int = 10: + set(val): + count = val + update() +@export var item_volume: float = 0.2: + set(val): + item_volume = val + item_radius = pow(item_volume,1.0/3.0) + update() +@export var item_radius: float = 0.0: + set(val): + item_radius = val + item_volume = pow(item_radius, 3.0) + update() +@export_range(0,60) var slope_angle: float = 45: + set(val): + slope_angle = val + slope_ratio = cos(deg_to_rad(slope_angle)) / sin(deg_to_rad(slope_angle)) + print("slope ratio: %f" % slope_ratio) + update() +var slope_ratio: float = 1.0 + +@onready var cone: MeshInstance3D = $Cone +@onready var props: MultiMeshInstance3D = $Props +@onready var collision_shape: CollisionShape3D = $CollisionShape3D + +func _ready() -> void: + props.multimesh = props.multimesh.duplicate() + +func update() -> void: + var volume: float = count * item_volume + var three_v_over_pi: float = (3 * volume) / PI + var height: float = pow(three_v_over_pi, 1.0/3.0) / pow(slope_ratio, 2.0/3.0) + var radius: float = height * slope_ratio + var v: float = (1.0/3.0) * PI * pow(radius,2) * height + assert(is_equal_approx(v,volume)) + cone.scale = Vector3(radius,height,radius) + cone.position.y = height/2.0 + + var slope_length: float = Vector2(radius,height).length() + var ring_count: int = ceili(slope_length / (item_radius*2)) + + var positions: PackedVector3Array = [] + + var angle: float = 0.0 + for ring in range(ring_count): + #var perc: float = ring/float(ring_count-1) + var slope_l: float = ring * (item_radius * 2) + var ring_y: float = height-( sin(deg_to_rad(slope_angle)) * slope_l ) + var ring_radius: float = cos(deg_to_rad(slope_angle)) * slope_l + var ring_circ: float = ring_radius * TAU + var ring_item_count: int = ceili(ring_circ / (item_radius*2)) + if ring_item_count == 0: + ring_item_count = 1 + var ring_angle_offset: float = TAU / ring_item_count + for i in range(ring_item_count): + angle += ring_angle_offset + #var angle: float = ring_angle_offset * i + var x: float = cos(angle) * ring_radius + var z: float = sin(angle) * ring_radius + var pos: Vector3 = Vector3(x,ring_y,z) + positions.append(pos) + + props.multimesh.instance_count = positions.size() + for i in range(positions.size()): + #DebugDraw3D.draw_sphere(positions[i], item_radius, Color.RED, 0.1) + #var y_rot: float = randf() * TAU + var y_rot: float = 0 + props.multimesh.set_instance_transform(i, Transform3D(Basis(Vector3.UP,y_rot),positions[i])) + + props.multimesh.visible_instance_count = min(count, positions.size()) + + #print("Rings: %d, Items: %d" % [ring_count, positions.size()]) + + #var surface_item_count: int = ceil(pow(count, 2.0/3.0)) + #props.multimesh.instance_count = ceil(surface_item_count) + + #var theta: float = chord_offset / distance_offset + #for i in range(surface_item_count): + #var away: float = distance_offset * theta + #var around: float = theta + 0 + #var x: float = cos(around) * away + #var z: float = sin(around) * away + #var y: float = height - (away * slope_ratio) + #var trans: Transform3D = Transform3D(Basis(), Vector3(x,y,z)) + #props.multimesh.set_instance_transform(i,trans) + #theta += chord_offset / away diff --git a/scripts/item_pile.gd.uid b/scripts/item_pile.gd.uid new file mode 100644 index 0000000..cdbea08 --- /dev/null +++ b/scripts/item_pile.gd.uid @@ -0,0 +1 @@ +uid://b742u7cr6efqm