bool InNoLootZone(BasePlayer victim, BasePlayer attacker) { // Event Manager plugin support - http://oxidemod.org/plugins/event-manager.740/ if (EventManager != null) { if (!((bool)EventManager.Call("isPlaying", victim))) { return(false); } Player.Reply(attacker, Lang("NoLootZone", attacker.UserIDString)); return(true); } // Zone Manager plugin support - http://oxidemod.org/plugins/zones-manager.739/ if (ZoneManager != null) { var noLooting = Enum.Parse(ZoneManager.GetType().GetNestedType("ZoneFlags"), "NoPlayerLoot", true); if (!((bool)ZoneManager.Call("HasPlayerFlag", victim, noLooting))) { return(false); } Player.Reply(attacker, Lang("NoLootZone", attacker.UserIDString)); return(true); } return(false); }
void Setup() { Instance = this; GameObject = new GameObject(); Areas = new AreaManager(); Factions = new FactionManager(); Hud = new HudManager(); Pins = new PinManager(); Users = new UserManager(); Wars = new WarManager(); Zones = new ZoneManager(); Factions.Init(TryLoad <FactionInfo>(FactionsFile)); Areas.Init(TryLoad <AreaInfo>(AreasFile)); Pins.Init(TryLoad <PinInfo>(PinsFile)); Users.Init(); Wars.Init(TryLoad <WarInfo>(WarsFile)); Zones.Init(); Hud.Init(); Hud.GenerateMapOverlayImage(); if (Options.Upkeep.Enabled) { UpkeepCollectionTimer = timer.Every(Options.Upkeep.CheckIntervalMinutes * 60, Upkeep.CollectForAllFactions); } PrintToChat($"{Title} v{Version} initialized."); Ready = true; }
void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitInfo) { if (hitInfo != null && hitInfo.Initiator != null && hitInfo.Initiator.ToPlayer() != null) { BasePlayer player = hitInfo.Initiator.ToPlayer(); if (ZoneManager != null) { object canBeWounded = ZoneManager.Call("CanBeWounded", player, hitInfo); if (canBeWounded == null) { return; } } TimedExplosive explosion = null; if (hitInfo.WeaponPrefab != null && hitInfo.WeaponPrefab.ToString().Contains("explosive")) { explosion = (hitInfo.WeaponPrefab.GetEntity() as TimedExplosive); } if (entity.ShortPrefabName.ToString().Contains("player") && ( explosion == null || explosion.explosionRadius >= player.Distance(entity.GetEntity()) ) ) { float totalDamage = (float)0.0; foreach (Rust.DamageType damageType in Enum.GetValues(typeof(Rust.DamageType))) //calculate the damage the player would take { try { if (hitInfo.damageTypes.Get(damageType) > (float)0.0) { if (hitInfo.damageTypes.Get(damageType) > player.baseProtection.Get(damageType)) //damage of attack surpass player protection { totalDamage += hitInfo.damageTypes.Get(damageType) - player.baseProtection.Get(damageType); } } } catch { } } if (player.health <= totalDamage) { //if (!popupsEnabled) SendReply(player, localization["AboutToDie"]); } //else // PopupNotifications.Call("CreatePopupNotification", localization["AboutToDie"], player); } } }
private void OnDestroy() { ZoneManagerPlugin.OnZoneDestroyed(this); ZoneManagerPlugin = null; }
private void OnDestroy() { CancelInvoke("CheckLights"); ZoneManagerPlugin.OnZoneDestroy(this); ZoneManagerPlugin = null; Destroy(gameObject); }
private bool ZMNoSignUpdates(BasePlayer player) { return((bool)ZoneManager.CallHook("EntityHasFlag", player, "nosignupdates")); }