add "light" command, add cozy illumination to pizza place
This commit is contained in:
parent
b655a04ff5
commit
cc198f5465
13
src/defs.txt
13
src/defs.txt
|
@ -78,18 +78,25 @@ actor -8000 -1000 -100 monolith
|
||||||
actor -3300 10 0 pizzeria
|
actor -3300 10 0 pizzeria
|
||||||
scale 40
|
scale 40
|
||||||
mass 1000000
|
mass 1000000
|
||||||
rotationy -0.25
|
rotationy 0.30
|
||||||
angularmomentum 0 0 0
|
angularmomentum 0 0 0
|
||||||
actor -3400 73 -13 pizzasign
|
actor -3400 73 -13 pizzasign
|
||||||
scale 20
|
scale 20
|
||||||
mass 200
|
mass 200
|
||||||
rotationy 0.45
|
rotationy 0.45
|
||||||
angularmomentum 0.00001 0 0.0003
|
angularmomentum 0.1 0 0.2
|
||||||
actor -3295 3 -32 suit
|
actor -3316 0 0 lightorb
|
||||||
|
scale 0.5
|
||||||
|
light FF8F4A 1000000
|
||||||
|
actor -3314 7 -2 lightorb
|
||||||
|
scale 0.5
|
||||||
|
light FF8F4A 1000000
|
||||||
|
actor -3330 10 0 suit
|
||||||
name "Space Pizza™"
|
name "Space Pizza™"
|
||||||
chatid pizzeria
|
chatid pizzeria
|
||||||
mass 200.0
|
mass 200.0
|
||||||
alive yes
|
alive yes
|
||||||
|
angularmomentum 0.02 0.03 0.01
|
||||||
pronoun it
|
pronoun it
|
||||||
chat pizzeria
|
chat pizzeria
|
||||||
name "Space Pizza™"
|
name "Space Pizza™"
|
||||||
|
|
38
src/world.rs
38
src/world.rs
|
@ -26,6 +26,7 @@ fn asset_name_to_path(name: &str) -> &'static str {
|
||||||
"asteroid2" => ASSET_ASTEROID2,
|
"asteroid2" => ASSET_ASTEROID2,
|
||||||
"moonlet" => "models/moonlet.glb#Scene0",
|
"moonlet" => "models/moonlet.glb#Scene0",
|
||||||
"monolith" => "models/monolith_neon.glb#Scene0",
|
"monolith" => "models/monolith_neon.glb#Scene0",
|
||||||
|
"lightorb" => "models/lightorb.glb#Scene0",
|
||||||
"MeteorAceGT" => "models/MeteorAceGT.glb#Scene0",
|
"MeteorAceGT" => "models/MeteorAceGT.glb#Scene0",
|
||||||
"pizzeria" => "models/pizzeria2.glb#Scene0",
|
"pizzeria" => "models/pizzeria2.glb#Scene0",
|
||||||
"pizzasign" => "models/pizzasign.glb#Scene0",
|
"pizzasign" => "models/pizzasign.glb#Scene0",
|
||||||
|
@ -228,6 +229,8 @@ struct ParserState {
|
||||||
collider: Collider,
|
collider: Collider,
|
||||||
camdistance: f32,
|
camdistance: f32,
|
||||||
suit_integrity: f32,
|
suit_integrity: f32,
|
||||||
|
light_brightness: f32,
|
||||||
|
light_color: Option<Color>,
|
||||||
|
|
||||||
// Chat fields
|
// Chat fields
|
||||||
delay: f64,
|
delay: f64,
|
||||||
|
@ -276,6 +279,8 @@ impl Default for ParserState {
|
||||||
collider: Collider::sphere(1.0),
|
collider: Collider::sphere(1.0),
|
||||||
camdistance: default_actor.camdistance,
|
camdistance: default_actor.camdistance,
|
||||||
suit_integrity: 1.0,
|
suit_integrity: 1.0,
|
||||||
|
light_brightness: 0.0,
|
||||||
|
light_color: None,
|
||||||
|
|
||||||
delay: 0.0,
|
delay: 0.0,
|
||||||
text: "".to_string(),
|
text: "".to_string(),
|
||||||
|
@ -529,6 +534,22 @@ pub fn load_defs(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
["light", color_hex, brightness] => {
|
||||||
|
if let Ok(brightness_float) = brightness.parse::<f32>() {
|
||||||
|
if let Ok(color) = Color::hex(color_hex) {
|
||||||
|
state.light_color = Some(color);
|
||||||
|
state.light_brightness = brightness_float;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
error!("Can't parse hexadecimal color code: {line}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
error!("Can't parse float: {line}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Parsing chats
|
// Parsing chats
|
||||||
["chat", chat_name] => {
|
["chat", chat_name] => {
|
||||||
|
@ -719,6 +740,23 @@ fn spawn_entities(
|
||||||
..default()
|
..default()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if let Some(color) = state.light_color {
|
||||||
|
actor.insert(PointLightBundle {
|
||||||
|
point_light: PointLight {
|
||||||
|
intensity: state.light_brightness,
|
||||||
|
color: color,
|
||||||
|
range: 100.0,
|
||||||
|
radius: 100.0,
|
||||||
|
..default()
|
||||||
|
},
|
||||||
|
transform: Transform {
|
||||||
|
translation: state.pos,
|
||||||
|
scale: Vec3::splat(state.model_scale),
|
||||||
|
rotation: state.rotation,
|
||||||
|
},
|
||||||
|
..default()
|
||||||
|
});
|
||||||
|
}
|
||||||
if !state.chat.is_empty() {
|
if !state.chat.is_empty() {
|
||||||
actor.insert(actor::Talker {
|
actor.insert(actor::Talker {
|
||||||
conv_id: state.chat.clone(),
|
conv_id: state.chat.clone(),
|
||||||
|
|
Loading…
Reference in a new issue