2 Commits

Author SHA1 Message Date
  Pixdigit 292f6fa0b1 MOAR STUFF 3 months ago
  Pixdigit 506fece58b added plants 3 months ago
5 changed files with 139 additions and 22 deletions
Split View
  1. +56
    -6
      scenes/Ship.tscn
  2. +12
    -1
      scenes/sub_scenes/OxygenBubble.tscn
  3. +5
    -5
      scenes/sub_scenes/player.tscn
  4. +59
    -9
      scenes/sub_scenes/satzkasten.tscn
  5. +7
    -1
      src/State.gd

+ 56
- 6
scenes/Ship.tscn View File

@@ -124,7 +124,7 @@ func _on_steer_body_exited(body):

[sub_resource type="Curve3D" id=20]
_data = {
"points": PoolVector3Array( 2.89339, -5.11357, 18.9823, -2.89339, 5.11357, -18.9823, 16.1517, 29.7389, 24.163, 0, 0, 0, 0, 0, 0, -0.164474, 254.772, 3.75325 ),
"points": PoolVector3Array( 2.89339, -5.11357, 18.9823, -2.89339, 5.11357, -18.9823, 16.1517, 29.7389, 24.163, 0, 0, 0, 0, 0, 0, -0.23999, 109.07, 3.75325 ),
"tilts": PoolRealArray( 0, 0 )
}

@@ -391,10 +391,10 @@ __meta__ = {
}

[node name="PathFollow" type="PathFollow" parent="AnimationPlayer/CameraPath"]
transform = Transform( 0.670962, 0.445052, 0.593066, 0.609955, -0.786076, -0.100168, 0.421623, 0.428955, -0.798889, 16.1517, 29.7389, 24.163 )
transform = Transform( 0.657749, 0.444549, 0.608051, 0.654843, -0.736401, -0.16997, 0.372217, 0.509978, -0.775479, 16.1517, 29.7389, 24.163 )

[node name="Camera" type="Camera" parent="AnimationPlayer/CameraPath/PathFollow"]
transform = Transform( 0.367442, 0.138072, 0.919741, 0.168566, -0.982425, 0.0801399, 0.914642, 0.12559, -0.38426, 0, 0, 0 )
transform = Transform( 0.380903, 0.202422, 0.902186, 0.127339, -0.977926, 0.165654, 0.915803, 0.0517853, -0.398272, 0, 0, 0 )
current = true
far = 300.0
script = SubResource( 21 )
@@ -405,7 +405,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 100, 0, 0 )
amount = 1000
lifetime = 20.0
preprocess = 20.0
visibility_aabb = AABB( -201.095, -100.1, -99.9444, 202.151, 200.179, 199.996 )
visibility_aabb = AABB( -201.087, -40.0732, -59.9773, 202.177, 80.1695, 120.026 )
process_material = SubResource( 22 )
draw_pass_1 = SubResource( 24 )

@@ -451,7 +451,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0787144, 0.580219, -0.135435
shape = SubResource( 32 )

[node name="SeagullOrbit" type="Spatial" parent="."]
transform = Transform( 0.874581, 0, -0.48488, 0, 1, 0, 0.48488, 0, 0.874581, 0, 30, 0 )
transform = Transform( -0.517895, 0, -0.855445, 0, 1, 0, 0.855445, 0, -0.517895, 0, 30, 0 )
script = SubResource( 26 )
speed = 0.5

@@ -498,18 +498,68 @@ transform = Transform( -1.62921e-07, 0, -1, 0, 1, 0, 1, 0, -1.62921e-07, 11.2304
type = 3

[node name="Quad" type="Spatial" parent="Plants"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3.69396, 10.9869, 13.4172 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -7, 8, 4.221 )

[node name="satzkasten" parent="Plants/Quad" instance=ExtResource( 4 )]

[node name="satzkasten2" parent="Plants/Quad" instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2.5 )
type = 4

[node name="satzkasten3" parent="Plants/Quad" instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.5, 0, 2.5 )
type = 4

[node name="satzkasten4" parent="Plants/Quad" instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.5, 0, 0 )

[node name="Quad2" type="Spatial" parent="Plants"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 8, 4.221 )

[node name="satzkasten" parent="Plants/Quad2" instance=ExtResource( 4 )]

[node name="satzkasten2" parent="Plants/Quad2" instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2.5 )
type = 4

[node name="satzkasten3" parent="Plants/Quad2" instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.5, 0, 2.5 )
type = 4

[node name="satzkasten4" parent="Plants/Quad2" instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.5, 0, 0 )

[node name="Quad3" type="Spatial" parent="Plants"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -7, 8, -7.277 )

[node name="satzkasten" parent="Plants/Quad3" instance=ExtResource( 4 )]
type = 4

[node name="satzkasten2" parent="Plants/Quad3" instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2.5 )

[node name="satzkasten3" parent="Plants/Quad3" instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.5, 0, 2.5 )

[node name="satzkasten4" parent="Plants/Quad3" instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.5, 0, 0 )
type = 4

[node name="Quad4" type="Spatial" parent="Plants"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 8, -7.277 )

[node name="satzkasten" parent="Plants/Quad4" instance=ExtResource( 4 )]
type = 4

[node name="satzkasten2" parent="Plants/Quad4" instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2.5 )

[node name="satzkasten3" parent="Plants/Quad4" instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.5, 0, 2.5 )

[node name="satzkasten4" parent="Plants/Quad4" instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.5, 0, 0 )
type = 4
[connection signal="body_entered" from="AnimationPlayer/Area" to="AnimationPlayer" method="_on_steer_body_entered"]
[connection signal="body_exited" from="AnimationPlayer/Area" to="AnimationPlayer" method="_on_steer_body_exited"]
[connection signal="body_entered" from="WaterDetector" to="WaterDetector" method="_on_body_entered"]


+ 12
- 1
scenes/sub_scenes/OxygenBubble.tscn View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=20 format=2]
[gd_scene load_steps=21 format=2]

