Implemented ordering and command setting
This commit is contained in:
@@ -1015,6 +1015,8 @@ void BuildingLayoutGraph::create_zone(const String &base_path, int zone_type)
|
||||
{ zone_type });
|
||||
new_e.set<WorldEditor::components::buildings_layout_graph_node>(
|
||||
{ 0, 0, 0 });
|
||||
int count = get_children_count(new_e.parent());
|
||||
new_e.set<WorldEditor::components::buildings_layout_order>({ count });
|
||||
}
|
||||
|
||||
void BuildingLayoutGraph::create_unit(const String &base_path)
|
||||
@@ -1023,6 +1025,8 @@ void BuildingLayoutGraph::create_unit(const String &base_path)
|
||||
new_e.set<WorldEditor::components::buildings_layout_unit>({ 0 });
|
||||
new_e.set<WorldEditor::components::buildings_layout_graph_node>(
|
||||
{ 0, 0, 0 });
|
||||
int count = get_children_count(new_e.parent());
|
||||
new_e.set<WorldEditor::components::buildings_layout_order>({ count });
|
||||
}
|
||||
|
||||
void BuildingLayoutGraph::create_floor(const String &base_path)
|
||||
@@ -1031,6 +1035,8 @@ void BuildingLayoutGraph::create_floor(const String &base_path)
|
||||
new_e.set<WorldEditor::components::buildings_layout_floor>({ 0 });
|
||||
new_e.set<WorldEditor::components::buildings_layout_graph_node>(
|
||||
{ 0, 0, 0 });
|
||||
int count = get_children_count(new_e.parent());
|
||||
new_e.set<WorldEditor::components::buildings_layout_order>({ count });
|
||||
}
|
||||
|
||||
void BuildingLayoutGraph::create_room(const String &base_path, int id)
|
||||
@@ -1049,4 +1055,29 @@ void BuildingLayoutGraph::create_room(const String &base_path, int id)
|
||||
{ 0, 0, 0 });
|
||||
new_e.set<WorldEditor::components::buildings_layout_area>({ 0.0f });
|
||||
assert(new_e.has<WorldEditor::components::buildings_layout_graph_node>());
|
||||
int count = get_children_count(new_e.parent());
|
||||
new_e.set<WorldEditor::components::buildings_layout_order>({ count });
|
||||
new_e.set<WorldEditor::components::buildings_layout_command>({ -1 });
|
||||
}
|
||||
|
||||
void BuildingLayoutGraph::create_new_layout(const String &layout_name)
|
||||
{
|
||||
flecs::world ecs = BaseData::get_singleton()->get();
|
||||
flecs::entity base = get_layout_base();
|
||||
flecs::entity e = base.lookup(layout_name.ascii().ptr());
|
||||
if (e.is_valid())
|
||||
return;
|
||||
e = ecs.entity(layout_name.ascii().ptr()).child_of(base);
|
||||
if (e.is_valid()) {
|
||||
e.add<WorldEditor::components::buildings_layout_graph>();
|
||||
e.set<WorldEditor::components::buildings_layout_floor>({ 0 });
|
||||
e.set<WorldEditor::components::buildings_layout_graph_node>(
|
||||
{ 0, 0, 0 });
|
||||
e.set<WorldEditor::components::buildings_layout_floor_index>(
|
||||
{ 0 });
|
||||
e.set<WorldEditor::components::buildings_layout_area>({ 0 });
|
||||
int count = get_children_count(base);
|
||||
e.set<WorldEditor::components::buildings_layout_order>(
|
||||
{ count });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user