Add campaign editor script runtime and debug overlays
This commit is contained in:
1 parent
cd35ca8e3d
commit
b06c48172b
13 files changed
+2211
-66
No files matched your search
+9
-4
@@ -616,6 +616,8 @@ pub struct Game {
|
||||
pub marks: Vec<Mark>, // short-lived markers for commands given by the masters
|
||||
#[serde(skip)]
|
||||
pub hints: bool, // show hint messages (setting)
|
||||
#[serde(skip)]
|
||||
pub debug_markers: bool, // show debug-only command markers
|
||||
#[serde(skip, default = "hint_times")]
|
||||
hint_t: [f32; 32], // last time each hint slot was shown
|
||||
}
|
||||
@@ -646,6 +648,8 @@ pub struct Mark {
|
||||
pub kind: u8,
|
||||
pub side: u8,
|
||||
pub until: u64,
|
||||
#[serde(default)]
|
||||
pub fixed: bool, // guard/attack/gather order flags are shown without the debug setting
|
||||
}
|
||||
|
||||
fn hint_times() -> [f32; 32] {
|
||||
@@ -815,6 +819,7 @@ impl Game {
|
||||
entry_history: Vec::new(),
|
||||
planned_entries: Vec::new(),
|
||||
hints: true,
|
||||
debug_markers: false,
|
||||
me: Owner::Player,
|
||||
me_side: 0,
|
||||
local_side: 0,
|
||||
@@ -3841,19 +3846,19 @@ impl Game {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_mark(&mut self, x: f32, y: f32, kind: u8, side: u8, duration: f32) {
|
||||
if duration <= 0.0 || !x.is_finite() || !y.is_finite() {
|
||||
pub fn add_mark(&mut self, x: f32, y: f32, kind: u8, side: u8, duration: f32, fixed: bool) {
|
||||
if (!fixed && !self.debug_markers) || duration <= 0.0 || !x.is_finite() || !y.is_finite() {
|
||||
return;
|
||||
}
|
||||
let until = self.sim_steps + (duration / STEP).ceil() as u64;
|
||||
if let Some(m) = self.marks.iter_mut().find(|m| (m.x - x).abs() < 0.75 && (m.y - y).abs() < 0.75 && m.kind == kind && m.side == side) {
|
||||
if let Some(m) = self.marks.iter_mut().find(|m| (m.x - x).abs() < 0.75 && (m.y - y).abs() < 0.75 && m.kind == kind && m.side == side && m.fixed == fixed) {
|
||||
m.until = m.until.max(until);
|
||||
return;
|
||||
}
|
||||
if self.marks.len() >= 80 {
|
||||
self.marks.remove(0);
|
||||
}
|
||||
self.marks.push(Mark { x, y, kind, side, until });
|
||||
self.marks.push(Mark { x, y, kind, side, until, fixed });
|
||||
}
|
||||
|
||||
fn creature_choose(&mut self, e: &mut Ent) {
|
||||
|
||||
Reference in new issue
Block a user