コード例 #1
0
        //object OnPlayerSleep(BasePlayer player) => true; // TODO: Hook might be causing local player duplication

        void OnEntitySpawned(BaseNetworkable entity)
        {
            if (removeCorpses && entity.ShortPrefabName.Equals("player_corpse"))
            {
                entity.KillMessage();
            }
        }
コード例 #2
0
ファイル: NoSleepers.cs プロジェクト: xBDMx/oxide-plugins
 void OnEntitySpawned(BaseNetworkable entity)
 {
     if (RemoveCorpses && entity.name.EndsWith("player_corpse.prefab"))
     {
         entity.KillMessage();
     }
 }
コード例 #3
0
        //object OnPlayerSleep(BasePlayer player) => true; // TODO: Hook might be causing local player duplication

        void OnEntitySpawned(BaseNetworkable entity)
        {
            // Remove corpse for player on death if enabled
            if (removeCorpses && entity.ShortPrefabName.Equals("player_corpse"))
            {
                entity.KillMessage();
            }
        }
コード例 #4
0
ファイル: HideAndSeek.cs プロジェクト: rustmy/oxideplugins-1
 void OnEntitySpawned(BaseNetworkable entity)
 {
     // Remove all corpses
     if (entity.LookupShortPrefabName().Equals("player_corpse.prefab"))
     {
         entity.KillMessage();
     }
 }
コード例 #5
0
 private void OnEntitySpawned(BaseNetworkable entity)
 {
     // Remove all corpses
     if (config.RemoveCorpses && entity.ShortPrefabName.Equals("player_corpse"))
     {
         entity.KillMessage();
     }
 }
コード例 #6
0
        void OnEntitySpawned(BaseNetworkable entity)
        {
            if (Loaded)
            {
                for (int i = 0; i < configData.deployables.Count; i++)
                {
                    if (entity.ShortPrefabName.Contains(configData.deployables[i]))
                    {
                        var ownerID = entity.GetComponent <BaseEntity>().OwnerID;
                        if (ownerID != 0)
                        {
                            BasePlayer player = BasePlayer.FindByID(ownerID);
                            if (player == null || player.IsAdmin())
                            {
                                return;
                            }
                            if (!HasPriv(player))
                            {
                                Item item;
                                if (entity.ShortPrefabName.Contains("landmine"))
                                {
                                    entity.KillMessage();
                                    item = ItemManager.CreateByPartialName("trap.landmine");
                                }
                                else if (entity.ShortPrefabName.Contains("bear"))
                                {
                                    entity.GetComponent <BaseCombatEntity>().DieInstantly();
                                    item = ItemManager.CreateByPartialName("trap.bear");
                                }
                                else
                                {
                                    entity.GetComponent <BaseCombatEntity>().DieInstantly();
                                    item = ItemManager.CreateByPartialName(configData.deployables[i]);
                                    var deployable = item.info.GetComponent <ItemModDeployable>();
                                    if (deployable != null)
                                    {
                                        var oven = deployable.entityPrefab.Get()?.GetComponent <BaseOven>();
                                        if (oven != null)
                                        {
                                            oven.startupContents = null;
                                        }
                                    }
                                }

                                if (!pendingItems.ContainsKey(player.userID))
                                {
                                    pendingItems.Add(player.userID, new PendingItem());
                                }
                                pendingItems[player.userID].item = item;

                                CheckForDuplicate(player);
                            }
                        }
                    }
                }
            }
        }
コード例 #7
0
ファイル: Pets.cs プロジェクト: gragonvlad/RustPluginManual
 void OnServerInitialized()
 {
     if (Time.realtimeSinceStartup < 100)
     {
         foreach (KeyValuePair <string, PetInfo> entry in SaveNpcList)
         {
             BaseNetworkable parent = BaseNetworkable.serverEntities.Find(entry.Value.parentNPC);
             if (parent != null)
             {
                 parent.KillMessage();
             }
         }
     }
 }
