From 793acd267f4a5801e2aa9e9dca7cf51c5a595a02 Mon Sep 17 00:00:00 2001 From: Lane Kolbly Date: Wed, 12 Jul 2017 05:13:27 -0500 Subject: Changing pickup lifetime and combining semantics, making these adjustable in the lua api. (#3843) --- src/World.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index fa2116597..da7d8fb2d 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2223,6 +2223,22 @@ void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double +UInt32 cWorld::SpawnItemPickup(double a_PosX, double a_PosY, double a_PosZ, const cItem & a_Item, float a_SpeedX, float a_SpeedY, float a_SpeedZ, int a_LifetimeTicks, bool a_CanCombine) +{ + cPickup * Pickup = new cPickup(a_PosX, a_PosY, a_PosZ, a_Item, false, a_SpeedX, a_SpeedY, a_SpeedZ, a_LifetimeTicks, a_CanCombine); + if (!Pickup->Initialize(*this)) + { + delete Pickup; + Pickup = nullptr; + return cEntity::INVALID_ID; + } + return Pickup->GetUniqueID(); +} + + + + + UInt32 cWorld::SpawnFallingBlock(int a_X, int a_Y, int a_Z, BLOCKTYPE BlockType, NIBBLETYPE BlockMeta) { cFallingBlock * FallingBlock = new cFallingBlock(Vector3i(a_X, a_Y, a_Z), BlockType, BlockMeta); -- cgit v1.2.3