[sub_resource type="SphereMesh" id=1]

@@ -157,8 +157,19 @@ nodes/fragment/connections = PoolIntArray( 10, 0, 11, 0, 11, 0, 2, 3, 15, 0, 10,
shader = SubResource( 18 )
shader_param/Color = Color( 0.4, 0.827451, 1, 1 )

[sub_resource type="GDScript" id=20]
script/source = "extends MeshInstance

func _ready():
pass

func _process(_delta):
scale = State.o2 * Vector3(1, 1, 1)
"

[node name="Spatial" type="Spatial"]

[node name="MeshInstance" type="MeshInstance" parent="."]
mesh = SubResource( 1 )
material/0 = SubResource( 19 )
script = SubResource( 20 )

+ 5
- 5
scenes/sub_scenes/player.tscn View File

@@ -20,6 +20,7 @@ var gravity : Vector3 = Vector3(0,-0.9,0)

onready var audio = get_node(\"RandomAudioStreamPlayer3D\")
onready var stepTimer = get_node(\"Timer\")
onready var mesh = get_node(\"MeshInstance\")
onready var fertilizer_logo = get_node(\"FertilizerLogo\")
onready var water_logo = get_node(\"WaterLogo\")
#onready var seed_logo = get_node(\"SeedLogo\")
@@ -90,8 +91,8 @@ func _on_Timer_timeout():


func smoothRotating(rot : float):
var targetRotation = lerp_angle(deg2rad(rotation_degrees.y), deg2rad(rot), 0.2)
rotation_degrees.y = rad2deg(targetRotation)
var targetRotation = lerp_angle(deg2rad(mesh.rotation_degrees.y), deg2rad(rot), 0.2)
mesh.rotation_degrees.y = rad2deg(targetRotation)
"

[sub_resource type="CapsuleMesh" id=2]
@@ -128,9 +129,6 @@ material/0 = SubResource( 5 )
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0, 0 )
shape = SubResource( 6 )

[node name="Listener" type="Listener" parent="."]
current = true

[node name="Timer" type="Timer" parent="."]
wait_time = 0.3
autostart = true
@@ -160,4 +158,6 @@ visible = false

[node name="AnimationPlayer2" type="AnimationPlayer" parent="WaterLogo"]
autoplay = "rotate"

[node name="Listener" type="Listener" parent="."]
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]

+ 59
- 9
scenes/sub_scenes/satzkasten.tscn View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=2]
[gd_scene load_steps=21 format=2]

[ext_resource path="res://assets/models/satzkasten/erde.material" type="Material" id=1]
[ext_resource path="res://assets/models/satzkasten/satzkasten.material" type="Material" id=2]
@@ -10,6 +10,8 @@
[ext_resource path="res://scenes/sub_scenes/plants/plant_oxygon_export.tscn" type="PackedScene" id=8]
[ext_resource path="res://scenes/sub_scenes/plants/plant_steeringWheel_export-1.tscn" type="PackedScene" id=9]
[ext_resource path="res://scenes/sub_scenes/plants/plant_seedling_export.tscn" type="PackedScene" id=10]
[ext_resource path="res://scenes/sub_scenes/fertilizer_logo.tscn" type="PackedScene" id=11]
[ext_resource path="res://scenes/sub_scenes/water_logo.tscn" type="PackedScene" id=12]

[sub_resource type="GDScript" id=1]
script/source = "extends StaticBody
@@ -20,12 +22,12 @@ export var fertilizer_need: int = 3


var plant_timers: Dictionary = {
State.PLANT_TYPE.STEERING: 15 * SECOND,
State.PLANT_TYPE.ENGINE_FRONT: 3 * MINUTE,
State.PLANT_TYPE.ENGINE_BACK: 3 * MINUTE,
State.PLANT_TYPE.O2: 4 * MINUTE,
State.PLANT_TYPE.CANON: 6 * MINUTE,
State.PLANT_TYPE.DECO: 7 * MINUTE
State.PLANT_TYPE.STEERING: 1 * MINUTE,
State.PLANT_TYPE.ENGINE_FRONT: 1 * MINUTE,
State.PLANT_TYPE.ENGINE_BACK: 1 * MINUTE,
State.PLANT_TYPE.O2: 1 * MINUTE,
State.PLANT_TYPE.CANON: 1 * MINUTE,
State.PLANT_TYPE.DECO: 1 * MINUTE
}

onready var plants: Dictionary = {
@@ -47,6 +49,10 @@ onready var plant_container: Spatial = find_node(\"Plants\")
onready var highlight: Sprite3D = find_node(\"Highlight\")
onready var water_timer: Timer = find_node(\"WaterTimer\")

onready var water_logo: Spatial = get_node(\"Notification/Wasser Logo\")
onready var seed_logo: Spatial = get_node(\"Notification/plant_seedling_export\")
onready var fertilizer_logo: Spatial = get_node(\"Notification/Dünger Logo\")

onready var grow_sound: AudioStreamPlayer3D = find_node(\"GrowSound\")
onready var wither_sound: AudioStreamPlayer3D = find_node(\"WitherSound\")

@@ -97,6 +103,7 @@ func set_type(newType: int) -> void:
func interact():
if state == EMPTY and State.player_inventory == State.ITEM.SEED:
set_state(SEEDLING)
fertilizer_given = 0
elif state == SEEDLING and State.player_inventory == State.ITEM.FERTILIZER:
fertilizer_given += 1
elif state == GROWN and State.player_inventory == State.ITEM.WATER:
@@ -108,11 +115,16 @@ func interact():
State.player_inventory = State.ITEM.EMPTY

func set_state(new_state: int):
water_logo.visible = false
fertilizer_logo.visible = false
seed_logo.visible = false
for plant_type in plant_container.get_children():
plant_type.visible = false
if new_state == SEEDLING:
plants[SEEDLING].visible = true
fertilizer_logo.visible = true
elif new_state == GROWN:
if state != GROWN:
grow_sound.play()
@@ -121,6 +133,7 @@ func set_state(new_state: int):
plants[type].visible = true
elif new_state == EMPTY:
State.plant_amounts[type] -= 1
seed_logo.visible = true
state = new_state

@@ -129,7 +142,6 @@ func _on_Area_body_entered(body: PhysicsBody):
if body.name == \"Player\":
State.select_plant(self)


func _on_Area_body_exited(body):
if body.name == \"Player\":
State.unselect_plant(self)
@@ -138,6 +150,9 @@ func _on_WaterTimer_timeout():
if state == GROWN:
set_state(EMPTY)
wither_sound.play()

func _physics_process(_delta):
water_logo.visible = water_timer.time_left <= 20 and not water_timer.is_stopped()
"

[sub_resource type="CylinderShape" id=2]
@@ -155,6 +170,23 @@ colors = PoolColorArray( 0.835294, 0.823529, 0, 1 )
gradient = SubResource( 4 )
width = 1

[sub_resource type="Animation" id=8]
resource_name = "New Anim"
length = 1.5
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath(".:rotation_degrees")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1.5 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 360, 0 ) ]
}

[sub_resource type="ArrayMesh" id=6]
surfaces/0 = {
"aabb": AABB( -0.614934, 0.0676974, -0.605706, 1.20367, 0.0168722, 1.20367 ),
@@ -241,8 +273,26 @@ visible = false
axis = 1
texture = SubResource( 5 )

[node name="Notification" type="Spatial" parent="."]
transform = Transform( 0.438764, 0, 0.898602, 0, 1, 0, -0.898602, 0, 0.438764, 0, 0, 0 )

[node name="plant_seedling_export" parent="Notification" instance=ExtResource( 10 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.38468, 0 )
visible = false

[node name="Wasser Logo" parent="Notification" instance=ExtResource( 12 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.61059, 0 )
visible = false

[node name="Dünger Logo" parent="Notification" instance=ExtResource( 11 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.49934, 0 )
visible = false

[node name="AnimationPlayer" type="AnimationPlayer" parent="Notification"]
autoplay = "New Anim"
"anims/New Anim" = SubResource( 8 )

[node name="WaterTimer" type="Timer" parent="."]
wait_time = 0.001

[node name="GrowSound" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource( 6 )


+ 7
- 1
src/State.gd View File

@@ -30,7 +30,9 @@ enum ITEM {

var rng: RandomNumberGenerator = RandomNumberGenerator.new()

var o2: float = 0
var o2: float = 1
var o2_drain: float = 0.005
var o2_gain: float = 0.001

var selected_plant: Spatial = null
var player_inventory: int = ITEM.EMPTY setget set_item
@@ -55,3 +57,7 @@ func _input(_event):
if Input.is_action_just_pressed("Interact"):
if selected_plant != null:
selected_plant.interact()

func _process(delta):
var net_gain = plant_amounts[PLANT_TYPE.O2] * o2_gain - o2_drain
o2 = min(o2 + net_gain * delta, 1)

Loading…
Cancel
Save