Space Engineers

Space Engineers

Not enough ratings
Threat Score
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
105.082 KB
May 26, 2021 @ 5:07pm
Jul 30, 2021 @ 8:29am
5 Change Notes ( view )

Subscribe to download
Threat Score

Description
Threat Score script calculates the Modular Encounters Spawner threat level score for the grid.
To preserve server performance it runs only once, if you change any blocks or grid connections, manually run again.
The score and details per block type (power, weapons, etc) are shown in the programmable block control panel.

Steam Workshop: https://steamcommunity.com/sharedfiles/filedetails/?id=2498906212
Source code: https://github.com/StalkR/SpaceEngineersStuff/blob/master/threat_score.cs

The Threat Score calculation is explained at https://gist.github.com/MeridiusIX/52fbf5679e67107a8cf37706205b5812
Or in source at https://github.com/MeridiusIX/ModularEncountersSpawner/blob/36b5ef10fb39f4149532ca3a23840c3129605fdd/Data/Scripts/ModularEncountersSpawner/Spawners/SpawnResources.cs#L636

It is an approximation because ingame scripts cannot get the ModId of a block, so they cannot reliably double the threat score of modded blocks.
The script is only aware of a few modded blocks from Draconis Impossible Extended (https://wiki.sigmadraconis.games/doku.php?id=di:draconis_impossible).

Finally, remember the total threat score is calculated for all grids in a given sphere radius (other players, unknown signals, etc).

Modular Encounters Spawner mod: https://steamcommunity.com/workshop/filedetails/?id=1521905890
Popular Discussions View All (1)
4
Jun 7, 2021 @ 10:42am
how to view it?
Firefly
10 Comments
Dark_453 Feb 19 @ 4:03am 
Hey there, Was the Block Count Ever Fixed, Been awaiting last patch to fix some error's was checking my subs and i was watching this. - *sorry to open older comments*
StalkR  [author] Jul 27, 2023 @ 7:54am 
No modded blocks shouldn't be a problem, then it means too many blocks and my script is not well optimized so it's my fault :) sorry!
Abisius Jul 25, 2023 @ 10:42am 
@StalkR
already did that before making my last comment.

atm the grid has just 20674 blocks and is a planetary base build on pertam, maybee it has probs with some of the modded blocks or mods in use?

made a collection of the mods i have atm in use on that world https://steamcommunity.com/sharedfiles/filedetails/?id=2425314026
StalkR  [author] Jul 25, 2023 @ 10:01am 
@Abisius: as per the comment in the script, if you get "script too complex" it means the grid is too large, so make sure to use `multiGrid = false` then press `i` to open the info tab, read the total number of blocks on the grid, and write it in the script `totalBlocks = 0` (replace 0 with the total number of blocks on the grid).
Abisius Jul 16, 2023 @ 2:41pm 
does anyone else have probs with the programmable block saying that the script is too complex?
StalkR  [author] Oct 30, 2022 @ 3:23am 
SylphicXen: thanks, that's a good idea! Filed https://github.com/StalkR/Space-Engineers-Stuff/issues/1 for tracking and further discussion.
SylphicXen Oct 29, 2022 @ 5:41pm 
Might I suggest a possible way to estimate the block count of armor? If you can accurately get the counts of functional blocks that are exposed to in-game scripting, you can subtract their combined weights (since weights of default blocks at the very least don't change) and guess that the nonfunctional blocks are light armor or heavy armor, depending on user choice.

It won't be accurate, but perhaps it can be an alternative for people who don't want to look up the block count in info, and/or don't need a completely accurate estimation of the score.

You can even provide a prefix to the result like ≈ to show that it's not completely accurate.
StalkR  [author] Jul 30, 2021 @ 8:32am 
Workshop updated with latest version from github: if hitting 'too complex' error, you can now provide the number of blocks of the grid with `int totalBlocks = XXX` (and set multiGrid = false) so it doesn't need to count (expensive). Upvote https://support.keenswh.com/spaceengineers/pc/topic/feature-request-ingame-script-api-expose-grid-block-count so we can properly automate this :)
StalkR  [author] Jul 23, 2021 @ 2:43am 
@mppc2001 yes unfortunately the game doesn't expose the total number of blocks of the grid, and trying to count them doesn't scale well. In that case just look up the block count of the grid under the 'info' tab and provide it to the script then it won't need to count it (and disable multigrid). Use this slightly modified script https://github.com/StalkR/SpaceEngineersStuff/blob/master/threat_score.cs and add the block count on line 27 (I'll update the workshop version some other time).
mppc2001 Jul 22, 2021 @ 3:20am 
This is a great script and worked well on smaller ships, but when I tried with Warships it gave error: Script execution terminated, script is too complex. Please edit and rebuild script.
Hope you can make it work, cheers!