Пример #1
0
 void OnEntitySpawned(BaseNetworkable entity)
 {
     // Remove all corpses
     if (entity.LookupShortPrefabName().Equals("player_corpse.prefab"))
     {
         entity.KillMessage();
     }
 }
Пример #2
0
 private bool ProcessBarrel(BaseNetworkable entity)
 {
     if (entity.isActiveAndEnabled && barrels.Contains(entity.LookupShortPrefabName()))
     {
         entity.Kill();
         return(true);
     }
     return(false);
 }
Пример #3
0
        private bool CheckNetworkable(BaseNetworkable networkable)
        {
            if (isBlocked(networkable.name, networkable.LookupPrefabName(), networkable.LookupShortPrefabName()))
            {
                networkable.Kill();
                return(true);
            }

            return(false);
        }
Пример #4
0
 void OnEntitySpawned(BaseNetworkable entity)
 {
     if (!server_ready)
     {
         return;
     }
     if (ProcessBarrel(entity))
     {
         Puts($"Deleted {entity.LookupShortPrefabName()}");
     }
 }
Пример #5
0
		/*--------------------------------------------------------------//
		//					OnEntitySpawned Hook						//
		//--------------------------------------------------------------*/
		void OnEntitySpawned(BaseNetworkable entity)
		{
			
			if (entity == null) return;
			if (entity.LookupShortPrefabName() == "heli_crate.prefab") 
			{
				/*-----------------------------------------------------------------------------//
				//Prefab Properties of heli_crate:											   //
				//string guid = c175b252164d05d42ade2fb672b97331							   //
				//uint hash = 2225886856													   //
				//string name = assets/bundled/prefabs/npc/patrol_helicopter/heli_crate.prefab //
				//-----------------------------------------------------------------------------*/
				//Puts("HELI CRATE SPAWNED MOTHER FUCKERRR");

				//-----------------------------------------------------------------------------//
				if ((bool)Config["UseCustomLoot"])
				{
					LootContainer heli_crate = (LootContainer)entity;
					int index;
					//var random;
					do
					{
					var random = new System.Random();
					index = random.Next(storedData.HeliInventoryLists.Count);
					} while(index == last && storedData.HeliInventoryLists.Count > 1);
					last = index;
					//Puts("Index: " + index.ToString());
					BoxInventory inv = storedData.HeliInventoryLists[index];
					heli_crate.inventory.itemList.Clear();
					foreach ( ItemDef itemDef in inv.lootBoxContents)
					{
						Item item = ItemManager.CreateByName(itemDef.name, itemDef.amount);
						item.MoveToContainer(heli_crate.inventory, -1, false);
					}
					heli_crate.inventory.MarkDirty();
				}
				//---------------------------------------------------------------------------*/
				
				/*----------------Fill up the dat file with default drop---------------------//
				//-----------------------used for development--------------------------------//
				try
				{
					LootContainer heli_crate = (LootContainer)entity;
					//Puts(heli_crate.inventory.itemList);
					List<Item> itemlist = heli_crate.inventory.itemList;
					//Puts("itemlist: " + itemlist.Count.ToString());
					BoxInventory temp = new BoxInventory();
					//Puts("started from the bottom now we're here");
					foreach (var item in itemlist)
					{
						ItemDef temp2 = new ItemDef(item.info.shortname, item.amount);
						//Puts("yep");
						temp.lootBoxContents.Add(temp2);
						//Puts("heh");
					}
					foreach (ItemDef itemdef in temp.lootBoxContents)
					{
						Puts("item: " + itemdef.name + " " + itemdef.amount);
					}

					storedData.HeliInventoryLists.Add(temp);
					//Puts(storedData.ToString());
				} 
				catch(NullReferenceException)
				{
					Puts("f**k me it's null again");
				}
				SaveData();
				//-------------------------------------------------------------------------*/
			}

			//994850627 is the prefabID of a heli.
			if (entity.prefabID == 994850627)
			{
				// Disable Helicopters
				if ((bool)Config["DisableHeli"])
				{
					entity.KillMessage();
					Puts("Helicopter destroyed!");
					return;
				}
				BaseHelicopter heli = (BaseHelicopter)entity;
				heli.maxCratesToSpawn = (int)Config["MaxLootCratesToDrop"];
				heli.bulletDamage = float.Parse(Config["HeliBulletDamageAmount"].ToString());
			}
		}