One step closer to multiplayer
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "../../files/files.h"
|
||||
#include "../../util/timeutil.h"
|
||||
#include "../../world/Level.h"
|
||||
#include "../../objects/Player.h"
|
||||
#include "../../voxels/Block.h"
|
||||
#include "../../items/ItemDef.h"
|
||||
#include "../../items/Inventory.h"
|
||||
@@ -160,7 +161,7 @@ void scripting::on_block_placed(Player* player, const Block* block, int x, int y
|
||||
std::string name = block->name+".placed";
|
||||
if (state->getglobal(name)) {
|
||||
state->pushivec3(x, y, z);
|
||||
state->pushinteger(1); // playerid placeholder
|
||||
state->pushinteger(player->getId());
|
||||
state->callNoThrow(4);
|
||||
}
|
||||
}
|
||||
@@ -169,7 +170,7 @@ void scripting::on_block_broken(Player* player, const Block* block, int x, int y
|
||||
std::string name = block->name+".broken";
|
||||
if (state->getglobal(name)) {
|
||||
state->pushivec3(x, y, z);
|
||||
state->pushinteger(1); // playerid placeholder
|
||||
state->pushinteger(player->getId());
|
||||
state->callNoThrow(4);
|
||||
}
|
||||
}
|
||||
@@ -178,7 +179,7 @@ bool scripting::on_block_interact(Player* player, const Block* block, int x, int
|
||||
std::string name = block->name+".interact";
|
||||
if (state->getglobal(name)) {
|
||||
state->pushivec3(x, y, z);
|
||||
state->pushinteger(1); // playerid placeholder
|
||||
state->pushinteger(player->getId());
|
||||
if (state->callNoThrow(4)) {
|
||||
return state->toboolean(-1);
|
||||
}
|
||||
@@ -190,7 +191,7 @@ bool scripting::on_item_use_on_block(Player* player, const ItemDef* item, int x,
|
||||
std::string name = item->name+".useon";
|
||||
if (state->getglobal(name)) {
|
||||
state->pushivec3(x, y, z);
|
||||
state->pushinteger(1); // playerid placeholder
|
||||
state->pushinteger(player->getId());
|
||||
if (state->callNoThrow(4)) {
|
||||
return state->toboolean(-1);
|
||||
}
|
||||
@@ -202,7 +203,7 @@ bool scripting::on_item_break_block(Player* player, const ItemDef* item, int x,
|
||||
std::string name = item->name+".blockbreakby";
|
||||
if (state->getglobal(name)) {
|
||||
state->pushivec3(x, y, z);
|
||||
state->pushinteger(1); // playerid placeholder
|
||||
state->pushinteger(player->getId());
|
||||
if (state->callNoThrow(4)) {
|
||||
return state->toboolean(-1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user