コード例 #8
0
ファイル: NoHeli.cs プロジェクト: wilddip/oxideplugins
        void OnEntitySpawned(BaseNetworkable entity)
        {
            heliPrefabId = StringPool.Get(heliPrefab);

            if (entity == null)
            {
                return;
            }
            if (entity.prefabID == heliPrefabId)
            {
                entity.KillMessage();
                Puts("NoHeli : Patrol Stopped!");
                //PrintToConsole("Heli Stopped"); If you want to broadcast on console

                return;
            }
        }
コード例 #9
0
        void OnEntitySpawned(BaseNetworkable entity)
        {
            if (isCurrent && Active)
            {
                if (entity is BaseEntity)
                {
                    var entityName = entity.ShortPrefabName;


                    if (entityName.Contains("napalm"))
                    {
                        if (!config.HelicopterSettings.UseRockets)
                        {
                            KillEntity(entity as BaseEntity);
                        }
                    }

                    if (entityName.Contains("servergibs_patrolhelicopter"))
                    {
                        entity.KillMessage();
                    }
                }
            }
        }
コード例 #10
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());
			}
		}
コード例 #11
0
ファイル: ZoneManager.cs プロジェクト: mpendel/RUSTBOYS
 /////////////////////////////////////////
 // OnEntitySpawned(BaseNetworkable entity)
 // Called when any kind of entity is spawned in the world
 /////////////////////////////////////////
 private void OnEntitySpawned(BaseNetworkable entity)
 {
     if (entity is BaseCorpse)
     {
         timer.Once(2f, () =>
         {
             HashSet<Zone> zones;
             if (!resourceZones.TryGetValue(entity.GetComponent<ResourceDispenser>(), out zones)) return;
             foreach (var zone in zones)
             {
                 if (HasZoneFlag(zone, ZoneFlags.NoCorpse))
                 {
                     entity.KillMessage();
                     break;
                 }
             }
         });
     }
     else if (entity is BuildingBlock && zoneObjects != null)
     {
         var block = (BuildingBlock) entity;
         foreach (var zone in zoneObjects)
         {
             if (HasZoneFlag(zone, ZoneFlags.NoStability) && zone.Collider.bounds.Contains(block.transform.position))
             {
                 block.grounded = true;
                 break;
             }
         }
     }
     var npc = entity.GetComponent<NPCAI>();
     if (npc != null)
         npcNextTick.SetValue(npc, Time.time + 10f);
 }
コード例 #12
0
 /////////////////////////////////////////
 // OnEntitySpawned(BaseNetworkable entity)
 // Called when any kind of entity is spawned in the world
 /////////////////////////////////////////
 private void OnEntitySpawned(BaseNetworkable entity)
 {
     if (entity is BaseCorpse)
     {
         timer.Once(2f, () =>
         {
             HashSet<Zone> zones;
             if (entity.isDestroyed || !resourceZones.TryGetValue(entity.GetComponent<ResourceDispenser>(), out zones)) return;
             foreach (var zone in zones)
             {
                 if (HasZoneFlag(zone, ZoneFlags.NoCorpse))
                 {
                     entity.KillMessage();
                     break;
                 }
             }
         });
     }
     else if (entity is BuildingBlock && zoneObjects != null)
     {
         var block = (BuildingBlock)entity;
         foreach (var zone in zoneObjects)
         {
             if (HasZoneFlag(zone, ZoneFlags.NoStability))
             {
                 if (zone.Info.Size != Vector3.zero)
                 {
                     if (!new Bounds(zone.Info.Location, Quaternion.Euler(zone.Info.Rotation) * zone.Info.Size).Contains(block.transform.position))
                         continue;
                 }
                 else if (Vector3.Distance(block.transform.position, zone.Info.Location) > zone.Info.radius)
                     continue;
                 block.grounded = true;
                 break;
             }
         }
     }
     var npc = entity.GetComponent<NPCAI>();
     if (npc != null)
         npcNextTick.SetValue(npc, Time.time + 10f);
 }