Mods / C&N Spawn Conditions

Tags:
Author:
KenigVovan
Side:
Server
Created:
Aug 21st 2025 at 4:10 PM
Last modified:
May 15th at 6:04 PM
Downloads:
711
Latest release (for Vintage Story 1.22.2, potentially outdated):
canspawnconditions_1.2.1.zip  1-click install

CAN SPAWN CONDITIONS

Server-side spawn control for Vintage Story

Adds two configurable spawn rules: a kill-based zone limiter that prevents overhunted areas from respawning the same mob types, and a safe radius around players that keeps hostile mobs from spawning on top of them. All entity groups are matched by regex — no hardcoded lists.

New: in-game admin GUI — tune the config, inspect tracked zones and view a heatmap of kills without restarting the server. Open with Ctrl+K (requires the controlserver privilege).

Features

  • Kill tracker — the world is divided into zones. When a tracked mob is killed its death is recorded for that zone. Once the kill count reaches the configured threshold, further spawns of that group are blocked in the same zone.
  • Safe zone around players — hostile mobs cannot spawn within a configurable radius of any online player.
  • Population recovery — each in-game year a configurable fraction of kill counts is subtracted, allowing populations to recover over time.
  • Per-zone overrides — override the kill threshold for a specific zone (e.g. make a single spot harder or impossible to deplete).
  • Persistent data — kill counts are saved to the world file periodically and on normal shutdown.
  • Server-side only for the spawn rules — clients don't need the mod installed. The admin GUI runs on the client only for admins who do install it.

Admin GUI

Press Ctrl+K in-game. Available tabs:

  • Status — live metrics and a searchable list of every entity code that currently matches one of your regex patterns.
  • Settings — sliders for the radius, zone size, save interval and yearly erase fraction. Changes apply automatically when you release the slider.
  • Regex / Thresholds — add or remove entity regex patterns and per-group kill thresholds. Patterns that don't match any entity are highlighted.
  • Zones — sortable, filterable table of every tracked zone with its kill count, applicable threshold, and a one-click clear.
  • Map — pannable heatmap of kills for a selected group. Click a cell to select it, then set or clear a per-zone threshold override; right-click clears that zone's kill count.
  • Actions — force save, apply yearly erase, and clear all kill data (with confirmation prompt).

Default thresholds

  • wolf-* — 8 kills per zone
  • hyena-* — 15 kills per zone
  • bear-* — 1 kill per zone
  • bell-* — 1 kill per zone
  • locust-corrupt-sawblade — 1 kill per zone

Configuration

Config is generated at ModConfig/canspawnconditions.json on first launch. All values are also editable live through the admin GUI.

  • Hostile_Entities — regex patterns for mobs blocked from spawning near players
  • HostileNoSpawnAreaAroundPlayer — radius in blocks around each online player (default: 24)
  • KilledCheckerEntitiesRegex — regex patterns for mobs whose kills are tracked
  • KilledEntityThreshold — kill count per zone after which that group stops spawning
  • KilledCheckerZoneSize — side length in blocks of each tracking zone (default: 1024)
  • PercentOfKilledNumberToEraseEveryYear — fraction subtracted from kill counts each in-game year (default: 0.30)
  • StoreCheckerDataEveryNSeconds — how often kill data is saved to the world file (default: 360)

Requirements

Mod Version Mod IdentifierFor Game version Downloads Released Changelog Download 1-click mod install*
1.2.1 canspawnconditions 376 May 15th at 6:04 PM canspawnconditions_1.2.1.zip 1-click install
  • admin gui
1.1.0 canspawnconditions 30 May 2nd at 8:30 AM canspawnconditions_1.1.0.zip 1-click install
  • .22
1.0.4 canspawnconditions 76 Jan 20th at 5:31 PM canspawnconditions_1.0.4.zip 1-click install
  • rebuild
1.0.2 canspawnconditions 42 Aug 30th 2025 at 10:11 AM Empty canspawnconditions_1.0.2.zip 1-click install
1.0.1 canspawnconditions 115 Aug 30th 2025 at 10:08 AM canspawnconditions_1.0.1.zip 1-click install
  • fix vec2i usage
1.0.0 canspawnconditions 72 Aug 21st 2025 at 4:11 PM Empty canspawnconditions_1.0.0.zip 1-click install

4 Comments (oldest first | newest first) (threaded | flat)

KenigVovan , Aug 30th 2025 at 10:09 AM (modified Aug 30th 2025 at 10:11 AM)

Origin_Alpha_43

1.0.1 should fix it, old collected data of killed entities will be lost unfortunately
(or 1.0.2 for .20.12)

