Space Engineers

Space Engineers

122 ratings
Block Restrictions
2
2
   
Award
Favorite
Favorited
Unfavorite
Type: Mod
Mod category: Block, Script
File Size
Posted
Updated
916.142 KB
Apr 8, 2020 @ 9:42am
Feb 10, 2024 @ 9:55am
38 Change Notes ( view )

Subscribe to download
Block Restrictions

Description
Last updated June 3, 2023

Hello! Have you ever wanted to restrict the use of certain blocks for certain player types? Now you can! This mod enables server owners and admins to customize the availability settings for all terminal blocks in the game, to include any that have been added via other mods!

Note that the Basic Assembler cannot be locked as Keen checks for it explicitly. As such, the script will force the AllowedForPlayer setting to true for this block.

How to get started using Block Restrictions
Follow these easy steps:
  1. Add the mod to your server's mod list
  2. Start the server
  3. Locate the generated config file, "BlockRestrictions.cfg" in your server's storage folder
  4. Edit the config file per the guidelines below and save the changes
  5. Restart the server for changes to take effect
  6. ???
  7. Profit!!

Editing the configuration file
I recommend opening the config file in Notepad++ or another editor that supports XML syntax highlighting. Once you have it open, you'll see sections like this:
<SerializableBlockSetting> <Type>MyObjectBuilder_Projector/LargeProjector</Type> <PlayerMaxCount>0</PlayerMaxCount> <GridMaxCount>0</GridMaxCount> <FactionMaxCount>0</FactionMaxCount> <AllowedForNPC>true</AllowedForNPC> <AllowedForPlayer>true</AllowedForPlayer> <AllowedForUnowned>true</AllowedForUnowned> <AllowedForNPCStaticOnly>false</AllowedForNPCStaticOnly> <AllowedForPlayerStaticOnly>false</AllowedForPlayerStaticOnly> <AllowedForUnownedStaticOnly>false</AllowedForUnownedStaticOnly> </SerializableBlockSetting>

Block Types
The config file holds a section for every variant of every terminal block in the game, so you will see two entries for the projector, two for the programmable block, etc. You'll need to change the settings for each variant separately if you want all variants to be restricted.

Max Counts
The first three values after the type are for setting up the max counts for players, grids, and factions. A setting of zero means there is no maximum. If you want to disable the block, that setting is outlined below and you need not mess with these values.

Owner Types
There are three owner types you can affect with the settings:
  • NPCs
  • Players
  • Unowned

The Logic
By setting something to false, that block will no longer be able to be placed by that owner type. If an owner of that type does place a block, or if ownership of the block is changed to them, the block will be removed from the game. If the block is player-owned, and the player is around, the mod will attempt to refund the components used to the player's inventory, provided the block wasn't placed with creative tools.

You will also see the "Static Only" option for each owner type; this means that the block is placeable only on stations. In order for the static only option to work, the normal option must be set to true.

NOTE: Server owners and Admins are able to place any block anywhere, regardless of the player setting for that block type, as long as they are either in a creative game or have Enable Creative Tools checked in the admin settings

NEW! Group Settings
You can now group items together with a GroupSetting! This setting allows you to mix and match any block types and apply a group restriction on them, so you can for example restrict a grid / player / faction to having only 5 of ANY type of turret. Here's what that would look like for vanilla turrets. Note that GroupName must be unique for each group.
<SerializableGroupSetting> <GroupName>Vanilla Turrets</GroupName> <PlayerMaxCount>0</PlayerMaxCount> <GridMaxCount>5</GridMaxCount> <FactionMaxCount>0</FactionMaxCount> <AllowedForNPC>true</AllowedForNPC> <AllowedForPlayer>true</AllowedForPlayer> <AllowedForUnowned>true</AllowedForUnowned> <AllowedForNPCStaticOnly>false</AllowedForNPCStaticOnly> <AllowedForPlayerStaticOnly>false</AllowedForPlayerStaticOnly> <AllowedForUnownedStaticOnly>false</AllowedForUnownedStaticOnly> <Definitions> <DefinitionId Type="MyObjectBuilder_LargeGatlingTurret" SubtypeId="(null)" /> <DefinitionId Type="MyObjectBuilder_LargeGatlingTurret" SubtypeId="SmallGatlingTurret" /> <DefinitionId Type="MyObjectBuilder_LargeMissileTurret" SubtypeId="(null)" /> <DefinitionId Type="MyObjectBuilder_LargeMissileTurret" SubtypeId="SmallMissileTurret" /> <DefinitionId Type="MyObjectBuilder_InteriorTurret" SubtypeId="LargeInteriorTurret" /> </Definitions> </SerializableGroupSetting>

