diff --git a/export_presets.cfg b/export_presets.cfg index 06908bc..2832ffc 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -8,7 +8,7 @@ custom_features="" export_filter="all_resources" include_filter="resources/Maps/*.sc2.mpz" exclude_filter="build/*, snapshots/*, resources/TestScenes/*, resources/HDR/*, addons/customization/*, addons/visual_shader_node_library/examples/*" -export_path="build/sc_test_7_mac.dmg" +export_path="build/sc_test_8_mac.dmg" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false diff --git a/native/Cargo.lock b/native/Cargo.lock index e5dc74e..3095bf8 100644 --- a/native/Cargo.lock +++ b/native/Cargo.lock @@ -274,7 +274,7 @@ dependencies = [ [[package]] name = "godot-rust-script" version = "0.1.0" -source = "git+https://github.com/titannano/godot-rust-script?rev=da275fb0cb61e24571295c8d5a3cce4123fdce24#da275fb0cb61e24571295c8d5a3cce4123fdce24" +source = "git+https://github.com/titannano/godot-rust-script?rev=7549d6fc208c545d3f06f02a68a7ce163073ce5d#7549d6fc208c545d3f06f02a68a7ce163073ce5d" dependencies = [ "const-str", "godot", @@ -288,7 +288,7 @@ dependencies = [ [[package]] name = "godot-rust-script-derive" version = "0.1.0" -source = "git+https://github.com/titannano/godot-rust-script?rev=da275fb0cb61e24571295c8d5a3cce4123fdce24#da275fb0cb61e24571295c8d5a3cce4123fdce24" +source = "git+https://github.com/titannano/godot-rust-script?rev=7549d6fc208c545d3f06f02a68a7ce163073ce5d#7549d6fc208c545d3f06f02a68a7ce163073ce5d" dependencies = [ "darling", "proc-macro2", diff --git a/native/Cargo.toml b/native/Cargo.toml index c4fc01f..d1127ff 100644 --- a/native/Cargo.toml +++ b/native/Cargo.toml @@ -19,4 +19,4 @@ thiserror = "1.0.56" anyhow = { version = "1.0.79" } rand = "0.8.5" -godot-rust-script = { git = "https://github.com/titannano/godot-rust-script", rev = "da275fb0cb61e24571295c8d5a3cce4123fdce24" } +godot-rust-script = { git = "https://github.com/titannano/godot-rust-script", rev = "7549d6fc208c545d3f06f02a68a7ce163073ce5d" } diff --git a/native/src/scripts/mod.rs b/native/src/scripts/mod.rs index 3f7c780..a4ba9e8 100644 --- a/native/src/scripts/mod.rs +++ b/native/src/scripts/mod.rs @@ -1,3 +1,4 @@ +mod objects; mod particles; mod spawner; mod world; diff --git a/native/src/scripts/objects.rs b/native/src/scripts/objects.rs new file mode 100644 index 0000000..3c8e855 --- /dev/null +++ b/native/src/scripts/objects.rs @@ -0,0 +1 @@ +mod building; diff --git a/native/src/scripts/objects/building.rs b/native/src/scripts/objects/building.rs new file mode 100644 index 0000000..99bfba7 --- /dev/null +++ b/native/src/scripts/objects/building.rs @@ -0,0 +1,190 @@ +use godot::{ + builtin::{Array, NodePath, Transform3D, Vector3}, + engine::{MeshInstance3D, Node, Node3D, PackedScene, ResourceLoader, Time}, + meta::ToGodot, + obj::{Gd, Inherits}, +}; +use godot_rust_script::{godot_script_impl, Context, GodotScript}; +use rand::Rng; +use std::fmt::Debug; + +use crate::{util::logger, world::city_data::TileCoords}; + +trait BuildingFeature>: Debug { + fn process(&mut self, _delta: f64, _node: &mut Gd) {} + fn physics_process(&mut self, _delta: f64, _node: &mut Gd) {} +} + +struct BuildingEventFlags(u8); + +impl BuildingEventFlags { + fn fire(&self) -> bool { + self.0 & 0b00000001 == 1 + } +} + +#[derive(Debug)] +struct Features(Vec>); + +impl Features { + pub fn push(&mut self, feature: Box) { + self.0.push(feature); + } +} + +impl Default for Features { + fn default() -> Self { + Self(Vec::default()) + } +} + +impl> BuildingFeature for Features> { + fn process(&mut self, delta: f64, node: &mut Gd) { + for item in self.0.iter_mut() { + item.process(delta, node); + } + } + + fn physics_process(&mut self, delta: f64, node: &mut Gd) { + for item in self.0.iter_mut() { + item.physics_process(delta, node); + } + } +} + +const FIRE_SPAWNER_SCENE: &str = "res://resources/Objects/Spawner/fire_spawner.tscn"; + +#[derive(Debug)] +struct FireFeature { + fire_scene: Option>, + last_fire: u64, + building_mesh: Gd, + tile_coords: TileCoords, +} + +impl FireFeature { + fn new(tile_coords: TileCoords, mesh: &Gd) -> Self { + Self { + fire_scene: None, + last_fire: 0, + building_mesh: mesh.to_owned(), + tile_coords, + } + } +} + +impl> BuildingFeature for FireFeature { + fn process(&mut self, _delta: f64, node: &mut Gd) { + let current_ticks = Time::singleton().get_ticks_msec(); + + if let Some(ref mut scene) = self.fire_scene { + if current_ticks - self.last_fire < 60_000 { + return; + } + + scene.queue_free(); + self.fire_scene = None; + return; + } + + let tick_delta = current_ticks - self.last_fire; + let tick_boost = (tick_delta + 10_000) as f64 / 10_000.0; + let rng = rand::thread_rng().gen_range(0.0..1.0); + + let chance = rng * tick_boost; + + if chance < 0.5 { + return; + } + + let Some(scene) = ResourceLoader::singleton() + .load_ex(FIRE_SPAWNER_SCENE.into()) + .type_hint("PackedScene".into()) + .done() + else { + logger::error!("Failed to load fire_spawner scene: {}", FIRE_SPAWNER_SCENE); + return; + }; + + let Some(mut scene_instance) = scene.cast::().try_instantiate_as::() + else { + logger::error!( + "Failed to instantiate fire_spawner scene as decendant of Node3D: {}", + FIRE_SPAWNER_SCENE + ); + return; + }; + + let aabb = self.building_mesh.get_aabb(); + let aabb_size = (Transform3D::new(self.building_mesh.get_basis(), Vector3::default()) + * aabb.size) + .abs(); + + scene_instance.call_deferred("resize".into(), &[aabb_size.to_variant()]); + + node.upcast_mut() + .add_child_ex(scene_instance.clone().upcast()) + .force_readable_name(true) + .done(); + + self.fire_scene = Some(scene_instance); + self.last_fire = current_ticks; + + logger::info!("Building started burning: {:?}", self.tile_coords); + } +} + +#[derive(GodotScript, Debug)] +#[script(base = Node)] +struct Building { + #[export(flags = ["Fire:1"])] + pub events: u8, + + #[export(node_path = ["MeshInstance3D"])] + pub mesh_path: NodePath, + + pub tile_coords_array: Array, + + tile_coords: TileCoords, + + mesh: Option>, + features: Features>, + + base: Gd, +} + +#[godot_script_impl] +impl Building { + pub fn _ready(&mut self, mut context: Context) { + let events = BuildingEventFlags(self.events); + + self.mesh = { + let mesh_path = self.mesh_path.clone(); + let base = self.base.clone(); + + context.reentrant_scope(self, || base.try_get_node_as(mesh_path.to_owned())) + }; + + self.tile_coords = ( + self.tile_coords_array.get(0).unwrap_or(0), + self.tile_coords_array.get(1).unwrap_or(0), + ); + + if events.fire() { + if let Some(ref mesh) = self.mesh { + self.features + .push(Box::new(FireFeature::new(self.tile_coords, mesh))); + } else { + logger::warn!("Unable to instantiate FireFeature because no mesh has been set."); + } + } + } + + pub fn _process(&mut self, delta: f64) { + self.features.process(delta, &mut self.base); + } + + pub fn _physics_process(&mut self, delta: f64) { + self.features.physics_process(delta, &mut self.base); + } +} diff --git a/native/src/scripts/spawner/fire_spawner.rs b/native/src/scripts/spawner/fire_spawner.rs new file mode 100644 index 0000000..e0e355f --- /dev/null +++ b/native/src/scripts/spawner/fire_spawner.rs @@ -0,0 +1,98 @@ +use godot::{ + builtin::{NodePath, Transform3D, Vector3, Vector3Axis}, + engine::{light_3d, AnimationPlayer, FogVolume, Node, OmniLight3D}, + obj::Gd, +}; +use godot_rust_script::{godot_script_impl, GodotScript}; + +use crate::util::logger; + +#[derive(GodotScript, Debug)] +#[script(base = Node)] +struct FireSpawner { + #[export(node_path = ["FogVolume"])] + pub fire_path: NodePath, + fire: Option>, + + #[export(node_path = ["FogVolume"])] + pub smoke_path: NodePath, + smoke: Option>, + + #[export(node_path = ["OmniLight3D"])] + pub light_source_path: NodePath, + light_source: Option>, + + #[export(node_path = ["AnimationPlayer"])] + pub audio_player_path: NodePath, + audio_player: Option>, + + base: Gd, +} + +#[godot_script_impl] +impl FireSpawner { + pub fn _ready(&mut self) { + logger::debug!("Init Fire spawner..."); + self.fire = self.base.try_get_node_as(self.fire_path.clone()); + self.smoke = self.base.try_get_node_as(self.smoke_path.clone()); + self.audio_player = self.base.try_get_node_as(self.audio_player_path.clone()); + self.light_source = self.base.try_get_node_as(self.light_source_path.clone()); + + if let Some(ref mut audio_player) = self.audio_player { + audio_player.set_current_animation("burning".into()); + } else { + logger::warn!("No audio player has been setup!"); + } + } + + pub fn resize(&mut self, size: Vector3) { + logger::debug!("Resizing fire spawner..."); + let Some(ref mut fire) = self.fire else { + logger::error!("Failed to resize fire spawner! No fire setup!"); + return; + }; + + let Some(ref mut smoke) = self.smoke else { + logger::error!("Failed to resize fire spawner! No smoke setup!"); + return; + }; + + let Some(ref mut light_source) = self.light_source else { + logger::error!("Failed to resize fire spawner! No light source setup!"); + return; + }; + + let smoke_ratio = smoke.get_size() / fire.get_size(); + let fire_size = size * Vector3::new(1.0, 1.5, 1.0); + let smoke_size = fire_size * smoke_ratio; + let light_size = size; + + fire.set_size(fire_size); + fire.set_transform(Transform3D::default().translated(Vector3::new( + 0.0, + fire_size.y / 2.0 * 0.9, + 0.0, + ))); + + smoke.set_size(smoke_size); + smoke.set_transform(Transform3D::default().translated(Vector3::new( + 0.0, + smoke_size.y / 2.0 * 1.2, + 0.0, + ))); + + let light_max_size = match light_size.max_axis().unwrap_or(Vector3Axis::X) { + Vector3Axis::X => light_size.x, + Vector3Axis::Y => light_size.y, + Vector3Axis::Z => light_size.z, + }; + + light_source.set_param(light_3d::Param::RANGE, light_size.length_squared()); + light_source.set_param(light_3d::Param::SIZE, light_max_size); + light_source.set_transform(Transform3D::default().translated(Vector3::new( + 0.0, + light_size.y / 2.0, + 0.0, + ))) + } +} diff --git a/native/src/scripts/spawner/mod.rs b/native/src/scripts/spawner/mod.rs index c280376..c339ea4 100644 --- a/native/src/scripts/spawner/mod.rs +++ b/native/src/scripts/spawner/mod.rs @@ -1 +1,2 @@ mod car_spawner; +mod fire_spawner; diff --git a/native/src/scripts/world/buildings.rs b/native/src/scripts/world/buildings.rs index 5d0a155..6204158 100644 --- a/native/src/scripts/world/buildings.rs +++ b/native/src/scripts/world/buildings.rs @@ -147,11 +147,22 @@ impl Buildings { )); } - let (Some(mut instance), instance_time) = with_timing(|| object.instantiate()) else { + let (Some(mut instance), instance_time) = + with_timing(|| object.try_instantiate_as::()) + else { logger::error!("failed to instantiate building {}", name); return; }; + if !instance.get("tile_coords_array".into()).is_nil() { + let mut array = Array::new(); + + array.push(tile_coords.0); + array.push(tile_coords.1); + + instance.set("tile_coords_array".into(), array.to_variant()); + } + let mut location = self.city_coords_feature.get_building_coords( tile_coords.0, tile_coords.1, @@ -164,7 +175,7 @@ impl Buildings { let (_, insert_time) = with_timing(|| { self.get_sector(tile_coords) - .add_child_ex(instance.clone()) + .add_child_ex(instance.clone().upcast()) .force_readable_name(true) .done(); diff --git a/project.godot b/project.godot index e56ab1c..e7f07e6 100644 --- a/project.godot +++ b/project.godot @@ -116,9 +116,9 @@ limits/debugger_stdout/max_chars_per_second=1000000 [physics] 3d/default_gravity=9.81 +common/physics_interpolation=true common/physics_fps=120 common/enable_pause_aware_picking=true -common/physics_interpolation=true [rendering] @@ -126,6 +126,7 @@ textures/vram_compression/import_s3tc_bptc=true lights_and_shadows/directional_shadow/size=8192 lights_and_shadows/directional_shadow/soft_shadow_filter_quality=4 lights_and_shadows/directional_shadow/16_bits=false +environment/volumetric_fog/volume_size=200 +environment/volumetric_fog/volume_depth=200 lights_and_shadows/positional_shadow/atlas_16_bits=false threads/thread_model=2 -environment/default_environment="res://resources/Environments/default_env.tres" diff --git a/resources/Environments/WorldEnv.tres b/resources/Environments/WorldEnv.tres index 4fe3f64..2f28015 100644 --- a/resources/Environments/WorldEnv.tres +++ b/resources/Environments/WorldEnv.tres @@ -18,3 +18,6 @@ ssao_enabled = true sdfgi_enabled = true fog_light_color = Color(0.65, 0.84, 0.95, 1) fog_density = 0.001 +volumetric_fog_enabled = true +volumetric_fog_density = 0.0 +volumetric_fog_length = 2000.0 diff --git a/resources/Environments/default_env.tres b/resources/Environments/default_env.tres index 8b548b6..bb5d9ff 100644 --- a/resources/Environments/default_env.tres +++ b/resources/Environments/default_env.tres @@ -1,10 +1,14 @@ -[gd_resource type="Environment" load_steps=2 format=2] +[gd_resource type="Environment" load_steps=3 format=3 uid="uid://dq1rh4w14o3ri"] -[sub_resource type="Sky" id=1] +[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_tv10b"] + +[sub_resource type="Sky" id="1"] +sky_material = SubResource("ProceduralSkyMaterial_tv10b") [resource] background_mode = 2 -background_sky = SubResource( 1 ) -ss_reflections_enabled = true -dof_blur_far_distance = 180.0 -dof_blur_far_transition = 0.45 +sky = SubResource("1") +volumetric_fog_enabled = true +volumetric_fog_density = 0.0 +volumetric_fog_anisotropy = -3.46945e-18 +volumetric_fog_length = 2000.0 diff --git a/resources/Materials/fire_material.tres b/resources/Materials/fire_material.tres new file mode 100644 index 0000000..024be08 --- /dev/null +++ b/resources/Materials/fire_material.tres @@ -0,0 +1,54 @@ +[gd_resource type="ShaderMaterial" load_steps=10 format=3 uid="uid://dm0vav0ade2gp"] + +[ext_resource type="Shader" uid="uid://b3ohn1ek5kics" path="res://resources/Shaders/fire_shader.tres" id="1_p6ais"] + +[sub_resource type="Gradient" id="Gradient_qagn7"] +offsets = PackedFloat32Array(0.185096, 0.512019, 0.992788) +colors = PackedColorArray(0.768627, 0.0745098, 0.00392157, 1, 0.980392, 0.309804, 0.00392157, 1, 0.992157, 0.705882, 0.0509804, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_gmckf"] +gradient = SubResource("Gradient_qagn7") + +[sub_resource type="Gradient" id="Gradient_hkbw6"] +offsets = PackedFloat32Array(0.514423, 1) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_rbw6l"] +noise_type = 0 +seed = 2 +frequency = 0.03 +fractal_lacunarity = 6.0 + +[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_td2w5"] +width = 100 +height = 100 +depth = 100 +seamless = true +seamless_blend_skirt = 0.5 +color_ramp = SubResource("Gradient_hkbw6") +noise = SubResource("FastNoiseLite_rbw6l") + +[sub_resource type="Gradient" id="Gradient_hx50x"] +colors = PackedColorArray(0, 0, 0, 1, 0.74558, 0.74558, 0.74558, 1) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_b0r66"] +frequency = 0.008 +fractal_type = 2 +fractal_octaves = 2 + +[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_as1dx"] +width = 256 +height = 256 +depth = 256 +seamless = true +seamless_blend_skirt = 0.5 +color_ramp = SubResource("Gradient_hx50x") +noise = SubResource("FastNoiseLite_b0r66") + +[resource] +shader = ExtResource("1_p6ais") +shader_parameter/density = 8.0 +shader_parameter/height_falloff = 0.5 +shader_parameter/strength = 2.0 +shader_parameter/color = SubResource("GradientTexture1D_gmckf") +shader_parameter/density_texture = SubResource("NoiseTexture3D_td2w5") +shader_parameter/flame_texture = SubResource("NoiseTexture3D_as1dx") diff --git a/resources/Materials/smoke_material.tres b/resources/Materials/smoke_material.tres new file mode 100644 index 0000000..d69c7e9 --- /dev/null +++ b/resources/Materials/smoke_material.tres @@ -0,0 +1,26 @@ +[gd_resource type="ShaderMaterial" load_steps=5 format=3 uid="uid://dbuspcbhwqr7g"] + +[ext_resource type="Shader" uid="uid://dwmxlfa00u2l7" path="res://resources/Shaders/smoke_shader.tres" id="1_hb22f"] + +[sub_resource type="Gradient" id="Gradient_tt0nr"] +offsets = PackedFloat32Array(0.466346, 1) + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_vso3d"] +seed = 1 +fractal_octaves = 3 +fractal_gain = 0.7 + +[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_xjpji"] +width = 100 +height = 100 +depth = 100 +seamless = true +seamless_blend_skirt = 0.5 +color_ramp = SubResource("Gradient_tt0nr") +noise = SubResource("FastNoiseLite_vso3d") + +[resource] +shader = ExtResource("1_hb22f") +shader_parameter/density = 0.8 +shader_parameter/color = Color(0.133196, 0.133196, 0.133196, 1) +shader_parameter/density_texture = SubResource("NoiseTexture3D_xjpji") diff --git a/resources/Objects/Buildings/condominiums_medium_2.tscn b/resources/Objects/Buildings/condominiums_medium_2.tscn index 9948521..27ccfcc 100644 --- a/resources/Objects/Buildings/condominiums_medium_2.tscn +++ b/resources/Objects/Buildings/condominiums_medium_2.tscn @@ -1,11 +1,15 @@ -[gd_scene load_steps=3 format=3 uid="uid://c8umigs5eeyn3"] +[gd_scene load_steps=4 format=3 uid="uid://c8umigs5eeyn3"] [ext_resource type="PackedScene" uid="uid://bmfjmd3guekcu" path="res://resources/Meshes/Buildings/Condominiums/medium_2.gltf" id="1"] +[ext_resource type="Script" path="res://native/src/scripts/objects/building.rs" id="2_gr7u5"] [sub_resource type="ConcavePolygonShape3D" id="1"] data = PackedVector3Array(9.555, -10.585, -19.2257, 9.555, 10.085, -19.7743, 9.555, -10.585, -19.7743, 9.555, -10.585, -19.2257, 9.555, 10.085, -19.2257, 9.555, 10.085, -19.7743, -3.0961, 7.2485, -19.7743, -3.0961, 10.085, -19.2257, -3.0961, 10.085, -19.7743, -3.0961, 7.2485, -19.7743, -3.0961, 7.2485, -19.2257, -3.0961, 10.085, -19.2257, 9.0153, -10, -19.7743, 9, 9.5, -23, 9.0153, -10, -23, 9.0153, -10, -19.7743, 9, 9.5, -19.7743, 9, 9.5, -23, -3.6812, 9.5, -19.7743, -3.6812, 6.3529, -23, -3.6812, 6.3529, -19.7743, -3.6812, 9.5, -19.7743, -3.6812, 9.5, -23, -3.6812, 6.3529, -23, -10.055, -10.585, -19.7743, -10.055, 10.085, -19.2257, -10.055, -10.585, -19.2257, -10.055, -10.585, -19.7743, -10.055, 10.085, -19.7743, -10.055, 10.085, -19.2257, 2.9207, 7.2485, -19.2257, 2.9207, 10.085, -19.7743, 2.9207, 10.085, -19.2257, 2.9207, 7.2485, -19.2257, 2.9207, 7.2485, -19.7743, 2.9207, 10.085, -19.7743, -9.5, -10, -23, -9.5, 9.5, -19.7743, -9.5, -10, -19.7743, -9.5, -10, -23, -9.5, 9.5, -23, -9.5, 9.5, -19.7743, 3.4875, 9.5, -23, 3.4875, 6.3529, -19.7743, 3.4875, 6.3529, -23, 3.4875, 9.5, -23, 3.4875, 9.5, -19.7743, 3.4875, 6.3529, -19.7743, 3.4875, 9.5, -19.2257, 3.4875, 6.3529, 0, 3.4875, 6.3529, -19.2257, 3.4875, 9.5, -19.2257, 3.4875, 9.5, 0, 3.4875, 6.3529, 0, -9.5, -10, -19.2257, -9.5, 9.5, 0, -9.5, -10, 0, -9.5, -10, -19.2257, -9.5, 9.5, -19.2257, -9.5, 9.5, 0, -3.6812, 6.3529, -19.2257, -3.6812, 9.5, 0, -3.6812, 9.5, -19.2257, -3.6812, 6.3529, -19.2257, -3.6812, 6.3529, 0, -3.6812, 9.5, 0, 9.0153, -10, 0, 9, 9.5, -19.2257, 9.0153, -10, -19.2258, 9.0153, -10, 0, 9, 9.5, 0, 9, 9.5, -19.2257, 9.555, 10.085, -19.2257, 9.0153, -10, -19.2258, 9, 9.5, -19.2257, 9.555, 10.085, -19.2257, 9.555, -10.585, -19.2257, 9.0153, -10, -19.2258, 2.9207, 10.085, -19.2257, 9, 9.5, -19.2257, 3.4875, 9.5, -19.2257, 2.9207, 10.085, -19.2257, 9.555, 10.085, -19.2257, 9, 9.5, -19.2257, 2.9207, 7.2485, -19.2257, 3.4875, 9.5, -19.2257, 3.4875, 6.3529, -19.2257, 2.9207, 7.2485, -19.2257, 2.9207, 10.085, -19.2257, 3.4875, 9.5, -19.2257, -10.055, -10.585, -19.2257, -9.5, 9.5, -19.2257, -9.5, -10, -19.2257, -10.055, -10.585, -19.2257, -10.055, 10.085, -19.2257, -9.5, 9.5, -19.2257, -3.0961, 10.085, -19.2257, -3.6812, 6.3529, -19.2257, -3.6812, 9.5, -19.2257, -3.0961, 10.085, -19.2257, -3.0961, 7.2485, -19.2257, -3.6812, 6.3529, -19.2257, 9.555, -10.585, -19.2257, -9.5, -10, -19.2257, 9.0153, -10, -19.2258, 9.555, -10.585, -19.2257, -10.055, -10.585, -19.2257, -9.5, -10, -19.2257, -3.6812, 6.3529, -19.2257, 2.9207, 7.2485, -19.2257, 3.4875, 6.3529, -19.2257, -3.6812, 6.3529, -19.2257, -3.0961, 7.2485, -19.2257, 2.9207, 7.2485, -19.2257, -10.055, 10.085, -19.2257, -3.6812, 9.5, -19.2257, -9.5, 9.5, -19.2257, -10.055, 10.085, -19.2257, -3.0961, 10.085, -19.2257, -3.6812, 9.5, -19.2257, 9.555, 10.085, -19.7743, 2.9207, 10.085, -19.2257, 2.9207, 10.085, -19.7743, 9.555, 10.085, -19.7743, 9.555, 10.085, -19.2257, 2.9207, 10.085, -19.2257, -3.0961, 10.085, -19.2257, -10.055, 10.085, -19.7743, -3.0961, 10.085, -19.7743, -3.0961, 10.085, -19.2257, -10.055, 10.085, -19.2257, -10.055, 10.085, -19.7743, 2.9207, 7.2485, -19.7743, -3.0961, 7.2485, -19.2257, -3.0961, 7.2485, -19.7743, 2.9207, 7.2485, -19.7743, 2.9207, 7.2485, -19.2257, -3.0961, 7.2485, -19.2257, -3.6812, 9.5, -23, -9.5, 9.5, -19.7743, -9.5, 9.5, -23, -3.6812, 9.5, -23, -3.6812, 9.5, -19.7743, -9.5, 9.5, -19.7743, 9, 9.5, -23, 3.4875, 9.5, -19.7743, 3.4875, 9.5, -23, 9, 9.5, -23, 9, 9.5, -19.7743, 3.4875, 9.5, -19.7743, 3.4875, 6.3529, -23, -3.6812, 6.3529, -19.7743, -3.6812, 6.3529, -23, 3.4875, 6.3529, -23, 3.4875, 6.3529, -19.7743, -3.6812, 6.3529, -19.7743, -10.055, 10.085, -19.7743, -9.5, -10, -19.7743, -9.5, 9.5, -19.7743, -10.055, 10.085, -19.7743, -10.055, -10.585, -19.7743, -9.5, -10, -19.7743, -3.0961, 10.085, -19.7743, -9.5, 9.5, -19.7743, -3.6812, 9.5, -19.7743, -3.0961, 10.085, -19.7743, -10.055, 10.085, -19.7743, -9.5, 9.5, -19.7743, -3.0961, 10.085, -19.7743, -3.6812, 6.3529, -19.7743, -3.0961, 7.2485, -19.7743, -3.0961, 10.085, -19.7743, -3.6812, 9.5, -19.7743, -3.6812, 6.3529, -19.7743, 9.555, -10.585, -19.7743, 9, 9.5, -19.7743, 9.0153, -10, -19.7743, 9.555, -10.585, -19.7743, 9.555, 10.085, -19.7743, 9, 9.5, -19.7743, 3.4875, 6.3529, -19.7743, 2.9207, 10.085, -19.7743, 2.9207, 7.2485, -19.7743, 3.4875, 6.3529, -19.7743, 3.4875, 9.5, -19.7743, 2.9207, 10.085, -19.7743, -10.055, -10.585, -19.7743, 9.0153, -10, -19.7743, -9.5, -10, -19.7743, -10.055, -10.585, -19.7743, 9.555, -10.585, -19.7743, 9.0153, -10, -19.7743, 3.4875, 6.3529, -19.7743, -3.0961, 7.2485, -19.7743, -3.6812, 6.3529, -19.7743, 3.4875, 6.3529, -19.7743, 2.9207, 7.2485, -19.7743, -3.0961, 7.2485, -19.7743, 9.555, 10.085, -19.7743, 3.4875, 9.5, -19.7743, 9, 9.5, -19.7743, 9.555, 10.085, -19.7743, 2.9207, 10.085, -19.7743, 3.4875, 9.5, -19.7743, -3.6812, 9.5, -23, -9.5, -10, -23, -3.6812, 6.3529, -23, -3.6812, 9.5, -23, -9.5, 9.5, -23, -9.5, -10, -23, 9.0153, -10, -23, 3.4875, 9.5, -23, 3.4875, 6.3529, -23, 9.0153, -10, -23, 9, 9.5, -23, 3.4875, 9.5, -23, -9.5, -10, -23, 3.4875, 6.3529, -23, -3.6812, 6.3529, -23, -9.5, -10, -23, 9.0153, -10, -23, 3.4875, 6.3529, -23, -10.055, -10.585, -19.7743, 9.555, -10.585, -19.2257, 9.555, -10.585, -19.7743, -10.055, -10.585, -19.7743, -10.055, -10.585, -19.2257, 9.555, -10.585, -19.2257, 9.0153, -10, -23, -9.5, -10, -19.7743, 9.0153, -10, -19.7743, 9.0153, -10, -23, -9.5, -10, -23, -9.5, -10, -19.7743, 3.4875, 9.5, 0, 9, 9.5, -19.2257, 9, 9.5, 0, 3.4875, 9.5, 0, 3.4875, 9.5, -19.2257, 9, 9.5, -19.2257, 3.4875, 6.3529, -19.2257, -3.6812, 6.3529, 0, -3.6812, 6.3529, -19.2257, 3.4875, 6.3529, -19.2257, 3.4875, 6.3529, 0, -3.6812, 6.3529, 0, -9.5, 9.5, 0, -3.6812, 9.5, -19.2257, -3.6812, 9.5, 0, -9.5, 9.5, 0, -9.5, 9.5, -19.2257, -3.6812, 9.5, -19.2257, 9.0153, -10, 0, -9.5, -10, -19.2257, -9.5, -10, 0, 9.0153, -10, 0, 9.0153, -10, -19.2258, -9.5, -10, -19.2257) [node name="CondominiumsMedium2" instance=ExtResource("1")] +script = ExtResource("2_gr7u5") +events = 1 +mesh_path = NodePath("Maxis-3d3-mesh-33") [node name="CollisionShape3D" type="CollisionShape3D" parent="." index="1"] transform = Transform3D(1, 0, 0, 0, -1.19209e-07, -1, 0, 1, -1.19209e-07, 0, 0, 0) diff --git a/resources/Objects/Buildings/home_middle_class_3.tscn b/resources/Objects/Buildings/home_middle_class_3.tscn index 4e24aea..acebbb5 100644 --- a/resources/Objects/Buildings/home_middle_class_3.tscn +++ b/resources/Objects/Buildings/home_middle_class_3.tscn @@ -1,11 +1,15 @@ -[gd_scene load_steps=3 format=3 uid="uid://5lcllve4d4s5"] +[gd_scene load_steps=4 format=3 uid="uid://5lcllve4d4s5"] [ext_resource type="PackedScene" uid="uid://h1n7d1h23vcn" path="res://resources/Meshes/Buildings/Home/middle_class_3.gltf" id="1"] +[ext_resource type="Script" path="res://native/src/scripts/objects/building.rs" id="2_dq8cm"] [sub_resource type="ConcavePolygonShape3D" id="1"] data = PackedVector3Array(-7.4048, -0.1789, 0.0228, 7.2402, -0.1786, -4.8684, 7.2402, -0.1786, 0.0228, -7.4048, -0.1789, 0.0228, -7.4048, -0.1789, -4.8684, 7.2402, -0.1786, -4.8684, -7.4594, 7.2653, 0.0228, -0.4521, 7.2653, -4.8684, -0.4521, 7.2653, 0.0228, -7.4594, 7.2653, 0.0228, -7.4594, 7.2653, -4.8684, -0.4521, 7.2653, -4.8684, -7.4042, -7.0032, -4.8684, 7.2408, -7.0032, 0.0228, 7.2408, -7.0032, -4.8684, -7.4042, -7.0032, -4.8684, -7.4042, -7.0032, 0.0228, 7.2408, -7.0032, 0.0228, -7.4594, 0.4408, -4.8684, -0.4521, 0.4408, 0.0228, -0.4521, 0.4408, -4.8684, -7.4594, 0.4408, -4.8684, -7.4594, 0.4408, 0.0228, -0.4521, 0.4408, 0.0228, -7.4042, -7.0032, 0.0228, -7.4048, -0.1789, -4.8684, -7.4048, -0.1789, 0.0228, -7.4042, -7.0032, 0.0228, -7.4042, -7.0032, -4.8684, -7.4048, -0.1789, -4.8684, -7.4594, 0.4408, 0.0228, -7.4594, 7.2653, -4.8684, -7.4594, 7.2653, 0.0228, -7.4594, 0.4408, 0.0228, -7.4594, 0.4408, -4.8684, -7.4594, 7.2653, -4.8684, 7.2408, -7.0032, 0.0228, 7.2402, -0.1786, -4.8684, 7.2408, -7.0032, -4.8684, 7.2408, -7.0032, 0.0228, 7.2402, -0.1786, 0.0228, 7.2402, -0.1786, -4.8684, -0.4521, 0.4408, 0.0228, -0.4521, 7.2653, -4.8684, -0.4521, 0.4408, -4.8684, -0.4521, 0.4408, 0.0228, -0.4521, 7.2653, 0.0228, -0.4521, 7.2653, -4.8684, -7.4048, -0.1789, -4.8684, -7.4042, -7.0032, -4.8684, -7.4045, -3.6063, -6.8183, -7.4594, 7.2653, -4.8684, -7.4594, 0.4408, -4.8684, -7.4594, 3.8531, -6.8183, 7.2402, -0.1786, -4.8684, 7.2405, -3.6235, -6.8183, 7.2408, -7.0032, -4.8684, -0.4521, 7.2653, -4.8684, -0.4521, 3.8531, -6.8183, -0.4521, 0.4408, -4.8684, -7.4045, -3.6063, -6.8183, -7.4042, -7.0032, -4.8684, 7.2405, -3.6235, -6.8183, 7.2405, -3.6235, -6.8183, -7.4042, -7.0032, -4.8684, 7.2408, -7.0032, -4.8684, -7.4594, 3.8531, -6.8183, -0.4521, 0.4408, -4.8684, -0.4521, 3.8531, -6.8183, -7.4594, 3.8531, -6.8183, -7.4594, 0.4408, -4.8684, -0.4521, 0.4408, -4.8684, -7.4048, -0.1789, -4.8684, -7.4045, -3.6063, -6.8183, 7.2402, -0.1786, -4.8684, 7.2402, -0.1786, -4.8684, -7.4045, -3.6063, -6.8183, 7.2405, -3.6235, -6.8183, -7.4594, 7.2653, -4.8684, -0.4521, 3.8531, -6.8183, -0.4521, 7.2653, -4.8684, -7.4594, 7.2653, -4.8684, -7.4594, 3.8531, -6.8183, -0.4521, 3.8531, -6.8183) [node name="HomeMiddleClass3" instance=ExtResource("1")] +script = ExtResource("2_dq8cm") +events = 1 +mesh_path = NodePath("Maxis-3d3-mesh-14") [node name="CollisionShape3D" type="CollisionShape3D" parent="." index="1"] transform = Transform3D(1, 0, 0, 0, -1.19209e-07, -1, 0, 1, -1.19209e-07, 0, 0, 0) diff --git a/resources/Objects/Buildings/office_building_medium_4.tscn b/resources/Objects/Buildings/office_building_medium_4.tscn index 148e325..13b575a 100644 --- a/resources/Objects/Buildings/office_building_medium_4.tscn +++ b/resources/Objects/Buildings/office_building_medium_4.tscn @@ -1,11 +1,15 @@ -[gd_scene load_steps=3 format=3 uid="uid://b0uxnw5wje6y4"] +[gd_scene load_steps=4 format=3 uid="uid://b0uxnw5wje6y4"] [ext_resource type="PackedScene" uid="uid://dpq3c588herdb" path="res://resources/Meshes/Buildings/Offices/medium_4.gltf" id="1"] +[ext_resource type="Script" path="res://native/src/scripts/objects/building.rs" id="2_67wch"] [sub_resource type="ConcavePolygonShape3D" id="1"] data = PackedVector3Array(-5.9282, -8.5068, -52.6606, -5.9955, -8.5741, -52.6606, -5.9282, -8.5741, -52.6606, -5.9282, -8.5068, -52.6606, -5.9955, -8.5068, -52.6606, -5.9955, -8.5741, -52.6606, -6.0444, -8.4579, -48.7429, -5.9282, -8.5068, -52.6606, -5.8792, -8.4579, -48.7429, -6.0444, -8.4579, -48.7429, -5.9955, -8.5068, -52.6606, -5.9282, -8.5068, -52.6606, -5.9955, -8.5068, -52.6606, -6.0444, -8.623, -48.7429, -5.9955, -8.5741, -52.6606, -5.9955, -8.5068, -52.6606, -6.0444, -8.4579, -48.7429, -6.0444, -8.623, -48.7429, -5.9282, -8.5741, -52.6606, -5.8792, -8.4579, -48.7429, -5.9282, -8.5068, -52.6606, -5.9282, -8.5741, -52.6606, -5.8792, -8.623, -48.7429, -5.8792, -8.4579, -48.7429, -5.9955, -8.5741, -52.6606, -5.8792, -8.623, -48.7429, -5.9282, -8.5741, -52.6606, -5.9955, -8.5741, -52.6606, -6.0444, -8.623, -48.7429, -5.8792, -8.623, -48.7429, 3.0146, 0.5024, -48.7429, -5.8792, -8.4579, -48.7429, 3.0146, -9.0439, -48.7429, 3.0146, 0.5024, -48.7429, -6.5317, 0.5024, -48.7429, -5.8792, -8.4579, -48.7429, -6.5317, 0.5024, -48.7429, -6.0444, -8.623, -48.7429, -6.0444, -8.4579, -48.7429, -6.5317, 0.5024, -48.7429, -6.5317, -9.0439, -48.7429, -6.0444, -8.623, -48.7429, -5.8792, -8.4579, -48.7429, -6.5317, 0.5024, -48.7429, -6.0444, -8.4579, -48.7429, 3.0146, -9.0439, -48.7429, -5.8792, -8.4579, -48.7429, -5.8792, -8.623, -48.7429, -6.5317, -9.0439, -48.7429, -5.8792, -8.623, -48.7429, -6.0444, -8.623, -48.7429, -6.5317, -9.0439, -48.7429, 3.0146, -9.0439, -48.7429, -5.8792, -8.623, -48.7429, -4.2087, 2.3954, -5.5268, -8.5231, 2.3935, -6.2023, -4.1785, 2.3935, -6.2023, -4.2087, 2.3954, -5.5268, -8.5533, 2.3954, -5.5268, -8.5231, 2.3935, -6.2023, -8.4929, -14.5531, -6.2023, -14.0685, -14.5415, -5.4966, -14.0383, -14.5531, -6.2023, -8.4929, -14.5531, -6.2023, -8.5231, -14.5415, -5.4966, -14.0685, -14.5415, -5.4966, -4.2087, 14.6449, -5.5268, -14.0685, 14.6379, -6.2023, -14.0987, 14.6449, -5.5268, -4.2087, 14.6449, -5.5268, -4.1785, 14.6379, -6.2023, -14.0685, 14.6379, -6.2023, -8.5231, 2.3935, -6.2023, -8.5533, 2.3954, -5.5268, -8.5231, -14.5415, -5.4966, -14.0685, -14.5415, -5.4966, -14.0987, 14.6449, -5.5268, -14.0383, -14.5531, -6.2023, -8.5231, -14.5415, -5.4966, -8.4929, -14.5531, -6.2023, -8.5231, 2.3935, -6.2023, -4.1785, 14.6379, -6.2023, -4.2087, 2.3954, -5.5268, -4.1785, 2.3935, -6.2023, -4.1785, 14.6379, -6.2023, -4.2087, 14.6449, -5.5268, -4.2087, 2.3954, -5.5268, -14.0383, -14.5531, -6.2023, -14.0987, 14.6449, -5.5268, -14.0685, 14.6379, -6.2023, 10.5813, 2.0866, -6.2023, 14.6191, 1.5083, -6.2023, 15.0752, 2.0302, -6.2023, 14.6191, 1.5083, -6.2023, 15.0752, -14.9779, -6.2023, 15.0752, 2.0302, -6.2023, -7.4396, -14.5165, -6.2023, 15.0752, -14.9779, -6.2023, 14.614, -14.5165, -6.2023, 15.0752, -14.9779, -6.2023, -8.4929, -14.5531, -6.2023, -15.0246, -14.9779, -6.2023, 15.0752, -14.9779, -6.2023, -7.4396, -14.5165, -6.2023, -8.4929, -14.5531, -6.2023, 10.5813, 2.0866, -6.2023, 10.5813, 15.1127, -6.2023, 10.0789, 14.6008, -6.2023, -4.1785, 14.6379, -6.2023, 10.0789, 14.6008, -6.2023, 10.5813, 15.1127, -6.2023, -4.1785, 14.6379, -6.2023, -3.4869, 14.6008, -6.2023, 10.0789, 14.6008, -6.2023, 10.0487, 1.5073, -29.1413, -3.517, 14.5706, -29.1413, -3.517, 1.5073, -29.1413, 10.0487, 1.5073, -29.1413, 10.0487, 14.5706, -29.1413, -3.517, 14.5706, -29.1413, 14.5706, 1.5073, -30.1462, 4.0195, 0.5024, -30.1462, 13.5658, 0.5024, -30.1462, 3.0146, 0.5024, -30.1462, -7.5365, 1.5073, -30.1462, -6.5317, 0.5024, -30.1462, 14.5706, 1.5073, -30.1462, 3.0146, 0.5024, -30.1462, 4.0195, 0.5024, -30.1462, 3.0146, 0.5024, -30.1462, 14.5706, 1.5073, -30.1462, -7.5365, 1.5073, -30.1462, -6.5317, 0.5024, -30.1462, -7.5365, 1.5073, -30.1462, -6.5317, -9.0439, -30.1462, -6.5317, -9.0439, -30.1462, -7.4881, -14.5467, -30.0977, 3.0146, -9.0439, -30.1462, -7.4881, -14.5467, -30.0977, -6.5317, -9.0439, -30.1462, -7.5365, 1.5073, -30.1462, 14.5454, -14.5467, -30.0977, 14.5706, 1.5073, -30.1462, 13.5658, 0.5024, -30.1462, 13.5658, -13.0633, -30.1461, 14.5454, -14.5467, -30.0977, 13.5658, 0.5024, -30.1462, -7.4881, -14.5467, -30.0977, 13.5658, -13.0633, -30.1461, 4.0195, -13.0633, -30.1461, -7.4881, -14.5467, -30.0977, 14.5454, -14.5467, -30.0977, 13.5658, -13.0633, -30.1461, 4.0195, 0.5024, -30.1462, 3.0146, -9.0439, -30.1462, 4.0195, -13.0633, -30.1461, 4.0195, 0.5024, -30.1462, 3.0146, 0.5024, -30.1462, 3.0146, -9.0439, -30.1462, 4.0195, -13.0633, -30.1461, 3.0146, -9.0439, -30.1462, -7.4881, -14.5467, -30.0977, 13.5658, 0.5024, -38.6876, 4.0195, -13.0633, -38.6876, 13.5658, -13.0633, -38.6876, 13.5658, 0.5024, -38.6876, 4.0195, 0.5024, -38.6876, 4.0195, -13.0633, -38.6876, -8.5231, 2.3935, -6.2023, -3.4869, 1.49, -6.2023, -4.1785, 2.3935, -6.2023, -8.5231, 2.3935, -6.2023, -7.5064, 1.49, -6.2023, -3.4869, 1.49, -6.2023, -7.5064, 1.49, -6.2023, -8.4929, -14.5531, -6.2023, -7.4396, -14.5165, -6.2023, -7.5064, 1.49, -6.2023, -8.5231, 2.3935, -6.2023, -8.4929, -14.5531, -6.2023, -14.0685, 14.6379, -6.2023, -15.0246, -14.9779, -6.2023, -14.0383, -14.5531, -6.2023, -14.0685, 14.6379, -6.2023, -15.0429, 15.1127, -6.2023, -15.0246, -14.9779, -6.2023, -8.4929, -14.5531, -6.2023, -14.0383, -14.5531, -6.2023, -15.0246, -14.9779, -6.2023, 10.5813, 15.1127, -6.2023, -14.0685, 14.6379, -6.2023, -4.1785, 14.6379, -6.2023, 10.5813, 15.1127, -6.2023, -15.0429, 15.1127, -6.2023, -14.0685, 14.6379, -6.2023, -3.4869, 14.6008, -6.2023, -4.1785, 2.3935, -6.2023, -3.4869, 1.49, -6.2023, -3.4869, 14.6008, -6.2023, -4.1785, 14.6379, -6.2023, -4.1785, 2.3935, -6.2023, -14.0987, 14.6449, -5.5268, -14.0685, -14.5415, -5.4966, -8.5231, -14.5415, -5.4966, -14.0987, 14.6449, -5.5268, -8.5231, -14.5415, -5.4966, -8.5533, 2.3954, -5.5268, -4.2087, 14.6449, -5.5268, -8.5533, 2.3954, -5.5268, -4.2087, 2.3954, -5.5268, -4.2087, 14.6449, -5.5268, -14.0987, 14.6449, -5.5268, -8.5533, 2.3954, -5.5268, -7.5365, 1.5073, -30.1462, -7.5064, 1.49, -6.2023, -7.4881, -14.5467, -30.0977, -7.4881, -14.5467, -30.0977, -7.5064, 1.49, -6.2023, -7.4396, -14.5165, -6.2023, 4.0195, 0.5024, -38.6876, 4.0195, -13.0633, -30.1461, 4.0195, -13.0633, -38.6876, 4.0195, 0.5024, -38.6876, 4.0195, 0.5024, -30.1462, 4.0195, -13.0633, -30.1461, -6.5317, 0.5024, -48.7429, -6.5317, -9.0439, -30.1462, -6.5317, -9.0439, -48.7429, -6.5317, 0.5024, -48.7429, -6.5317, 0.5024, -30.1462, -6.5317, -9.0439, -30.1462, -3.4869, 14.6008, -6.2023, -3.517, 1.5073, -29.1413, -3.517, 14.5706, -29.1413, -3.4869, 14.6008, -6.2023, -3.4869, 1.49, -6.2023, -3.517, 1.5073, -29.1413, 14.5706, 1.5073, -30.1462, 14.614, -14.5165, -6.2023, 14.6191, 1.5083, -6.2023, 14.614, -14.5165, -6.2023, 14.5706, 1.5073, -30.1462, 14.5454, -14.5467, -30.0977, 13.5658, 0.5024, -30.1462, 13.5658, -13.0633, -38.6876, 13.5658, -13.0633, -30.1461, 13.5658, 0.5024, -30.1462, 13.5658, 0.5024, -38.6876, 13.5658, -13.0633, -38.6876, 3.0146, 0.5024, -30.1462, 3.0146, -9.0439, -48.7429, 3.0146, -9.0439, -30.1462, 3.0146, 0.5024, -30.1462, 3.0146, 0.5024, -48.7429, 3.0146, -9.0439, -48.7429, 10.0487, 14.5706, -29.1413, 10.0789, 1.49, -6.2023, 10.0789, 14.6008, -6.2023, 10.0487, 14.5706, -29.1413, 10.0487, 1.5073, -29.1413, 10.0789, 1.49, -6.2023, 15.0731, -15.0264, 0, -15.0246, -14.9779, -6.2023, -15.0127, -15.0264, 0, 15.0731, -15.0264, 0, 15.0752, -14.9779, -6.2023, -15.0246, -14.9779, -6.2023, 10.5512, 2.0564, 0, 10.5813, 2.0866, -6.2023, 15.0731, 2.0564, 0, 10.5813, 2.0866, -6.2023, 15.0752, 2.0302, -6.2023, 15.0731, 2.0564, 0, -15.0127, 15.1198, 0, 10.5813, 15.1127, -6.2023, 10.5512, 15.1198, 0, -15.0127, 15.1198, 0, -15.0429, 15.1127, -6.2023, 10.5813, 15.1127, -6.2023, -15.0127, -15.0264, 0, -15.0246, -14.9779, -6.2023, -15.0127, 15.1198, 0, -15.0246, -14.9779, -6.2023, -15.0429, 15.1127, -6.2023, -15.0127, 15.1198, 0, 15.0731, 2.0564, 0, 15.0752, -14.9779, -6.2023, 15.0731, -15.0264, 0, 15.0731, 2.0564, 0, 15.0752, 2.0302, -6.2023, 15.0752, -14.9779, -6.2023, 10.5512, 15.1198, 0, 10.5813, 2.0866, -6.2023, 10.5512, 2.0564, 0, 10.5512, 15.1198, 0, 10.5813, 15.1127, -6.2023, 10.5813, 2.0866, -6.2023, 3.0146, 0.5024, -48.7429, -6.5317, 0.5024, -30.1462, -6.5317, 0.5024, -48.7429, 3.0146, 0.5024, -48.7429, 3.0146, 0.5024, -30.1462, -6.5317, 0.5024, -30.1462, 13.5658, 0.5024, -38.6876, 4.0195, 0.5024, -30.1462, 4.0195, 0.5024, -38.6876, 13.5658, 0.5024, -38.6876, 13.5658, 0.5024, -30.1462, 4.0195, 0.5024, -30.1462, -3.4869, 1.49, -6.2023, -7.5365, 1.5073, -30.1462, -3.517, 1.5073, -29.1413, -3.4869, 1.49, -6.2023, -7.5064, 1.49, -6.2023, -7.5365, 1.5073, -30.1462, 14.6191, 1.5083, -6.2023, 10.0789, 1.49, -6.2023, 14.5706, 1.5073, -30.1462, 14.5706, 1.5073, -30.1462, 10.0789, 1.49, -6.2023, 10.0487, 1.5073, -29.1413, -7.5365, 1.5073, -30.1462, 10.0487, 1.5073, -29.1413, -3.517, 1.5073, -29.1413, -7.5365, 1.5073, -30.1462, 14.5706, 1.5073, -30.1462, 10.0487, 1.5073, -29.1413, 10.0789, 14.6008, -6.2023, -3.517, 14.5706, -29.1413, 10.0487, 14.5706, -29.1413, 10.0789, 14.6008, -6.2023, -3.4869, 14.6008, -6.2023, -3.517, 14.5706, -29.1413, 3.0146, -9.0439, -30.1462, -6.5317, -9.0439, -48.7429, -6.5317, -9.0439, -30.1462, 3.0146, -9.0439, -30.1462, 3.0146, -9.0439, -48.7429, -6.5317, -9.0439, -48.7429, 13.5658, -13.0633, -30.1461, 4.0195, -13.0633, -38.6876, 4.0195, -13.0633, -30.1461, 13.5658, -13.0633, -30.1461, 13.5658, -13.0633, -38.6876, 4.0195, -13.0633, -38.6876, 14.614, -14.5165, -6.2023, -7.4881, -14.5467, -30.0977, -7.4396, -14.5165, -6.2023, 14.614, -14.5165, -6.2023, 14.5454, -14.5467, -30.0977, -7.4881, -14.5467, -30.0977) [node name="OfficesMedium4" instance=ExtResource("1")] +script = ExtResource("2_67wch") +events = 1 +mesh_path = NodePath("Maxis-3d1-mesh-44") [node name="CollisionShape3D" type="CollisionShape3D" parent="." index="1"] transform = Transform3D(1, 0, 0, 0, -1.19209e-07, -1, 0, 1, -1.19209e-07, 0, 0, 0) diff --git a/resources/Objects/Helis/Helicopter.tscn b/resources/Objects/Helis/Helicopter.tscn index b962cd9..91b91bb 100644 --- a/resources/Objects/Helis/Helicopter.tscn +++ b/resources/Objects/Helis/Helicopter.tscn @@ -41,9 +41,6 @@ strength = null [node name="RotorAudioTree" type="AnimationTree" parent="."] root_node = NodePath(".") -libraries = { -"": ExtResource("5_ayahk") -} tree_root = ExtResource("4_8iee2") advance_expression_base_node = NodePath("") anim_player = NodePath("../RotorAudioPlayer") @@ -53,11 +50,12 @@ parameters/conditions/spin_down = false parameters/conditions/spin_up = false [node name="RotorAudioPlayer" type="AnimationPlayer" parent="."] +active = false root_node = NodePath("../RotorAudioTree") libraries = { "": ExtResource("5_ayahk") } [node name="RotorAudioSource" type="AudioStreamPlayer3D" parent="."] -unit_size = 30.0 +unit_size = 5.0 doppler_tracking = 2 diff --git a/resources/Objects/Spawner/fire_spawner.tscn b/resources/Objects/Spawner/fire_spawner.tscn new file mode 100644 index 0000000..cdb59d4 --- /dev/null +++ b/resources/Objects/Spawner/fire_spawner.tscn @@ -0,0 +1,87 @@ +[gd_scene load_steps=9 format=3 uid="uid://5jijewumod80"] + +[ext_resource type="Material" uid="uid://dm0vav0ade2gp" path="res://resources/Materials/fire_material.tres" id="1_5pwr1"] +[ext_resource type="Script" path="res://native/src/scripts/spawner/fire_spawner.rs" id="1_aar5t"] +[ext_resource type="Material" uid="uid://dbuspcbhwqr7g" path="res://resources/Materials/smoke_material.tres" id="2_4mcgg"] +[ext_resource type="AudioStream" uid="uid://c16sfk06v1lwv" path="res://resources/Sounds/Events/burning_building.wav" id="4_03bkw"] +[ext_resource type="AudioStream" uid="uid://c0kgvo2cc0oi0" path="res://resources/Sounds/Events/fire_alarm.wav" id="5_bemcb"] + +[sub_resource type="Animation" id="Animation_0dav3"] +resource_name = "burning" +length = 4.0 +loop_mode = 1 +tracks/0/type = "audio" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("FireAudioSource") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"clips": [{ +"end_offset": 0.0, +"start_offset": 0.0, +"stream": ExtResource("4_03bkw") +}, { +"end_offset": 0.0, +"start_offset": 0.0, +"stream": ExtResource("4_03bkw") +}], +"times": PackedFloat32Array(0, 2) +} +tracks/0/use_blend = false +tracks/1/type = "audio" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("FireAudioSource") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"clips": [{ +"end_offset": 0.0, +"start_offset": 0.0, +"stream": ExtResource("5_bemcb") +}], +"times": PackedFloat32Array(0) +} +tracks/1/use_blend = false + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_sivcg"] +_data = { +"burning": SubResource("Animation_0dav3") +} + +[sub_resource type="AudioStreamPolyphonic" id="AudioStreamPolyphonic_0go4g"] + +[node name="FireSpawner" type="Marker3D"] +gizmo_extents = 3.0 +script = ExtResource("1_aar5t") +fire_path = NodePath("FireLarge") +smoke_path = NodePath("SmokeLarge") +light_source_path = NodePath("FireLightSource") +audio_player_path = NodePath("FireAudioPlayer") + +[node name="FireLarge" type="FogVolume" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 26.8181, 0) +size = Vector3(23, 70, 23) +material = ExtResource("1_5pwr1") + +[node name="SmokeLarge" type="FogVolume" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 83.8467, 0) +size = Vector3(40, 150, 40) +shape = 0 +material = ExtResource("2_4mcgg") + +[node name="FireAudioPlayer" type="AnimationPlayer" parent="."] +libraries = { +"": SubResource("AnimationLibrary_sivcg") +} + +[node name="FireAudioSource" type="AudioStreamPlayer3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10.1948, 0) +stream = SubResource("AudioStreamPolyphonic_0go4g") + +[node name="FireLightSource" type="OmniLight3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.01561, -3.39593) +light_color = Color(0.980392, 0.309804, 0.00392157, 1) +light_energy = 5.0 +light_volumetric_fog_energy = 0.0 diff --git a/resources/Shaders/fire_shader.tres b/resources/Shaders/fire_shader.tres new file mode 100644 index 0000000..f264f9e --- /dev/null +++ b/resources/Shaders/fire_shader.tres @@ -0,0 +1,55 @@ +[gd_resource type="Shader" format=3 uid="uid://b3ohn1ek5kics"] + +[resource] +code = " +// NOTE: Shader automatically converted from Godot Engine 4.2.2.stable's FogMaterial. + +shader_type fog; + +uniform float density : hint_range(0, 8, 0.0001) = 1.0; +uniform sampler2D color : hint_default_white; +uniform float height_falloff = 0.0; +uniform sampler3D density_texture: hint_default_white, repeat_enable; +uniform sampler3D flame_texture: hint_default_white, repeat_enable; +uniform float strength : hint_range(1.0, 10.0, 0.1); + +vec3 uvw_over_time(vec3 uvw, float time_scale) { + return vec3( + uvw.x + sin(TIME * time_scale) * 0.1, + uvw.y + (-TIME * 1.5), + uvw.z + sin(TIME * time_scale) * 0.1 + ); +} + +float fire_noise(vec2 ground_uv, vec3 uvw, float time_scale) { + const float STEP_INTERVAL = 0.3; + const float STEP_SIZE = 0.4; + + int steps = int(TIME / STEP_INTERVAL); + int steps_next = steps + 1; + float steps_slide = mod(TIME, STEP_INTERVAL) / STEP_INTERVAL; + + vec3 ground_uvw = vec3(ground_uv.x + float(steps) * STEP_SIZE, 0.0, ground_uv.y + float(steps) * STEP_SIZE); + vec3 ground_uvw_next = vec3(ground_uv.x + float(steps_next) * STEP_SIZE, 0.0, ground_uv.y + float(steps_next) * STEP_SIZE); + + float mask_lookup = texture(density_texture, ground_uvw).r; + float mask_lookup_next = texture(density_texture, ground_uvw_next).r; + + float mask = mix(mask_lookup, mask_lookup_next, steps_slide); + float shape = texture(flame_texture, uvw_over_time(uvw, 4.0)).r; + + return mask * shape; +} + +void fog() { + vec3 world_offset = fract(OBJECT_POSITION); + float f_noise = fire_noise(UVW.xz + world_offset.xz, UVW + world_offset, 3.0); + + float f_density = density * clamp(exp2(-height_falloff * (WORLD_POSITION.y - OBJECT_POSITION.y)), 0.0, 1.0); + f_density *= f_noise; + + DENSITY = f_density; + + EMISSION = texture(color, vec2(f_noise)).rgb * 3.0; +} +" diff --git a/resources/Shaders/smoke_shader.tres b/resources/Shaders/smoke_shader.tres new file mode 100644 index 0000000..3b10fc2 --- /dev/null +++ b/resources/Shaders/smoke_shader.tres @@ -0,0 +1,24 @@ +[gd_resource type="Shader" format=3 uid="uid://dwmxlfa00u2l7"] + +[resource] +code = " +// NOTE: Shader automatically converted from Godot Engine 4.2.2.stable's FogMaterial. + +shader_type fog; + +uniform float density : hint_range(0, 8, 0.0001) = 1.0; +uniform vec3 color : source_color = vec3(0, 0, 0); +uniform sampler3D density_texture: hint_default_white; + + +float fire_noise(vec3 uvw, float time_scale) { + return texture(density_texture, vec3(uvw.x, fract(uvw.y + (-TIME * time_scale)), uvw.z)).r; +} + +void fog() { + float s_noise = fire_noise(UVW, 0.4); + + DENSITY = s_noise * density; + ALBEDO = color; +} +" diff --git a/resources/Sounds/Events/burning_building.wav b/resources/Sounds/Events/burning_building.wav new file mode 100644 index 0000000..48ee568 Binary files /dev/null and b/resources/Sounds/Events/burning_building.wav differ diff --git a/resources/Sounds/Events/burning_building.wav.import b/resources/Sounds/Events/burning_building.wav.import new file mode 100644 index 0000000..5a2d98c --- /dev/null +++ b/resources/Sounds/Events/burning_building.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://c16sfk06v1lwv" +path="res://.godot/imported/burning_building.wav-85d64a5d9d8d5fd33c5b3444fb8d9598.sample" + +[deps] + +source_file="res://resources/Sounds/Events/burning_building.wav" +dest_files=["res://.godot/imported/burning_building.wav-85d64a5d9d8d5fd33c5b3444fb8d9598.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/resources/Sounds/Events/fire_alarm.wav b/resources/Sounds/Events/fire_alarm.wav new file mode 100644 index 0000000..c627c82 Binary files /dev/null and b/resources/Sounds/Events/fire_alarm.wav differ diff --git a/resources/Sounds/Events/fire_alarm.wav.import b/resources/Sounds/Events/fire_alarm.wav.import new file mode 100644 index 0000000..c2a8eed --- /dev/null +++ b/resources/Sounds/Events/fire_alarm.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://c0kgvo2cc0oi0" +path="res://.godot/imported/fire_alarm.wav-de5f3e16c5f054893d3e249c26a6c9a1.sample" + +[deps] + +source_file="res://resources/Sounds/Events/fire_alarm.wav" +dest_files=["res://.godot/imported/fire_alarm.wav-de5f3e16c5f054893d3e249c26a6c9a1.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/resources/TestScenes/burning_building.tscn b/resources/TestScenes/burning_building.tscn new file mode 100644 index 0000000..8cec8ed --- /dev/null +++ b/resources/TestScenes/burning_building.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=2 format=3 uid="uid://hyoixndx1seb"] + +[ext_resource type="PackedScene" uid="uid://5lcllve4d4s5" path="res://resources/Objects/Buildings/home_middle_class_3.tscn" id="1_daqnl"] + +[node name="HomeMiddleClass3" instance=ExtResource("1_daqnl")] + +[node name="CollisionShape3D" parent="." index="1"] +visible = false + +[node name="Camera3D" type="Camera3D" parent="." index="2"] +transform = Transform3D(-0.830816, 0.200801, -0.519061, 0, 0.932644, 0.360798, 0.556548, 0.299757, -0.774855, -17.8978, 11.3634, -20.2184) +current = true diff --git a/src/Objects/Vehicles/Car.gd b/src/Objects/Vehicles/Car.gd index f0128c8..c7ab17f 100644 --- a/src/Objects/Vehicles/Car.gd +++ b/src/Objects/Vehicles/Car.gd @@ -1,7 +1,7 @@ extends RigidBody3D const V3Util := preload("res://src/util/V3Util.gd") -const Building := preload("res://src/Objects/Map/Building.gd") +const MapBuilding := preload("res://src/Objects/Map/Building.gd") const Logger := preload("res://src/util/Logger.gd") const CustomProjectSettings := preload("res://src/CustomProjectSettings.gd") @@ -18,8 +18,8 @@ var stuck := 0 var new := true var last_transform := Transform3D.IDENTITY -var target_nav_node: Building -var current_nav_node: Building +var target_nav_node: MapBuilding +var current_nav_node: MapBuilding @onready var debug_target: MeshInstance3D = $DebugTarget @onready var ground_detector: RayCast3D = $GroundDetector @@ -149,13 +149,13 @@ func _on_choose_target() -> void: if not self.current_nav_node: var node := self.road_network.get_nearest_node(self.global_transform.origin) - self.current_nav_node = Building.new(node) + self.current_nav_node = MapBuilding.new(node) Logger.debug(["car next target:", target_translation]) func get_random_street_location() -> Vector3: - var node := Building.new(self.road_network.get_random_node()) + var node := MapBuilding.new(self.road_network.get_random_node()) if self.target_nav_node != null: var current := self.current_nav_node.tile_coords() @@ -189,7 +189,7 @@ func get_next_location() -> Vector3: if not self.road_network.has_arrived(agent_pos, agent_rot, self.current_nav_node.data): return self.road_network.get_global_transform(self.current_nav_node.data, agent_rot).origin - self.current_nav_node = Building.new(self.road_network.get_next_node(self.current_nav_node.data, self.target_nav_node.data, agent_rot)) + self.current_nav_node = MapBuilding.new(self.road_network.get_next_node(self.current_nav_node.data, self.target_nav_node.data, agent_rot)) return self.get_next_location() diff --git a/src/Objects/World/Networks.gd b/src/Objects/World/Networks.gd index 6a1f538..a998146 100644 --- a/src/Objects/World/Networks.gd +++ b/src/Objects/World/Networks.gd @@ -3,7 +3,7 @@ extends Node const TimeBudget := preload("res://src/util/TimeBudget.gd") const CityCoordsFeature := preload("res://src/features/CityCoordsFeature.gd") const SceneObjectRegistry := preload("res://src/SceneObjectRegistry.gd") -const Building := preload("res://src/Objects/Map/Building.gd") +const MapBuilding := preload("res://src/Objects/Map/Building.gd") signal loading_progress(value) @@ -29,7 +29,7 @@ func build_async(city: Dictionary): self.city_coords_feature = CityCoordsFeature.new(world_constants, sea_level) for key in networks: - var network_section: Building = Building.new(networks.get(key) as Dictionary) + var network_section := MapBuilding.new(networks.get(key) as Dictionary) var object := SceneObjectRegistry.load_network(network_section.building_id()) @warning_ignore("shadowed_variable_base_class") var name: String = network_section.name()