Added camera mode to c++
This commit is contained in:
@@ -436,8 +436,11 @@ void StreamWorld::run_command(const String &command, const Array &args)
|
||||
return;
|
||||
String key = buildings[id].key;
|
||||
buildings[id].xform == args[1];
|
||||
Spatial *bnode = Object::cast_to<Spatial>(item_nodes[id]);
|
||||
bnode->set_global_transform(args[1]);
|
||||
if (item_nodes.has(id)) {
|
||||
Spatial *bnode =
|
||||
Object::cast_to<Spatial>(item_nodes[id]);
|
||||
bnode->set_global_transform(args[1]);
|
||||
}
|
||||
VariantWriter::write_to_string(buildings[id].xform, key);
|
||||
buildings[id].key = key;
|
||||
} else if (command == "buildings_checkpoint") {
|
||||
@@ -454,6 +457,26 @@ void StreamWorld::run_command(const String &command, const Array &args)
|
||||
Array ret_data;
|
||||
ret_data.push_back(buildings_data);
|
||||
emit_signal("command_result", command, ret_data);
|
||||
} else if (command == "change_building_type") {
|
||||
if (args.size() == 0) {
|
||||
print_error("bad command: not enough args: " + command);
|
||||
return;
|
||||
}
|
||||
int id = args[0];
|
||||
String new_type = args[1];
|
||||
Dictionary buildings_data =
|
||||
config.get_value("buildings", "building_data");
|
||||
if (!building_data.has(new_type)) {
|
||||
print_error("unknown building type: " + new_type);
|
||||
return;
|
||||
}
|
||||
String old_type = buildings[id].id;
|
||||
unload_building(id);
|
||||
buildings[id].id = new_type;
|
||||
load_building(id);
|
||||
update_items();
|
||||
print_line("changed building: " + itos(id) +
|
||||
" from: " + old_type + " to: " + new_type);
|
||||
} else
|
||||
print_error("No command " + command);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user