Found a bug?
I've tested the mod both in single player and on my test server without issue, but that isn't to say that there aren't bugs that I haven't thought of or found. If you find one, please let me know and I'll get it fixed up ASAP! You can leave a message here or find me on Discord @ jTurp#7926

Known Issues
None that I know of.
Popular Discussions View All (1)
2
Oct 5, 2021 @ 12:00pm
PINNED: MODDERS: How to add a default restriction setting for mod blocks
jTurp
318 Comments
Raszul Oct 3 @ 4:34am 
would it be possible to add the ability to make faction-based limits? eg blue team gets the lasers, red team gets the conventional guns or some such?
Atomhirsch Sep 22 @ 5:49am 
Hm, for me it still works
Borimino Sep 15 @ 2:38am 
In case it helps with debugging my problem as described below, here is my config: https://pastebin.com/hK46RCu9
Borimino Sep 15 @ 2:34am 
Hi
I had the mod working perfectly on a dedicated server one or two SE-updates ago, but since the last update (1.207) it doesn't seem to do anything anymore.
I have all refineries set to AllowedForPlayer=false, and yet I am able to place and start building a refinery without any problems. The same for all the other blocks that I have set to not be buildable by players.
I have tried both as an admin on the server, and without admin-priviledges, and none of them work.
Maybe I have made a mistake in my config, though as it worked last time I tried (in 1.205 or 1.206) and I have barely made any changes to the config, I kind of doubt it.
Wast3d11222 Sep 7 @ 5:44pm 
Hi there, I might have found a bug in your latest update with the newly added group settings. i use the mod in a dedicated server on which i have set a group limit to all refinarys at the same time. the group limit works perfect but the issue is with the admin mode: enable creative mode tools.

for any admin that has any number at or below the limit of the group and enters creative mode and leaves it again gets all blocks of the set group (refinarys in my case) deleted with the notification that they are not allowed to place any over the limit. after that they are not able to place any refinary again even if they now own 0 refinaries after the deletion by the mod. i then have to reboot the server for the problem to be solved but it happens again after they enable and disable creative mode.

when i delete the group config and restrict each individual refinary, there are no issues and everything works fine again. i hope you will have a fix for it. thanks in advanced
Blackwater Canyon Jul 20 @ 1:34pm 
Are there any in-game commands that let players know things about their own grid limits?
Atomhirsch Jul 13 @ 5:35pm 
Good mod, thanks!
Warton May 30 @ 5:05pm 
Is there a way when we set "AllowedForPlayer" to "False" to keep the blocks in the game (from wrecks, ships, etc.) so when the blocks are "hacked" they will not be deleted from the game ?
So far, when I use AllowedForPlayer to False, my character is not able to find the block in the G menu and not able to place it, but also not able to take over the same block - if I don't grind it down to hack it - it is ok, but when I do the game delete it.
Any ideas?
SHADOWTHX May 26 @ 12:22am 
every time i add this to a dedi server and try to join the server i get an error and cant join ideas?
Kill3rCat [1st FORECON] Mar 23 @ 6:36pm 
As @Stratigus said, would be great to have the option to delist a block from the G menu but disable the deletion of blocks. I presume this mod is not going to be updated again, however?