add "targeted yes" command
This commit is contained in:
parent
4d4ccb9d9f
commit
fd16d6931e
|
@ -49,6 +49,7 @@ struct ParserState {
|
||||||
is_suited: bool,
|
is_suited: bool,
|
||||||
is_vehicle: bool,
|
is_vehicle: bool,
|
||||||
is_clickable: bool,
|
is_clickable: bool,
|
||||||
|
is_targeted_on_startup: bool,
|
||||||
has_physics: bool,
|
has_physics: bool,
|
||||||
wants_maxrotation: Option<f64>,
|
wants_maxrotation: Option<f64>,
|
||||||
wants_maxvelocity: Option<f64>,
|
wants_maxvelocity: Option<f64>,
|
||||||
|
@ -93,6 +94,7 @@ impl Default for ParserState {
|
||||||
is_suited: false,
|
is_suited: false,
|
||||||
is_vehicle: false,
|
is_vehicle: false,
|
||||||
is_clickable: true,
|
is_clickable: true,
|
||||||
|
is_targeted_on_startup: false,
|
||||||
has_physics: true,
|
has_physics: true,
|
||||||
wants_maxrotation: None,
|
wants_maxrotation: None,
|
||||||
wants_maxvelocity: None,
|
wants_maxvelocity: None,
|
||||||
|
@ -186,6 +188,7 @@ pub fn load_defs(
|
||||||
["relativeto", id] => {
|
["relativeto", id] => {
|
||||||
// NOTE: call this command before "id", otherwise actors that
|
// NOTE: call this command before "id", otherwise actors that
|
||||||
// set their position relative to this actor will get the wrong offset
|
// set their position relative to this actor will get the wrong offset
|
||||||
|
// TODO: fix the above
|
||||||
match id2pos.get(&id.to_string()) {
|
match id2pos.get(&id.to_string()) {
|
||||||
Some(pos) => {
|
Some(pos) => {
|
||||||
state.pos += *pos;
|
state.pos += *pos;
|
||||||
|
@ -419,6 +422,9 @@ pub fn load_defs(
|
||||||
["armodel", asset_name] => {
|
["armodel", asset_name] => {
|
||||||
state.ar_model = Some(asset_name.to_string());
|
state.ar_model = Some(asset_name.to_string());
|
||||||
}
|
}
|
||||||
|
["targeted", "yes"] => {
|
||||||
|
state.is_targeted_on_startup = true;
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
error!("No match for [{}]", parts.join(","));
|
error!("No match for [{}]", parts.join(","));
|
||||||
}
|
}
|
||||||
|
@ -514,6 +520,9 @@ fn spawn_entities(
|
||||||
actor.insert(actor::Player);
|
actor.insert(actor::Player);
|
||||||
actor.insert(actor::PlayerCamera);
|
actor.insert(actor::PlayerCamera);
|
||||||
}
|
}
|
||||||
|
if state.is_targeted_on_startup {
|
||||||
|
actor.insert(hud::IsTargeted);
|
||||||
|
}
|
||||||
if state.is_player || state.is_vehicle {
|
if state.is_player || state.is_vehicle {
|
||||||
// used to apply mouse movement to actor rotation
|
// used to apply mouse movement to actor rotation
|
||||||
actor.insert(ExternalTorque::ZERO.with_persistence(false));
|
actor.insert(ExternalTorque::ZERO.with_persistence(false));
|
||||||
|
|
Loading…
Reference in a new issue