Mods / Zarathrustra

Tags: #Utility
Author: Zarathrustra
Side: Client
Created: Oct 7th at 9:09 PM
Last modified: Oct 9th at 6:32 AM
Downloads: 1600
Follow Unfollow 79

Latest release (for Vintage Story 1.21.4, potentially outdated):
spawnhighlight_1.1.0.zip  1-click install


(This is a fixed and enhanced copy of the mod at https://news.kalataka.ru/show/mod/7845)

Spawn Highlight

Allows to highlight blocks where drifters can spawn.
Ever tired of drifter-proofing your base? This mod is for you!

Press Ctrl+L to show/hide highlights. Keybinding can be changed in the settings.

Default colors:
Red - drifters can spawn on this block
Green - drifters cannot spawn on this block because it is sufficiently lit
Not highlighted - drifter will never spawn on this block. Examples are lower slabs, stones and chiseled blocks

Remember that drifters will not spawn under sunlight, and will spawn anywhere they want while temporal storm is in progress.

To be more specific, the mod checks this rules for each block in radius:

  1. Block has solid upper side
  2. Upper block is air, tall grass or loose stones
  3. Non-natural light level is greater than 6

This mod is quite similar to Easy Light Levels. You may check it too if you want wider configuration options.

Commands

.sphi - Show/Hide highlights. Does exactly the same as Ctrl+L
.sphi radius <number> - Change size of cube around you, where mod will scan and highlight blocks. Default is 20
.sphi litcolor #RRGGBBAA - Set color for sufficiently lit zones. Default is #00FF0020
.sphi spawncolor #RRGGBBAA - Set color for zones where mobs can spawn. Default is #FF000020

.sphi threshold <number> - Set value for what is considered a safe light level. Default is 7.

Config

If you prefer json instead of commands, you can change the values in the spawnhighlightcustom-config.json which can be found in VintagestoryData/ModConfig folder

{
  "Radius": 20,
  "SafeColor": "#00FF0020",
  "SpawnableColor": "#FF000020"
  "SpawnHighlightThreshold": 7
}


Japanese language support is included for the original functions of the mod, but as I do not speak Japanese well, I cannot extend the language support for the new functionality without assistance.
Japanese language does not seem to be actually working.

Mod Version For Game version Downloads Released Changelog Download 1-click mod install*
1.1.0 1530 Oct 9th at 6:32 AM spawnhighlight_1.1.0.zip 1-click install

Now features a command for configuring the light level to make it compatible with nonstandard settings.

Use .sphi threshold to display the current value, or supply a value as an argument to set the threshold to that value.

Alternatively, go into VintagestoryData/ModConfig/spawnhighlight-custom.json and edit the threshold value there.

1.0.2 53 Oct 8th at 1:17 AM spawnhighlight_1.0.2.zip 1-click install

Added Japanese translation posted on original mod.

Still working on fully publishing the mod.

1.0.0 16 Oct 7th at 9:10 PM spawnhighlightcustom.zip 1-click install

Initial release. Changed light level from 6 to 7 to correct original mod. No other changes.


10 Comments (oldest first | newest first)

💬 Zarathrustra , Nov 4th at 11:39 PM (modified Nov 4th at 11:40 PM)

@Hikara
the main part of the mod are these two lines:

1. var lightLevel = api.World.BlockAccessor.GetLightLevel(blockPosition, EnumLightLevelType.OnlyBlockLight);


2. colors.Add(lightLevel > config.SpawnHighlightThreshold ? config.SafeColor : config.SpawnableColor);


translated -

1. get the light level of the block and store in lightlevel
2. if the lightlevel value of the block is greater than the config.SpawnHighlightThreshold, make it the SafeColor; otherwise make it the SpawnableColor.

That's the main part that makes this mod work. All I did to change it was add config.SpawnHighlightThreshold rather than a hardcoded value.

As to why it decides that three blocks away from an oil lamp should be colored red -- I couldn't tell you that. The math says we should get an extra square. But these are direct api calls and then just running a comparison on the values --- there's no additional fiddling with the lightlevel value. I'd be inclined to trust this.


💬 Hikhara, Nov 1st at 4:20 PM

I'm a tad confused about the mod. An oil lamp is supposed to have an intensity of 11, which means when placed on the ground the adjacent block is light level 10, and so on, reaching light level 7 on the 4th block.
But when I set the threshold at 7, the 3rd block that supposedly has a light level of 8 (and should be green) becomes red as well.

💬 Zarathrustra , Oct 17th at 1:20 AM

Just re-iterating: this mod will likely continue to work for any version of vintagestory which uses dotnet 8.0, unless the devs change how light works considerably, or change spawning light levels.

💬 Zarathrustra , Oct 16th at 4:24 AM

Thank the original creator for having the foresight to post the source code to github! I wouldn't have been able to do this otherwise.

But glad to be of service!

💬 CKitt, Oct 15th at 9:37 PM

I just had a player on my server ask for this (the original mod, anyway) by name, and I was going to break the bad news to them... but then I saw this. Excellent to see it revived, thank you! 👍

💬 Zarathrustra , Oct 9th at 6:34 AM (modified Oct 9th at 6:46 AM)

Version 1.1.0 now features a configurable threshold for the light value to make it compatible with mods that alter spawning light levels.

Use .sphi threshold to display the current value, or supply a value as an argument to set the threshold to that value.

Alternatively, go into VintagestoryData/ModConfig/spawnhighlightcustom-config.json and edit the threshold value there.

💬 Zarathrustra , Oct 8th at 4:29 AM (modified Oct 8th at 4:33 AM)

@Tahvohck It uses hardcoded values. It is not any different from the source mod, except that the value was updated from 6 to 7 to be correct.

It was very easy to change, so I can always easily make you a special version if you know what the target light level should be. If this value is specific to a particular mod, let me know what it is, so I can title it appropriately.

(sorry, it isn't letting me tag you like I did JupiterAugust, hope you see this soon!)

 

💬 Zarathrustra , Oct 8th at 4:27 AM (modified Oct 8th at 4:54 AM)


JupiterAugust I don't think there's anything which should stop it from working for 1.21.1. The original mod worked for a much older version which used dotnet 7.0, and other than the versioning number and one single value, nothing was changed. Technically speaking, it will probably work for any version of vintagestory which uses dotnet 8.0, unless the devs change how light works considerably, or change spawning light levels.

If for some reason it won't let you use this version in 1.21.1, let me know, and I'll re-release it with a lower version number to bypass the restriction.

💬 Tahvohck, Oct 8th at 2:21 AM

Does this use hardcoded values, or does it actually read the light level required for monsters to spawn?

💬 JupiterAugust, Oct 8th at 1:44 AM

Hi! Sorry to bother since I know you just published this, but any chance of backwards compatibility with 1.21.1? I'm still waiting for all my mods to update to 1.21.4 before I switch over to it. 

 (edit comment delete)
Основной веб-сайт | Почтовый сервер | FTP сервер | Административная панель | API интерфейс | Content Delivery Network | Статические файлы | Ресурсы сайта | Изображения | Файловое хранилище | Блог | Интернет-магазин | Техническая поддержка | Справочная система | Документация | Форум | Новости | Загрузки | Демонстрация | Тестовая среда | Приложение | Медиа контент | Разработка | Промежуточная среда | Бета версия | Безопасная зона | Вход в систему | Панель управления | Портал | Система управления контентом