Component Blocker removes entities and items completely from the game. This plugin is for server owners who want to restrict the availability of items or entities in the game world.
Features
- Remove any item or game object from the world
- Configurable messages and localization
- Ingredient refund on crafting of blocked item
- Block structure upgrades to any tier (configurable)
Notes
Entities include in-game prefabs such as rocks, trees, or buildings. These may be blocked using the entity asset resource path, qualified or unqualified. Note: Prefabs generated by procgen may not be removed, this includes large rocks, radtowns, mountains, sphere tank, etc.
Items are not entities, and only exist in containers, inventory, or (temporarily) on the ground (in a "bag"). For admins, the items will still appear in the console but may not be created until they are unblocked.
The block list is very permissive and checks a variety of properties to determine candidates for deletion. The blocking behavior does not differentiate between items and blueprints, they are both removed.
If you use Crafting Controller, disable "craftRefund" in ComponentBlocker.json and block items with both plugins or you well get double resources refunded.
Commands
blocker [term]-- Blocks item, entity, construction grade or asset path.blocklist-- Print everything currently in the block list.listinv [term]-- List itemMod specifications for all inventory items (or inventory items with itemMods with names that match the search terms)
Usage
The blocker chat command is a toggled list, meaning that using the same command again will remove the item from the list.
Adding an item by shortname to the block list:
blocker ammo.shotgun.slug
Removing block by running the exact same command:
blocker ammo.shotgun.slug
Alternatively, adding an item by full name:
blocker "12 Gauge Slug"
Please note the quotations, they are necessary for names that include spaces.
Adding an entity by resource path to block list:
blocker assets/bundled/prefabs/events/cargo_plane
Blocking structure tiers will prevent players from upgrading to any given tier
blocker structure.wood
blocker structure.stone
blocker structure.metal
blocker structure.armored
Blocking collectible (stone/wood/ore):
blocker autospawn/collectible/stone
Viewing everything currently on the block list:
blocklist
From server console:
blocker "ammo.shotgun.slug"
Permissive Blocking Behavior
When blocking an item by name where multiple items match said name, use the /listinv command to find more specific names depending on item skin or classification.
An example of an item that matches this criteria is "pants". Adding the default pants to your inventory and after using the /listinv command, you can identify the name to block this specific item name without blocking all items with "pants" in the name.
Hooks Used
The following hooks are affected by this mod:
- OnItemCraft
- OnEntitySpawned
- OnItemAddedToContainer
- OnItemDeployed
- OnPlantGather
- OnQuarryGather
- OnStructureUpgrade
Developer API
void AddBlock(string name)
void RemoveBlock(string name)
bool IsBlocking(string name)
API Example
ComponentBlocker.Call("AddBlock", "ammo.shotgun.slug");
ComponentBlocker.Call("RemoveBlock", "ammo.shotgun.slug");
if ((bool)ComponentBlocker.Call("IsBlocking", "ammo.shotgun.slug"))
{
// Do something
}
MIT License
Copyright (c) 2019 Calytic
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

