added realtime day night cycle based on system time

This commit is contained in:
Derek
2025-03-16 13:05:28 -05:00
parent efb3fee189
commit e3b887d66c
21 changed files with 2613 additions and 2298 deletions

6
assets/SunEnergy.tres Normal file
View File

@@ -0,0 +1,6 @@
[gd_resource type="Curve" format=3 uid="uid://dw3fdot051nfm"]
[resource]
_limits = [0.0, 2.0, 0.0, 24.0]
_data = [Vector2(5, 0), 0.0, 0.66, 0, 0, Vector2(12, 2), 0.0, 0.0, 0, 0, Vector2(19, 0), -0.66, 0.0, 0, 0]
point_count = 3

View File

@@ -0,0 +1,35 @@
[gd_scene load_steps=6 format=3 uid="uid://cwy8iv8nlwqrc"]
[ext_resource type="Script" uid="uid://dl780dimuvcms" path="res://scripts/realtime_day_night_cycle.gd" id="1_idjmm"]
[sub_resource type="Curve" id="Curve_idjmm"]
_limits = [0.0, 2.0, 0.0, 24.0]
_data = [Vector2(5, 0), 0.0, 0.66, 0, 0, Vector2(12, 2), 0.0, 0.0, 0, 0, Vector2(19, 0), -0.66, 0.0, 0, 0]
point_count = 3
[sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_xp6wm"]
energy_multiplier = 5.0
[sub_resource type="Sky" id="Sky_6g0ku"]
sky_material = SubResource("PhysicalSkyMaterial_xp6wm")
process_mode = 3
[sub_resource type="Environment" id="Environment_ml2st"]
background_mode = 2
sky = SubResource("Sky_6g0ku")
ssr_enabled = true
ssao_enabled = true
sdfgi_enabled = true
glow_enabled = true
fog_density = 0.0005
[node name="Realtime Day Night Cycle" type="Node3D"]
script = ExtResource("1_idjmm")
sun_energy_over_time = SubResource("Curve_idjmm")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_ml2st")
[node name="Sun" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.603876, -0.0397012, 0.796089, -0.797078, -0.0300781, 0.603127, -2.96845e-10, -0.998759, -0.0498085, 0, 0, 0)
shadow_enabled = true

File diff suppressed because one or more lines are too long

1541
assets/revolver_2.tscn Normal file

File diff suppressed because one or more lines are too long

View File

@@ -47,13 +47,13 @@ surface_material_override/0 = SubResource("StandardMaterial3D_we7vv")
shape = SubResource("SphereShape3D_55xw1")
[node name="Timer" type="Timer" parent="."]
wait_time = 10.0
wait_time = 3.0
one_shot = true
autostart = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_2bjxd")
&"": SubResource("AnimationLibrary_2bjxd")
}
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View File

@@ -0,0 +1,14 @@
[gd_resource type="Resource" script_class="bullet_resource" load_steps=4 format=3 uid="uid://vmvpop4h3yji"]
[ext_resource type="PackedScene" uid="uid://neb8fxkrade0" path="res://assets/bullet_cam.tscn" id="1_nkw1f"]
[ext_resource type="PackedScene" uid="uid://crvohhc6kgshn" path="res://assets/bullet_hole.tscn" id="2_kum3s"]
[ext_resource type="Script" uid="uid://6s14vpfr5pio" path="res://scripts/bullet_resource.gd" id="3_0ljyt"]
[resource]
script = ExtResource("3_0ljyt")
asset = ExtResource("1_nkw1f")
price = 1
ammo_type = 5
special_bullet_name = "bullet_cam"
bullet_hole = ExtResource("2_kum3s")
metadata/_custom_type_script = "uid://6s14vpfr5pio"

View File

