예제 #1
0
        private DroppedItem CreateSkullItem(string name, BaseEntity parent, Vector3 localPosition, Vector3 localRotation, bool canPickup = true)
        {
            DroppedItem skullItem = CreateSkullItem(name, parent.transform.position);

            skullItem.SetParent(parent);
            skullItem.transform.localPosition = localPosition;
            skullItem.transform.rotation      = Quaternion.Euler(localRotation);

            return(skullItem);
        }
예제 #2
0
            public void AddFood(bool allChicken)
            {
                if (wait)
                {
                    return;
                }
                wait = true;
                for (int i = 0; i < ItemList.Count; i++)
                {
                    if (ItemList[i] != null)
                    {
                        Item removeitem = ItemList[i];
                        ItemList.Remove(removeitem);
                        removeitem.DoRemove();
                    }
                }


                for (int u = 0; u < (oven.inventory.itemList.Count); u++)
                {
                    if (oven.inventory.itemList[u] == null)
                    {
                        continue;
                    }
                    if (oven.inventory.itemList[u].info == null)
                    {
                        continue;
                    }
                    var itemid = oven.inventory.itemList[u].info.itemid;
                    if (itemid == null)
                    {
                        continue;
                    }
                    if (itemid == 3655341 || itemid == 1436001773)
                    {
                        continue;
                    }

                    var pos = entity.transform.position + new Vector3(0, 0.8f, 0);
                    var ang = entity.transform.eulerAngles;
                    //itemAmount.itemDef.itemid
                    var appear = oven.inventory.itemList[u].info.itemid;
                    if (allChicken)
                    {
                        //burned
                        if (itemid == -225234813 || itemid == -2066726403 || itemid == 1711323399 || itemid == -1014825244 || itemid == 968732481 || itemid == -1714986849)
                        {
                            appear = 1711323399;
                        }
                        //cooked
                        if (itemid == -2043730634 || itemid == 1734319168 || itemid == -202239044 || itemid == -2078972355 || itemid == -991829475 || itemid == 991728250 || itemid == -1691991080)
                        {
                            appear = 1734319168;
                        }
                        //uncooked
                        if (itemid == 1325935999 || itemid == -1658459025 || itemid == -322501005 || itemid == -533484654 || itemid == -642008142 || itemid == -253819519 || itemid == 179448791)
                        {
                            appear = -1658459025;
                        }
                        //spoiled
                        if (itemid == 431617507 || itemid == 661790782 || itemid == -726947205)
                        {
                            appear = -726947205;
                        }
                    }
                    Item item = ItemManager.CreateByItemID(appear, 1, (ulong)0);
                    ItemList.Add(item);
                    DroppedItem food = item.Drop(pos, Vector3.zero).GetComponent <DroppedItem>();
                    food.SetParent(entity);
                    var offset  = 0f;
                    var offset2 = 0f;
                    if (u >= 6)
                    {
                        offset = 0.2f; offset2 = 6;
                    }
                    food.transform.localPosition = new Vector3(-0.1f + offset, 0.8f, -0.38f + (u - offset2) * 0.15f);
                    food.transform.eulerAngles   = ang;
                    food.transform.hasChanged    = true;
                    food.SendNetworkUpdateImmediate();
                    food.GetComponent <Rigidbody>().isKinematic = true;
                    food.GetComponent <Rigidbody>().useGravity  = false;
                    food.allowPickup = false;
                    food.GetComponent <Rigidbody>().detectCollisions = true;
                    food.CancelInvoke((Action)Delegate.CreateDelegate(typeof(Action), food, "IdleDestroy"));
                }

                coroutine = Wait(5);
                StartCoroutine(coroutine);
            }