예제 #1
0
    private void Init()
    {
        if (MagInternal)
        {
            //automatic ejection always disabled
            SmartGun = false;

            //populate with a full internal mag on spawn
            Logger.LogTraceFormat("Auto-populate internal magazine for {0}", Category.Inventory, name);

            //Make generic magazine and modify it to fit weapon
            GameObject ammoPrefab = AmmoPrefabs.GetAmmoPrefab(AmmoType.Internal);

            Inventory.ServerAdd(Spawn.ServerPrefab(ammoPrefab).GameObject, magSlot);

            CurrentMagazine.ChangeSize(MagSize);
            CurrentMagazine.ammoType = ammoType;

            if (isServer)
            {
                CurrentMagazine.ServerSetAmmoRemains(MagSize);
            }
        }
        else
        {
            //populate with a full external mag on spawn
            Logger.LogTraceFormat("Auto-populate external magazine for {0}", Category.Inventory, name);

            //AmmoPrefabs
            GameObject ammoPrefab = AmmoPrefabs.GetAmmoPrefab(ammoType);

            Inventory.ServerAdd(Spawn.ServerPrefab(ammoPrefab).GameObject, magSlot);
        }
    }
예제 #2
0
파일: Gun.cs 프로젝트: ynot01/unitystation
    private void Init()
    {
        //populate with a full mag on spawn
        Logger.LogTraceFormat("Auto-populate magazine for {0}", Category.Inventory, name);

        //AmmoPrefabs
        GameObject ammoPrefab = AmmoPrefabs.GetAmmoPrefab(ammoType);

        Inventory.ServerAdd(Spawn.ServerPrefab(ammoPrefab).GameObject, magSlot);
    }