@@ -1,6 +1,6 @@
[gd_resource type="Resource" script_class="weapon_resource" load_steps=5 format=3 uid="uid://cqphw4ll1bjjx"]
[ext_resource type="Resource" uid="uid://b4sqlnsf0jla2" path="res://assets/weaponresources/medium_ammo.tres" id="1_53e42"]
[ext_resource type="Resource" uid="uid://b4sqlnsf0jla2" path="res://assets/weaponresources/medium_ammo.tres" id="1_gphlx"]
[ext_resource type="Texture2D" uid="uid://bho7c8s2yno12" path="res://assets/Textures/ObjectTextures/revolver1.png" id="2_n6mhi"]
[ext_resource type="PackedScene" uid="uid://c1gdehrsytlkk" path="res://assets/casing.tscn" id="2_ylruw"]
[ext_resource type="Script" uid="uid://d0cf6xsxkf0h" path="res://scripts/weapon_resource.gd" id="3_1a2hk"]
@@ -12,14 +12,14 @@ gun_icon = ExtResource("2_n6mhi")
path = "res://assets/revolver_1.tscn"
weapon_type = 0
reload_type = 1
bullet = ExtResource("1_53e42")
bullet = ExtResource("1_gphlx")
fire_mode = 1
fov_zoom_amt = 0.98
ads = false
recoil_amount = Vector3(0.2, 0.05, 0.05)
kick_amount = 0.1
max_ammo = 6
start_mags = 3
start_mags = 1
bullet_damage = 5
smoke_enabled = false
bullet_force_mod = 5.0

View File

