public void Spawn(int index) { Map map = Map; if (map == null || map == Map.Internal || SpawnNamesCount == 0 || index >= SpawnNamesCount || Parent != null) { return; } Defrag(); if (CheckSpawnerFull()) { return; } ISpawnable spawned = CreateSpawnedObject(index); if (spawned == null) { return; } spawned.Spawner = this; m_Spawned.Add(spawned); Point3D loc = (spawned is BaseVendor ? this.Location : GetSpawnPosition(spawned)); spawned.OnBeforeSpawn(loc, map); spawned.MoveToWorld(loc, map); spawned.OnAfterSpawn(); if (spawned is BaseCreature) { BaseCreature bc = (BaseCreature)spawned; if (m_WalkingRange >= 0) { bc.RangeHome = m_WalkingRange; } else { bc.RangeHome = m_HomeRange; } bc.CurrentWayPoint = m_WayPoint; bc.SeeksHome = m_MobilesSeekHome; if (m_Team > 0) { bc.Team = m_Team; } bc.Home = (m_UsesSpawnerHome) ? this.HomeLocation : bc.Location; } InvalidateProperties(); }
public void Spawn(SpawnObject so) { Map map = Map; if (map == null || map == Map.Internal || SpawnObjectCount == 0 || so == null || Parent != null || GetSpawnCount(so) >= so.MaxCount) { return; } Defrag(); if (CheckSpawnerFull()) { return; } ISpawnable spawned = CreateSpawnedObject(so); if (spawned == null) { return; } spawned.Spawner = this; so.SpawnedObjects.Add(spawned); Point3D loc = (spawned is BaseVendor ? Location : GetSpawnPosition(spawned)); spawned.OnBeforeSpawn(loc, map); InvalidateProperties(); spawned.MoveToWorld(loc, map); if (spawned is BaseCreature) { BaseCreature bc = (BaseCreature)spawned; if (m_WalkingRange >= 0) { bc.RangeHome = m_WalkingRange; } else { bc.RangeHome = m_HomeRange; } bc.CurrentWayPoint = m_WayPoint; if (m_Team > 0) { bc.Team = m_Team; } bc.Home = HomeLocation; } }
public void Spawn(int index) { Map map = this.Map; if (map == null || map == Map.Internal || this.SpawnNamesCount == 0 || index >= this.SpawnNamesCount || this.Parent != null) { return; } this.Defrag(); if (this.CheckSpawnerFull()) { return; } ISpawnable spawned = this.CreateSpawnedObject(index); if (spawned == null) { return; } spawned.Spawner = this; this.m_Spawned.Add(spawned); Point3D loc = (spawned is BaseVendor ? this.Location : this.GetSpawnPosition(spawned)); spawned.OnBeforeSpawn(loc, map); this.InvalidateProperties(); spawned.MoveToWorld(loc, map); if (spawned is BaseCreature) { BaseCreature bc = (BaseCreature)spawned; if (this.m_WalkingRange >= 0) { bc.RangeHome = this.m_WalkingRange; } else { bc.RangeHome = this.m_HomeRange; } bc.CurrentWayPoint = this.m_WayPoint; if (this.m_Team > 0) { bc.Team = this.m_Team; } bc.Home = this.HomeLocation; } }
protected virtual ISpawnable Spawn() { if (!CanSpawn()) { return(null); } Map map = this.Map; ISpawnable spawnable = ConstructSpawnableObject(); if (spawnable != null) { Point3D loc = map.GetSpawnPosition(this.Location, m_SpawnRange); spawnable.OnBeforeSpawn(loc, map); spawnable.MoveToWorld(loc, map); if (spawnable is BaseCreature) { BaseCreature bc = (BaseCreature)spawnable; bc.Home = this.Location; bc.RangeHome = this.HomeRange; bc.CurrentWayPoint = this.WayPoint; bc.CantWalk = this.CantWalk; bc.Blessed = this.Blessed; bc.Team = this.Team; if (this.Blessed) { bc.Tamable = false; } if (this.Murderer) { bc.Kills = 100; } } this.OnAfterSpawn(spawnable); spawnable.OnAfterSpawn(); } return(spawnable); }