Beispiel #1
0
    public bool interact(Mob mob, string type)
    {
        EntityId tool = EntityId.ByName(mob.hotbar.items[mob.hotbar.selected]);

        if (typeof(I3dContainer).IsInstanceOfType(container))
        {
            I3dContainer container = (I3dContainer)this.container;
            switch (type)
            {
            case "mine":
                hits -= mob.minemode == "momental" ? hits : Time.fixedDeltaTime * mob.breakSpeed;
                if (hits <= 0)
                {
                    if (!mob.perms.canIntoNothing)
                    {
                        if (mob.touchmode == "silk")
                        {
                            mob.hotbar.addItem(id.name);
                        }
                        if (mob.touchmode == "mine")
                        {
                            mob.hotbar.addItem(id.drop);
                        }
                    }
                    this.recreate(EntityId.ByName("air"));
                    return(true);
                }
                break;

            default:
                Debug.Log("interact");
                switch (id.name)
                {
                case "tnt":
                    if (tool.name == "fire")
                    {
                        return(ignite());
                    }
                    break;
                }
                break;
            }
        }
        else
        {
            Debug.Log("re");
        }
        return(false);
    }
Beispiel #2
0
 public bool ignite()
 {
     if (typeof(I3dContainer).IsInstanceOfType(container))
     {
         I3dContainer container = (I3dContainer)this.container;
         string       idName    = id.name;
         container.set(location, new Entity().recreate(EntityId.ByName("air")));
         switch (idName)
         {
         case "tnt":
             container.fill(new Vector3(location.x, location.y, location.z), 3, new Entity().recreate(EntityId.ByName("air")), "sphere", "ignite;set");
             return(true);
         }
     }
     return(false);
 }