mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 04:21:50 +00:00
add 'entity.despawn' command
This commit is contained in:
parent
c9958c9718
commit
41a22938d6
8 changed files with 41 additions and 5 deletions
|
|
@ -373,6 +373,12 @@ public:
|
|||
if (!arg->optional) {
|
||||
throw error("missing argument "+util::quote(arg->name));
|
||||
} else {
|
||||
if (auto string = std::get_if<std::string>(&arg->def)) {
|
||||
if ((*string)[0] == '$') {
|
||||
args->put((*interpreter)[string->substr(1)]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
args->put(arg->def);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,6 +241,7 @@ void PlayerController::update(float delta, bool input, bool pause) {
|
|||
if (!pause) {
|
||||
if (input) {
|
||||
updateKeyboard();
|
||||
player->updateSelectedEntity();
|
||||
} else {
|
||||
resetKeyboard();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,8 +140,8 @@ static int l_get_selected_block(lua::State* L) {
|
|||
|
||||
static int l_get_selected_entity(lua::State* L) {
|
||||
if (auto player = get_player(L, 1)) {
|
||||
if (player->selection.entity) {
|
||||
return lua::pushinteger(L, player->selection.entity);
|
||||
if (auto eid = player->getSelectedEntity()) {
|
||||
return lua::pushinteger(L, eid);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue