Space Engineers

Space Engineers

120 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
309 Comments
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?
Psi Jan 25 @ 6:01pm 
@Stratigus
this mod prohibits you from having a block on your grid completely, it won't work for the scrapyard scenario.
for the scrapyard you can create a new component via definitions(but don't create craft recepie for it!) and then add this component to the base of all blocks you wish to ban from building and set it "grind to scrap"(like prototech is done)
i think you can hide mod from build menu via defenitions too, you don't need scripts for that
Alexis(Mssun21) Jan 19 @ 10:29am 
What is VerboseMode?
Stratigus Dec 25, 2024 @ 4:50pm 
Is there a way to remove the block from the build menu and still find them and have the abliity to use the ones u find?I setup a world and put everthing to false spawned in a rover and the batterys have diapered..Go into admin mode replace and as soon as i turn admin mode off the batterys disappear..trying to setup a scrap yard senerio but want to add more mods..have to not be able to build but able to find..
VelvetDiamond Dec 15, 2024 @ 2:23am 
Unless im an idiot, i dont see how to do this in the description?

I want a limit on a specific block, but i want the AI to be able to break over the limit of this block. So for example, i want players not to be able to build more than 4 of a specific weapon per grid but i want the AI ships to have 6 per grid. Is this doable?
jTurp  [author] Dec 13, 2024 @ 5:16am 
@VelvetDiamond

There is a whole config file with options for player / npc / grid / faction -> details in the description...
VelvetDiamond Dec 13, 2024 @ 12:51am 
is there away to limit blocks for players but not the AI?
MrFox Dec 8, 2024 @ 10:11pm 
correct
jTurp  [author] Nov 16, 2024 @ 5:34pm 
The mod log will print everything that is enabled and blocked during the world init, too, you can check that to see if it says it's blocked or not.
jTurp  [author] Nov 16, 2024 @ 5:33pm 
@MrFox

You are changing / saving that while the world is unloaded, then starting the server, correct?