mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 20:19:44 +00:00
spider can climb, mobs can use ladders
This commit is contained in:
parent
f7cf750ce1
commit
20767a883f
3 changed files with 27 additions and 19 deletions
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
class Spider extends Monster{
|
||||
const TYPE = MOB_SPIDER;
|
||||
|
||||
function __construct(Level $level, $eid, $class, $type = 0, $data = array()){
|
||||
$this->setSize(1.4, 0.9);
|
||||
parent::__construct($level, $eid, $class, $type, $data);
|
||||
|
|
@ -12,6 +13,8 @@ class Spider extends Monster{
|
|||
$this->ai->addTask(new TaskSwimming());
|
||||
$this->ai->addTask(new TaskAttackPlayer(1.0, 16)); //TODO fix range?
|
||||
}
|
||||
|
||||
|
||||
public function attackEntity($entity, $distance){
|
||||
if($distance > 2.0 && $distance < 6.0){
|
||||
if($this->onGround){
|
||||
|
|
@ -24,11 +27,16 @@ class Spider extends Monster{
|
|||
$this->speedY = 0.4;
|
||||
}
|
||||
return false;
|
||||
}else{
|
||||
}else if($distance <= 2.0){
|
||||
return parent::attackEntity($entity, $distance);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function isOnLadder(){
|
||||
return $this->isCollidedHorizontally;
|
||||
}
|
||||
|
||||
public function getDrops(){
|
||||
return [
|
||||
[STRING, 0, mt_rand(0,2)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue