mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
delayBeforePickup
This commit is contained in:
parent
466d57d64b
commit
9a530b9dd1
2 changed files with 7 additions and 2 deletions
|
|
@ -26,6 +26,7 @@ class Entity extends Position
|
|||
public $eid;
|
||||
public $type;
|
||||
public $name;
|
||||
public $delayBeforePickup;
|
||||
public $x, $y, $z;
|
||||
public $speedX, $speedY, $speedZ, $speed;
|
||||
public $lastX = 0, $lastY = 0, $lastZ = 0, $lastYaw = 0, $lastPitch = 0, $lastTime = 0, $lastHeadYaw = 0, $lastSpeedX = 0, $lastSpeedY = 0, $lastSpeedZ = 0;
|
||||
|
|
@ -338,7 +339,7 @@ class Entity extends Position
|
|||
$time = microtime(true);
|
||||
if($this->class === ENTITY_PLAYER and ($this->player instanceof Player) and $this->player->spawned === true and $this->player->blocked !== true && ! $this->dead){
|
||||
foreach($this->server->api->entity->getRadius($this, 2, ENTITY_ITEM) as $item){ //TODO vanilla method of searching/radius
|
||||
if(!$item->closed && $item->spawntime > 0 && ($time - $item->spawntime) >= 0.6){
|
||||
if(!$item->closed && $item->spawntime > 0 && $item->delayBeforePickup == 0){
|
||||
if((($this->player->gamemode & 0x01) === 1 || $this->player->hasSpace($item->type, $item->meta, $item->stack) === true) && $this->server->api->dhandle("player.pickup", array(
|
||||
"eid" => $this->player->eid,
|
||||
"player" => $this->player,
|
||||
|
|
@ -668,6 +669,9 @@ class Entity extends Position
|
|||
if($this->knockbackTime > 0){
|
||||
--$this->knockbackTime;
|
||||
}
|
||||
if($this->delayBeforePickup > 0){
|
||||
--$this->delayBeforePickup;
|
||||
}
|
||||
if($this->moveTime > 0){
|
||||
--$this->moveTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,5 +20,6 @@ class ItemEntity extends Entity{
|
|||
$this->setHealth(5, "generic");
|
||||
$this->setSize(0.25, 0.25);
|
||||
$this->gravity = 0.04;
|
||||
$this->delayBeforePickup = 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue