Move passable and opaque into objectdef
This commit is contained in:
@@ -180,6 +180,10 @@ pub(crate) fn show_editor_panel(
|
||||
}
|
||||
|
||||
let obj = &mut board.objects[i];
|
||||
|
||||
ui.checkbox(&mut obj.passable, "Passable");
|
||||
ui.checkbox(&mut obj.opaque, "Opaque");
|
||||
|
||||
let current =
|
||||
obj.script_name.as_deref().unwrap_or("(none)").to_string();
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ mod render;
|
||||
|
||||
use editor::{EditorState, EditorTab, show_editor_panel};
|
||||
use font::BitmapFont;
|
||||
use kiln_core::game::{Archetype, FontSpec, GameState, Glyph, ObjectDef};
|
||||
use kiln_core::game::{FontSpec, GameState, Glyph, ObjectDef};
|
||||
use kiln_core::map_file;
|
||||
use render::{
|
||||
DEFAULT_WINDOW_H, DEFAULT_WINDOW_W, MIN_WINDOW_H, MIN_WINDOW_W, board_origin, draw_board,
|
||||
@@ -236,22 +236,24 @@ impl eframe::App for App {
|
||||
if self.editor.tab == EditorTab::Objects {
|
||||
if self.editor.placing_object {
|
||||
// Placement mode: create a new object here if none exists.
|
||||
if board.object_at(cx, cy).is_none() {
|
||||
if board.object_index_at(cx, cy).is_none() {
|
||||
board.objects.push(ObjectDef {
|
||||
x: cx,
|
||||
y: cy,
|
||||
glyph: Glyph {
|
||||
tile: Archetype::Object.default_glyph().tile,
|
||||
fg: Archetype::Object.default_glyph().fg,
|
||||
bg: Archetype::Object.default_glyph().bg,
|
||||
tile: ObjectDef::default_glyph().tile,
|
||||
fg: ObjectDef::default_glyph().fg,
|
||||
bg: ObjectDef::default_glyph().bg,
|
||||
},
|
||||
passable: false,
|
||||
opaque: true,
|
||||
script_name: None,
|
||||
});
|
||||
}
|
||||
self.editor.placing_object = false;
|
||||
} else {
|
||||
// Selection mode: click to select an existing object.
|
||||
let found = board.object_at(cx, cy);
|
||||
let found = board.object_index_at(cx, cy);
|
||||
self.editor.selected_object = found;
|
||||
self.editor.object_glyph_picker_open = false;
|
||||
if let Some(i) = found {
|
||||
|
||||
Reference in New Issue
Block a user