From 90c89fc3f3851160e6a467f6abb59d9f4a96882a Mon Sep 17 00:00:00 2001 From: yuni Date: Fri, 12 Jul 2024 14:57:53 +0200 Subject: [PATCH] add comments --- src/cmd.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/cmd.rs b/src/cmd.rs index c83e377..020b9ff 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -377,9 +377,17 @@ pub fn load_defs(mut ew_spawn: EventWriter) { } } ["relativeto", id] => { + // Offsets this actor's position by the pos. of the actor with the given id. state.relative_to = Some(id.to_string()); } ["orbitaround", object_id, radius_str] => { + // Places the actor into an orbit around the object_id so that it's position + // will be offset by the orbital distance (radius_str) and the phase will + // be set dynamically based on the current day+time. + // Unlike the "orbit" command, this position is not static, and there is no + // parameter for a phase offset, though you can set that with the + // "orbit_phase_offset" command. + // Make sure to use this with "relativeto" with the object that's being orbited. if let Ok(r) = radius_str.parse::() { state.orbit_distance = Some(r); state.orbit_object_id = Some(object_id.to_string()); @@ -389,6 +397,11 @@ pub fn load_defs(mut ew_spawn: EventWriter) { } } ["orbit", radius_str, phase_str] => { + // Offsets the actor's position by the given distance (radius_str) + // in the direction as defined by the angle in phase_str. + // Unlike "orbitaround", the position is static though and will not + // change over time. + // Make sure to use this with "relativeto" with the object that's being orbited. if let (Ok(r), Ok(phase)) = (radius_str.parse::(), phase_str.parse::()) { state.orbit_distance = Some(r); state.orbit_phase = Some(phase * PI * 2.0); @@ -398,6 +411,8 @@ pub fn load_defs(mut ew_spawn: EventWriter) { } } ["orbit_phase_offset", value] => { + // When used in combination with "orbitaround", this command allows + // you to move the actor ahead (or behind) in its orbit by the given offset. if let Ok(value_float) = value.parse::() { let offset_radians = 2.0 * PI * value_float; if let Some(phase_radians) = state.orbit_phase {