summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/Bindings.cpp8
-rw-r--r--source/Bindings.h2
-rw-r--r--source/BlockEntities/DispenserEntity.cpp13
-rw-r--r--source/World.cpp4
-rw-r--r--source/World.h4
5 files changed, 23 insertions, 8 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index 15e31fbff..2432bc04f 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 06/21/13 22:48:20.
+** Generated automatically by tolua++-1.0.92 on 06/21/13 23:03:07.
*/
#ifndef __cplusplus
@@ -11622,7 +11622,8 @@ static int tolua_AllToLua_cWorld_SpawnPrimedTNT00(lua_State* tolua_S)
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
!tolua_isnumber(tolua_S,5,0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,6,&tolua_err)
+ !tolua_isnumber(tolua_S,6,1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,7,&tolua_err)
)
goto tolua_lerror;
else
@@ -11633,11 +11634,12 @@ static int tolua_AllToLua_cWorld_SpawnPrimedTNT00(lua_State* tolua_S)
double a_Y = ((double) tolua_tonumber(tolua_S,3,0));
double a_Z = ((double) tolua_tonumber(tolua_S,4,0));
float a_FuseTimeInSec = ((float) tolua_tonumber(tolua_S,5,0));
+ double a_InitialVelocityCoeff = ((double) tolua_tonumber(tolua_S,6,1));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SpawnPrimedTNT'", NULL);
#endif
{
- self->SpawnPrimedTNT(a_X,a_Y,a_Z,a_FuseTimeInSec);
+ self->SpawnPrimedTNT(a_X,a_Y,a_Z,a_FuseTimeInSec,a_InitialVelocityCoeff);
}
}
return 0;
diff --git a/source/Bindings.h b/source/Bindings.h
index 2de7b3542..b33124fe3 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 06/21/13 22:48:20.
+** Generated automatically by tolua++-1.0.92 on 06/21/13 23:03:08.
*/
/* Exported function */
diff --git a/source/BlockEntities/DispenserEntity.cpp b/source/BlockEntities/DispenserEntity.cpp
index 08f26efff..22fcdd3fc 100644
--- a/source/BlockEntities/DispenserEntity.cpp
+++ b/source/BlockEntities/DispenserEntity.cpp
@@ -119,6 +119,19 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
break;
}
+ case E_BLOCK_TNT:
+ {
+ // Spawn a primed TNT entity, if space allows:
+ if (DispChunk->GetBlock(DispX, DispY, DispZ) == E_BLOCK_AIR)
+ {
+ double TNTX = 0.5 + (DispX + DispChunk->GetPosX() * cChunkDef::Width);
+ double TNTZ = 0.5 + (DispZ + DispChunk->GetPosZ() * cChunkDef::Width);
+ m_World->SpawnPrimedTNT(TNTX, DispY + 0.5, TNTZ, 4, 0); // 4 seconds fuse, no initial velocity
+ m_Contents.ChangeSlotCount(a_SlotNum, -1);
+ }
+ break;
+ }
+
default:
{
DropFromSlot(a_Chunk, a_SlotNum);
diff --git a/source/World.cpp b/source/World.cpp
index 97b5a2b0e..2a73eb7ea 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -1325,11 +1325,11 @@ void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double
-void cWorld::SpawnPrimedTNT(double a_X, double a_Y, double a_Z, float a_FuseTimeInSec)
+void cWorld::SpawnPrimedTNT(double a_X, double a_Y, double a_Z, float a_FuseTimeInSec, double a_InitialVelocityCoeff)
{
cTNTEntity * TNT = new cTNTEntity(a_X, a_Y, a_Z, a_FuseTimeInSec);
TNT->Initialize(this);
- // TODO: Add a bit of speed in horiz and vert axes
+ // TODO: Add a bit of speed in horiz and vert axes, based on the a_InitialVelocityCoeff
}
diff --git a/source/World.h b/source/World.h
index 46894bbbf..647c109e8 100644
--- a/source/World.h
+++ b/source/World.h
@@ -330,8 +330,8 @@ public:
/// Spawns item pickups for each item in the list. May compress pickups if too many entities. All pickups get the speed specified:
void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ);
- /// Spawns a new primed TNT entity at the specified block coords and specified fuse duration
- void SpawnPrimedTNT(double a_X, double a_Y, double a_Z, float a_FuseTimeInSec);
+ /// Spawns a new primed TNT entity at the specified block coords and specified fuse duration. Initial velocity is given based on the relative coefficient provided
+ void SpawnPrimedTNT(double a_X, double a_Y, double a_Z, float a_FuseTimeInSec, double a_InitialVelocityCoeff = 1);
// tolua_end