Mods / Trait Restrictions

Tags:
Addon Playermodel
Author:
Cheeki
Side:
Both
Created:
Sep 17th at 11:33 AM
Last modified:
4 days ago
Downloads:
4881
Recommended download (for Vintage Story 1.22.0-pre.1 - 1.22.7):
TraitRestrictionsV1.1.0.zip  1-click install

THIS MOD DOES NOTHING ON ITS OWN. IT REQUIRES A RACE MOD THAT IMPLEMENT THESE FEATURES.

 

Traits can restrict which items a character can use to attack or interact with or wear and can be used to override food items values and edibility.
For food overrides, you can specify Satiety, Health and the food category. These values are optional and will use the item's base value if omitted, provided it has any.
Items that are explicitly allowed as food will not be blocked if listed in DisallowedInteract. If a liquid (example: milk) is specified as disallowed, any containers with milk inside them will not let you drink it.

Items or wearables that are explicitly allowed will always be allowed even if disallowed, even by other traits. The order is Exclusive>Allowed>Disallowed. You can use this in combination with wildcards to disallow a lot of items at once but only allow one or two.
Items marked as exclusive will only be able to be used by classes that have those traits and disallowed for everyone else even if in AllowedItems. The wearable restriction system supports usage of: "type:all" "type:armor" "type:clothing "type:bag" to easily restrict one or both categories of wearables.

 

Sample trait and docs
All this acts as normal trait stuff, so they go in trait.json.
 
{
  "code": "exampletrait",
  "AllowedItems": ["game:spear-generic-iron"], // Allows usage of the iron spear even if it's later disallowed
  "DisallowedItems": ["game:spear-*"], // Blocks both attacking and throwing of all spears. Disallows both attack and interaction.
  "DisallowedAttack": ["game:blade-falx-copper-*" ], // Blocks attacking only
  "DisallowedInteract": ["game:bow-*", "game:bread-*" ], // Blocks use interaction only (includes eating the item). This makes the bow unusable and the bread inedible
  "DisallowedAsIngredient": ["game:fruit-cloudberry" ], // Blocks eating the item and eating any meal or pie that contain the item
  "ExclusiveItems": ["game:spear-generic-ornategold"], // Only classes that have this trait can use this item
  "AllowedWearables": ["game:armor-*-tailored-*"], // Allows wearing all variants and parts of the linen armor, even if later disallowed by wildcards
  "DisallowedWearables": ["type:armor", "game:clothes-nadiya-*"], // Blocks wearing all armors and the nadiya clothing. Available types: type:all, type:armor, type:clothing
  "ExclusiveWearables": ["game:armor-body-antique-forlorn-*"] // Makes forlorn hope armor exclusive to owners of this trait only
  "AllowedFood": {
    "game:fruit-*": { "Health": 2 }, // Overrides fruit to give health, leaves satiety and food category untouched
    "game:redmeat-raw-*": { "Satiety": 200, "FoodCategory": "Protein" }, // Makes raw meat edible
    "game:charcoal": {} // Makes charcoal edible, but gives no nutrition
  }
}

 

Used by:
Lupines
Animalica & Body tools and classes

Mod Version Mod IdentifierFor Game version Downloads Released Changelog Download 1-click mod install*
1.1.0 traitrestrictions
1.22.0-pre.1 - 1.22.7
859 4 days ago TraitRestrictionsV1.1.0.zip 1-click install

Bag type items are now checked if they are forbidden to be equipped. This falls under the wearable check. You can also use type:bag to restrict all bags.
Fixed seemingly random items being forbidden with no discernable cause
Fixed some interact issues with normally inedible foods made edible under AllowedFood

1.0.0 traitrestrictions
1.22.0-pre.1 - 1.22.7
4022 Sep 17th at 11:53 AM Empty TraitRestrictionsV1.0.0.zip 1-click install

Disclaimer

By downloading a mod you consent to our Terms of Use.

We tell you this specifically because we want to make sure you are aware that we cannot validate every mod, and you are responsible for any damages you might incur by installing or loading mods.

This prompt will not be shown to you again (for the current browser session) if you proceed.


11 Comments (oldest first | newest first) (threaded | flat)

Marcy9, Oct 2nd at 7:46 PM

Hi, i have an issue ive written this code(

Spoiler
{
    "code": "marcy9-draikin-energy",
    "type": "mixed",
    "DisallowedWearables": ["game:glider"],
    "attributes": {
      "maxhealthExtraPoints": 5,
      "miningSpeedMul": 0.15,
      "sprintSpeed": -0.1,
      "armorWalkSpeedAffectedness": -0.5
    }
  }

) for my mod and it registers because it shows the "you cannot wear this" message but i can wear and use the glider anyway.

Craditz, Sep 23rd at 7:55 AM

Thank you so much for this! Getting a similar system jerry-rigged has been a task and a half, and your mod turned all that effort into an easy, simple system that works without 70 revisions. This will save me many, many more weeks I would’ve spent fixing every little thing!

 

Also, Animalica Core, and my Body tools mod uses this now!

Daisha_Malik, Sep 23rd at 4:43 AM

How would one go about making this mod work with mods other than Lupines?

Cheeki , Sep 23rd at 11:23 AM
@Daisha_Malik: How would one go about making this mod work with mods other than Lupines?

It's extra stuff you can put in a race's traits. Same as other things that PML exposes, if in doubt you can check how Lupines does it.

Dexapnow, Sep 21st at 3:02 PM

Awesome mod, I would recommend it to everyone, even if it doesn't do anything for you there is no harm in having it.