@@ -0,0 +1,46 @@
[gd_resource type="Resource" script_class="weapon_resource" load_steps=8 format=3 uid="uid://qsjxlocuyu2q"]
[ext_resource type="PackedScene" uid="uid://neb8fxkrade0" path="res://assets/bullet_cam.tscn" id="1_bd31m"]
[ext_resource type="PackedScene" uid="uid://c1gdehrsytlkk" path="res://assets/casing.tscn" id="2_bd31m"]
[ext_resource type="PackedScene" uid="uid://crvohhc6kgshn" path="res://assets/bullet_hole.tscn" id="2_lor3x"]
[ext_resource type="Script" uid="uid://6s14vpfr5pio" path="res://scripts/bullet_resource.gd" id="2_vli3e"]
[ext_resource type="Texture2D" uid="uid://bho7c8s2yno12" path="res://assets/Textures/ObjectTextures/revolver1.png" id="3_vli3e"]
[ext_resource type="Script" uid="uid://d0cf6xsxkf0h" path="res://scripts/weapon_resource.gd" id="4_lor3x"]
[sub_resource type="Resource" id="Resource_vli3e"]
script = ExtResource("2_vli3e")
asset = ExtResource("1_bd31m")
price = 100
ammo_type = 5
special_bullet_name = "bullet_cam"
bullet_hole = ExtResource("2_lor3x")
metadata/_custom_type_script = "uid://6s14vpfr5pio"
[resource]
script = ExtResource("4_lor3x")
gun_name = "bullet cam revolver"
gun_icon = ExtResource("3_vli3e")
path = "res://assets/revolver_1.tscn"
weapon_type = 0
reload_type = 1
bullet = SubResource("Resource_vli3e")
fire_mode = 1
fov_zoom_amt = 0.98
ads = false
recoil_amount = Vector3(0.2, 0.05, 0.05)
kick_amount = 0.1
max_ammo = 6
start_mags = 1
bullet_damage = 5
smoke_enabled = false
bullet_force_mod = 5.0
bullet_speed = 300
casing = ExtResource("2_bd31m")
vibration_weak_magnitude = 0.1
vibration_strong_magnitude = 0.5
vibration_duration = 0.1
chamber_rot_amount = 60.0
shotgun_spread = Vector3(0.1, 0.1, 0.1)
pellets_per_shot = 20
blast_power = 50.0
hitscan_range = 100.0

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=50 format=4 uid="uid://f7e0v1r6ra6c"]
[gd_scene load_steps=48 format=4 uid="uid://f7e0v1r6ra6c"]
[ext_resource type="Material" uid="uid://b6hhomp4kcjvb" path="res://assets/materials/prototype/tadaoando.tres" id="3_pecld"]
[ext_resource type="PackedScene" uid="uid://c0uv33kbndbvy" path="res://assets/trashcan.tscn" id="4_2tu3b"]
@@ -19,6 +19,7 @@
[ext_resource type="Material" uid="uid://dy2pswr330jnk" path="res://assets/materials/prototype/brick.tres" id="23_pyop4"]
[ext_resource type="PackedScene" uid="uid://bycbdb5u5ewgl" path="res://assets/tree_2.tscn" id="24_od0q8"]
[ext_resource type="PackedScene" uid="uid://c7vrpfdh603kr" path="res://assets/bottle_1.tscn" id="25_fk5nr"]
[ext_resource type="PackedScene" uid="uid://cwy8iv8nlwqrc" path="res://assets/realtime_day_night_cycle.tscn" id="26_qoxo0"]
[ext_resource type="PackedScene" uid="uid://c6bpysq1tjhy4" path="res://vendingmahcine.tscn" id="26_rsia7"]
[ext_resource type="PackedScene" uid="uid://8cwmkiwcoaji" path="res://terrain1.tscn" id="27_hlma7"]
[ext_resource type="PackedScene" uid="uid://dlhjacsike5a4" path="res://assets/oildrum1.tscn" id="31_jbe2q"]
@@ -26,23 +27,6 @@
[ext_resource type="PackedScene" uid="uid://df34olntmk0wl" path="res://assets/vent_1.tscn" id="32_x8mvi"]
[ext_resource type="PackedScene" uid="uid://dt4t2a48204v1" path="res://assets/spikes_1.tscn" id="33_u3uct"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_py8au"]
[sub_resource type="Sky" id="Sky_g3jkj"]
sky_material = SubResource("ProceduralSkyMaterial_py8au")
[sub_resource type="Environment" id="Environment_tngkl"]
background_mode = 2
sky = SubResource("Sky_g3jkj")
ambient_light_source = 3
ambient_light_color = Color(0.618759, 0.713374, 0.772947, 1)
tonemap_exposure = 1.25
sdfgi_enabled = true
glow_enabled = true
adjustment_enabled = true
adjustment_brightness = 1.1
adjustment_contrast = 1.1
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_mianr"]
albedo_color = Color(0.323355, 0.462817, 0.242752, 1)
@@ -344,14 +328,6 @@ _data = {
[node name="AssetChecker" type="Node3D" groups=["ui"]]
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_tngkl")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.878885, -0.476463, 0.0233089, 0.386275, 0.739495, 0.551307, -0.279914, -0.475532, 0.833977, 0, 0, 0)
light_energy = 2.0
shadow_enabled = true
[node name="CSGBox3D" type="CSGBox3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.54059, -4.88213, 0)
material_override = ExtResource("3_pecld")
@@ -602,3 +578,6 @@ libraries = {
&"": SubResource("AnimationLibrary_ey8td")
}
autoplay = "Menu"
[node name="Realtime Day Night Cycle" parent="." instance=ExtResource("26_qoxo0")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -11.9891, 1.53028, 4.26966)

View File

@@ -1,7 +1,8 @@
[gd_scene load_steps=31 format=3 uid="uid://dsnddbrlqkav2"]
[gd_scene load_steps=29 format=3 uid="uid://dsnddbrlqkav2"]
[ext_resource type="Script" uid="uid://bkii8jwf0k7tq" path="res://scripts/LevelManager.gd" id="1_laua1"]
[ext_resource type="Resource" uid="uid://dn3t7wcoumlm3" path="res://GameModes/standard.tres" id="2_2umal"]
[ext_resource type="PackedScene" uid="uid://cwy8iv8nlwqrc" path="res://assets/realtime_day_night_cycle.tscn" id="3_bpxqw"]
[ext_resource type="PackedScene" uid="uid://drwae3loscbw7" path="res://assets/player.tscn" id="4_a8lcp"]
[ext_resource type="Script" uid="uid://12l74jckdnpl" path="res://scripts/room_manager.gd" id="5_ngmqi"]
[ext_resource type="PackedScene" uid="uid://djr7vnr1hcx82" path="res://assets/spider2.tscn" id="6_qmuhr"]
@@ -21,23 +22,6 @@
[ext_resource type="PackedScene" uid="uid://db7xqf12sayj0" path="res://assets/chest_spawner.tscn" id="20_ena8c"]
[ext_resource type="PackedScene" uid="uid://dgapcuvg0gtmm" path="res://assets/scene_changer.tscn" id="20_j4ook"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_w6vpl"]
sky_top_color = Color(0.623488, 0.812575, 0.900791, 1)
sky_horizon_color = Color(0.705872, 0.745394, 0.758448, 1)
ground_bottom_color = Color(0.5, 0.5, 0.5, 1)
ground_horizon_color = Color(0.705872, 0.745394, 0.758448, 1)
[sub_resource type="Sky" id="Sky_6g0ku"]
sky_material = SubResource("ProceduralSkyMaterial_w6vpl")
[sub_resource type="Environment" id="Environment_klp4b"]
background_mode = 2
sky = SubResource("Sky_6g0ku")
tonemap_mode = 2
glow_enabled = true
fog_enabled = true
fog_density = 0.0005
[sub_resource type="Animation" id="Animation_3e03q"]
length = 0.001
tracks/0/type = "position_3d"
@@ -91,24 +75,13 @@ map_name = "Wall Runnin"
gamemode = ExtResource("2_2umal")
player = NodePath("Player")
MAX_PARTICLES = 75
expected_ammo = {
"heavy": 25,
"light": 500,
"medium": 50,
"rocket": 3,
"shotgun": 20
}
[node name="Realtime Day Night Cycle" parent="." instance=ExtResource("3_bpxqw")]
transform = Transform3D(-0.582719, 0, -0.812674, 0, 1, 0, 0.812674, 0, -0.582719, 0, 0, 0)
[node name="Player" parent="." instance=ExtResource("4_a8lcp")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 26.4194, 277.483, -34.6215)
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_klp4b")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.78152, -0.330606, 0.52908, 0, 0.848048, 0.529919, -0.62388, 0.414143, -0.662767, 0, 0, 0)
shadow_enabled = true
[node name="Level" type="Node3D" parent="." groups=["enemy_hivemind"]]
script = ExtResource("5_ngmqi")
room_lockdown = true
@@ -203,7 +176,7 @@ door_open_start = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="Level/Door"]
root_node = NodePath("../..")
libraries = {
"": SubResource("AnimationLibrary_s1qpx")
&"": SubResource("AnimationLibrary_s1qpx")
}
[node name="RoomCheck" type="Area3D" parent="Level"]

View File

@@ -1,8 +1,9 @@
[gd_scene load_steps=29 format=3 uid="uid://uo43j7bomkf3"]
[gd_scene load_steps=27 format=3 uid="uid://uo43j7bomkf3"]
[ext_resource type="Script" uid="uid://bkii8jwf0k7tq" path="res://scripts/LevelManager.gd" id="1_8o3mm"]
[ext_resource type="Resource" uid="uid://dn3t7wcoumlm3" path="res://GameModes/standard.tres" id="2_knkyv"]
[ext_resource type="PackedScene" uid="uid://drwae3loscbw7" path="res://assets/player.tscn" id="3_sn6s8"]
[ext_resource type="PackedScene" uid="uid://cwy8iv8nlwqrc" path="res://assets/realtime_day_night_cycle.tscn" id="3_uc3ig"]
[ext_resource type="Script" uid="uid://12l74jckdnpl" path="res://scripts/room_manager.gd" id="4_iqtg8"]
[ext_resource type="PackedScene" uid="uid://djr7vnr1hcx82" path="res://assets/spider2.tscn" id="5_vb31s"]
[ext_resource type="Script" uid="uid://bw1uh8yc13tjy" path="res://scripts/switch_door.gd" id="6_xph2x"]
@@ -19,23 +20,6 @@
[ext_resource type="Material" uid="uid://b6hhomp4kcjvb" path="res://assets/materials/prototype/tadaoando.tres" id="21_s6xxg"]
[ext_resource type="PackedScene" uid="uid://dgapcuvg0gtmm" path="res://assets/scene_changer.tscn" id="22_6kw07"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_w6vpl"]
sky_top_color = Color(0.623488, 0.812575, 0.900791, 1)
sky_horizon_color = Color(0.705872, 0.745394, 0.758448, 1)
ground_bottom_color = Color(0.5, 0.5, 0.5, 1)
ground_horizon_color = Color(0.705872, 0.745394, 0.758448, 1)
[sub_resource type="Sky" id="Sky_6g0ku"]
sky_material = SubResource("ProceduralSkyMaterial_w6vpl")
[sub_resource type="Environment" id="Environment_klp4b"]
background_mode = 2
sky = SubResource("Sky_6g0ku")
tonemap_mode = 2
glow_enabled = true
fog_mode = 1
fog_density = 1.0
[sub_resource type="Animation" id="Animation_3e03q"]
length = 0.001
tracks/0/type = "position_3d"
@@ -89,24 +73,13 @@ map_name = "Wall Runnin"
gamemode = ExtResource("2_knkyv")
player = NodePath("Player")
MAX_PARTICLES = 75
expected_ammo = {
"heavy": 25,
"light": 500,
"medium": 50,
"rocket": 3,
"shotgun": 20
}
[node name="Realtime Day Night Cycle" parent="." instance=ExtResource("3_uc3ig")]
transform = Transform3D(0.510503, -0.00501647, 0.859861, 0.00982605, 0.999952, 3.48377e-10, -0.85982, 0.00844904, 0.510528, 0, 0, 0)
[node name="Player" parent="." instance=ExtResource("3_sn6s8")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 26.4194, 277.483, -34.6215)
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_klp4b")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.78152, -0.330606, 0.52908, 0, 0.848048, 0.529919, -0.62388, 0.414143, -0.662767, 0, 0, 0)
shadow_enabled = true
[node name="Level" type="Node3D" parent="." groups=["enemy_hivemind"]]
script = ExtResource("4_iqtg8")
room_lockdown = true
@@ -165,7 +138,7 @@ door_open_start = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="Level/Door"]
root_node = NodePath("../..")
libraries = {
"": SubResource("AnimationLibrary_s1qpx")
&"": SubResource("AnimationLibrary_s1qpx")
}
[node name="RoomCheck" type="Area3D" parent="Level"]

View File

@@ -20,13 +20,13 @@
[ext_resource type="PackedScene" uid="uid://do6gt53xr2l23" path="res://assets/garbage_bin.tscn" id="19_ma1ga"]
[ext_resource type="PackedScene" uid="uid://wsk4w1xmb3p4" path="res://assets/Audio/train1.tscn" id="19_vcb4t"]
[ext_resource type="Texture2D" uid="uid://ciwlwynk4jt2k" path="res://assets/Models/boxcar1.albdeo.png" id="20_qpg5a"]
[ext_resource type="Texture2D" uid="uid://cixlw3pnskjm4" path="res://assets/Models/boxcar1.rough.png" id="21_t6wsg"]
[ext_resource type="Texture2D" uid="uid://du5psl01pl58u" path="res://assets/Models/boxcar1.normal.png" id="22_v4e4d"]
[ext_resource type="Texture2D" uid="uid://cvdh3jecb65ka" path="res://assets/Models/boxcar1.rough.png" id="21_t6wsg"]
[ext_resource type="Texture2D" uid="uid://dypcs5eicgvec" path="res://assets/Models/boxcar1.normal.png" id="22_v4e4d"]
[ext_resource type="Texture2D" uid="uid://bdb2yv36ffmk8" path="res://assets/Models/boxcar1.doors.png" id="23_saeg6"]
[ext_resource type="Texture2D" uid="uid://sjohow3p4tvl" path="res://assets/Models/boxcar1.doors.rough.png" id="24_hnc6c"]
[ext_resource type="Texture2D" uid="uid://bmxhwygo4dpkf" path="res://assets/Models/boxcar1.doors.normal.png" id="25_7wb5s"]
[ext_resource type="Texture2D" uid="uid://dwh7ugcppm4k" path="res://assets/Models/boxcar1.wheel.albedo.png" id="26_2d20r"]
[ext_resource type="Texture2D" uid="uid://oeyauoofbcdf" path="res://assets/Models/boxcar1.wheel.rough.png" id="27_yuljh"]
[ext_resource type="Texture2D" uid="uid://cprosq81sf424" path="res://assets/Models/boxcar1.wheel.rough.png" id="27_yuljh"]
[ext_resource type="Texture2D" uid="uid://5i5urt5i8fjd" path="res://assets/Models/boxcar1.wheel.normal.png" id="28_tulwp"]
[ext_resource type="Texture2D" uid="uid://4lve7kqobqx2" path="res://assets/Models/boxcar1.coupler.albedo.png" id="29_1k31y"]
[ext_resource type="Texture2D" uid="uid://bxek6q1nxy1ks" path="res://assets/Models/boxcar1.coupler.normal.png" id="30_veuc5"]
@@ -44,13 +44,10 @@
[ext_resource type="PackedScene" uid="uid://dgapcuvg0gtmm" path="res://assets/scene_changer.tscn" id="43_x54pr"]
[ext_resource type="Resource" uid="uid://bxcxqt7rmfvdw" path="res://GameModes/hubworld.tres" id="44_1akso"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_nb6x7"]
sky_top_color = Color(0.500562, 0.697334, 0.809889, 1)
sky_horizon_color = Color(0.633243, 0.578258, 0.62378, 1)
ground_horizon_color = Color(0.633983, 0.579022, 0.624523, 1)
[sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_e2mk2"]
[sub_resource type="Sky" id="Sky_1fe4l"]
sky_material = SubResource("ProceduralSkyMaterial_nb6x7")
sky_material = SubResource("PhysicalSkyMaterial_e2mk2")
[sub_resource type="Environment" id="Environment_q2cfn"]
background_mode = 2
@@ -1162,16 +1159,17 @@ _data = {
&"trainmove": SubResource("Animation_6nfej")
}
[node name="Test Level 2" type="Node3D" node_paths=PackedStringArray("player")]
[node name="Test Level 2" type="Node3D" node_paths=PackedStringArray("player", "time_based_sun")]
script = ExtResource("1_orhgl")
gamemode = ExtResource("2_ynfvy")
player = NodePath("Player")
time_based_sun = NodePath("DirectionalLight3D")
[node name="Player" parent="." instance=ExtResource("2_f87c2")]
transform = Transform3D(-0.866025, 0, -0.5, 0, 1, 0, 0.5, 0, -0.866025, -44.3464, 70.2562, -23.9068)
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.420794, 0.292511, -0.858703, -0.23587, 0.949309, 0.207791, 0.875956, 0.115105, 0.468458, 0, 0, 0)
transform = Transform3D(-0.848049, 0.238103, 0.473415, 0, -0.893371, 0.449319, 0.52992, 0.381044, 0.757622, 0, 0, 0)
light_bake_mode = 1
shadow_enabled = true
@@ -1476,7 +1474,7 @@ transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -69.19
[node name="AnimationPlayer" type="AnimationPlayer" parent="Decorations"]
root_node = NodePath("../..")
libraries = {
"": SubResource("AnimationLibrary_1w2xf")
&"": SubResource("AnimationLibrary_1w2xf")
}
autoplay = "trainmove"

View File

@@ -5,11 +5,7 @@ class_name level
@export var gamemode : gamemode
@export var player : Node
@export var MAX_PARTICLES = 100
@export_group("Drops")
@export var drop_chance_minimum = .1
@export var expected_ammo = {"light" : 200, "medium" : 50, "heavy" : 25,"shotgun" : 20, "rocket" : 3} #light, medium,heavy,shotgun,rocket
@export var stamina_drop_enabled = true
@export var money_drop_enabled = true
@export var time_based_sun : DirectionalLight3D
const ITEM_PICKUP = preload("res://assets/item_pickup.tscn")
const CROWN = preload("res://assets/crown.tscn")
@@ -208,22 +204,22 @@ func pickup_spawn(randomized):
else:
var health_weight
if gamemode.health_drop_enabled:
health_weight = (1.0 - (GameGlobals.health / gamemode.start_health)) + drop_chance_minimum
health_weight = (1.0 - (GameGlobals.health / gamemode.start_health)) + gamemode.drop_chance_minimum
else:
health_weight = 0
var stamina_weight
if stamina_drop_enabled:
stamina_weight = (1.0 - (player.remaining_stamina / gamemode.max_stamina)) + drop_chance_minimum
if gamemode.stamina_drop_enabled:
stamina_weight = (1.0 - (player.remaining_stamina / gamemode.max_stamina)) + gamemode.drop_chance_minimum
else:
stamina_weight = 0
var money_weight
if money_drop_enabled:
money_weight = 1 + drop_chance_minimum #fix this logic later once the economy makes sense
if gamemode.money_drop_enabled:
money_weight = 1 + gamemode.drop_chance_minimum #fix this logic later once the economy makes sense
else:
money_weight = 0
var ammo_weight
if gamemode.ammo_drop_enabled:
ammo_weight = drop_chance_minimum
ammo_weight = gamemode.drop_chance_minimum
else: ammo_weight = 0
var ammo_type_weight = {}
@@ -247,7 +243,7 @@ func pickup_spawn(randomized):
if i_weight > ammo_weight:
ammo_weight = i_weight
ammo_type_weight.erase(5)
ammo_type_weight[i] = i_weight + drop_chance_minimum
ammo_type_weight[i] = i_weight + gamemode.drop_chance_minimum
pickup_type = HelperFuncs.weighted_random({"0" : ammo_weight, "1" : stamina_weight,"2" : health_weight,"3" : money_weight})

View File

@@ -1,17 +1,7 @@
extends RigidBody3D
extends Projectile
@export var collision_shape : Node
var bullet_speed
var bullet_drop
var random_spread_amt
var bullet_damage
var instance_bullethole
var bullet_force_mod = 1.0
var distance_from_player
var player_position
var player_velocity
var bullet_active = true
var bullet_target : Node
var hold_cam_pos = null
var camera_start

View File

@@ -2,5 +2,7 @@ extends Resource
class_name bullet_resource
@export var asset : Resource
@export_enum("Light", "Medium", "Heavy", "Shotgun", "Rocket") var ammo_type: int
@export var price : int = 1
@export_enum("Light", "Medium", "Heavy", "Shotgun", "Rocket","Special") var ammo_type: int #Special ammo is stored by bullet name
@export var special_bullet_name : String
@export var bullet_hole : Resource

View File

@@ -647,28 +647,8 @@ func holster_gun(holster):
if holstered_gun_id != null:
weapon_select(holstered_gun_id)
func add_ammo(new_gun,gun_name,ammo_type,max_ammo,start_mags):
if new_gun:
if ammo_type != 5: #if ammo is not melee
GameGlobals.gun_ammo[gun_name] = max_ammo
else:
GameGlobals.gun_ammo[gun_name] = null
if GameGlobals.ammo_reserve.has(str(ammo_type)):
GameGlobals.ammo_reserve[str(ammo_type)] += start_mags * max_ammo
else:
#if melee weapon don't do max ammo calc
if ammo_type == 5:
pass
#otherwise calculate starting ammo
else:
GameGlobals.ammo_reserve[str(ammo_type)] = start_mags * max_ammo
print("GUN AMMO ",GameGlobals.gun_ammo)
print("RESERVE AMMO ", GameGlobals.ammo_reserve)
## MISC
func _on_pick_up_detection_body_entered(body):
if body.is_in_group("item_pickup"):

View File

@@ -0,0 +1,17 @@
extends Node3D
@onready var sun: DirectionalLight3D = $Sun
@export var sun_energy_over_time : Curve
func _ready() -> void:
var sun_details = sun_angle_from_time()
sun.rotation.x = sun_details["angle"]
sun.light_energy = sun_details["energy"]
func sun_angle_from_time():
var time_dict = Time.get_time_dict_from_system()
var current_time = float(time_dict["hour"]) + (float(time_dict["minute"]) / 60)
print("current time: ", current_time)
var angle : float = deg_to_rad((current_time/24.0) * 360.0 + 90.0)
var energy = sun_energy_over_time.sample(current_time)
return {"angle" : angle, "energy" : energy}

View File

@@ -0,0 +1 @@
uid://dl780dimuvcms

View File

@@ -6,7 +6,6 @@ extends RigidBody3D
@onready var level_control = get_tree().current_scene
var pickupable = true
var gun_already_held = false
# Called when the node enters the scene tree for the first time.
func _ready():
@@ -18,14 +17,17 @@ func _process(delta):
pass
func picked_up():
var spawn_gun = gun_resource.instantiate()
var gun_held = false
#check if gun is owned
for i in GameGlobals.held_guns:
if i == gun_resource:
gun_already_held = true
gun_held = true
if !gun_already_held:
var spawn_gun = gun_resource.instantiate()
if spawn_gun.weapon_info.weapon_type == 0:
level_control.player.add_ammo(true,spawn_gun.weapon_info.gun_name,spawn_gun.weapon_info.bullet.ammo_type,spawn_gun.weapon_info.max_ammo,spawn_gun.weapon_info.start_mags)
add_ammo(gun_held,spawn_gun.weapon_info.gun_name,spawn_gun.weapon_info.bullet.ammo_type,spawn_gun.weapon_info.bullet.special_bullet_name,spawn_gun.weapon_info.max_ammo,spawn_gun.weapon_info.start_mags)
if !gun_held:
GameGlobals.held_guns.append(gun_resource)
var instance_gun = gun_resource.instantiate()
var weapon_id = GameGlobals.held_guns.size() - 1
@@ -35,6 +37,17 @@ func picked_up():
SignalBus.emit_signal("weapon_list_changed")
queue_free()
func add_ammo(new_gun,gun_name,ammo_type,special_bullet_name,max_ammo,start_mags):
if new_gun:
GameGlobals.gun_ammo[gun_name] = max_ammo
if GameGlobals.ammo_reserve.has(str(ammo_type)):
GameGlobals.ammo_reserve[str(ammo_type)] += start_mags * max_ammo
else:
GameGlobals.ammo_reserve[str(ammo_type)] = start_mags * max_ammo
print("GUN AMMO ",GameGlobals.gun_ammo)
print("RESERVE AMMO ", GameGlobals.ammo_reserve)
func save():
var save_dict = {
"filename" : get_scene_file_path(),

View File

@@ -26,7 +26,7 @@ class_name weapon_resource
@export var vibration_strong_magnitude : float = .5
@export var vibration_duration = .1
@export_group("Revolver Settings")
@export var chamber_rot_amount = 60.0
@export var chamber_rot_amount = 60.0 ## In degrees per bullet fired
@export_group("Shotgun Settings")
@export var shotgun_spread : Vector3 = Vector3(.1,.1,.1)
@export var pellets_per_shot : int = 20