Origin_Alpha_43, Aug 30th 2025 at 4:31 AM (modified Aug 30th 2025 at 4:32 AM)

worked fine 2 restarts ago
now doesnt work. server crash on launch as soon as it starts loading the world

Crash Report
System.ArgumentException: An item with the same key has already been added. Key: 250 / 250
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at System.Collections.Generic.Dictionary`2.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Add(KeyValuePair`2 keyValuePair)
at proto_32(Object, ProtoReader)
at ProtoBuf.Meta.TypeModel.TryDeserializeAuxiliaryType(ProtoReader reader, DataFormat format, Int32 tag, Type type, Object& value, Boolean skipOtherFields, Boolean asListItem, Boolean autoCreate, Boolean insideList, Object parentListOrType) in C:\Code\pb-net_24\src\protobuf-net\Meta\TypeModel.cs:line 1077
at ProtoBuf.Meta.TypeModel.TryDeserializeList(TypeModel model, ProtoReader reader, DataFormat format, Int32 tag, Type listType, Type itemType, Object& value) in C:\Code\pb-net_24\src\protobuf-net\Meta\TypeModel.cs:line 946
at ProtoBuf.Meta.TypeModel.TryDeserializeAuxiliaryType(ProtoReader reader, DataFormat format, Int32 tag, Type type, Object& value, Boolean skipOtherFields, Boolean asListItem, Boolean autoCreate, Boolean insideList, Object parentListOrType) in C:\Code\pb-net_24\src\protobuf-net\Meta\TypeModel.cs:line 1077
at ProtoBuf.Meta.TypeModel.DeserializeCore(ProtoReader reader, Type type, Object value, Boolean noAutoCreate) in C:\Code\pb-net_24\src\protobuf-net\Meta\TypeModel.cs:line 721
at ProtoBuf.Meta.TypeModel.Deserialize(Stream source, Object value, Type type, SerializationContext context) in C:\Code\pb-net_24\src\protobuf-net\Meta\TypeModel.cs:line 591
at ProtoBuf.Meta.TypeModel.Deserialize(Stream source, Object value, Type type) in C:\Code\pb-net_24\src\protobuf-net\Meta\TypeModel.cs:line 570
at ProtoBuf.Serializer.Deserialize[T](Stream source) in C:\Code\pb-net_24\src\protobuf-net\Serializer.cs:line 68
at Vintagestory.API.Util.SerializerUtil.Deserialize[T](Byte[] data) in VintagestoryApi\Util\SerializerUtil.cs:line 60
at SaveGame.GetData[T](String name, T defaultValue) in VintagestoryLib\Server\Models\SaveGame.cs:line 371
at canspawnconditions.NováSložka.KilledChecker.LoadData() in C:\Users\koeni\source\repos\canspawnconditions\canspawnconditions\canspawnconditions\src\KilledChecker.cs:line 84
at canspawnconditions.canspawnconditions.<>c__DisplayClass3_0.b__1() in C:\Users\koeni\source\repos\canspawnconditions\canspawnconditions\canspawnconditions\canspawnconditions.cs:line 50
at Vintagestory.Server.ServerEventAPI.OnServerStage(EnumServerRunPhase runPhase) in VintagestoryLib\Server\API\ServerEventAPI.cs:line 147
at Vintagestory.Server.ServerSystemModHandler.OnBeginGameReady(SaveGame savegame) in VintagestoryLib\Server\Systems\ModHandler.cs:line 77
at Vintagestory.Server.ServerMain.EnterRunPhase(EnumServerRunPhase runPhase) in VintagestoryLib\Server\ServerMain.cs:line 657
at Vintagestory.Server.ServerMain.Launch() in VintagestoryLib\Server\ServerMain.cs:line 576
at Vintagestory.Server.ServerProgram.Main() in VintagestoryLib\Server\ServerProgram.cs:line 132
at Vintagestory.ClientNative.CrashReporter.Start(ThreadStart start) in VintagestoryLib\Client\ClientPlatform\ClientNative\CrashReporter.cs:line 93
KenigVovan , Aug 23rd 2025 at 8:15 PM

Vargur

both ways can work, the first one with a block would be easier to use I guess but would require some texture/model(or you can just hide it)

Vargur, Aug 22nd 2025 at 1:52 PM

This is a great mod for immersion imo, I hate seeing drifter pop into existence right next to me.

 

Question related to the no spawn area feature, do you think its possible to make the area placeable somehow? Something like a block that when placed at the corners of a square would block spawn inside those lines? It would be ideal to be able to exactly match the no-spawn zone to base walls somehow. Or maybe the no-spawn zone could be set in a config via coords?