Mods / FSM lib [OBSOLETE]

Draft
Set to published to be listed. A draft mod is still visible to everyone via direct link
Category: #Library
Author: Maltiez
Side: Both
Created: Oct 8th 2023 at 9:35 AM
Last modified: Apr 21st 2024 at 5:40 PM
Downloads: 64790
Follow Unfollow 319

Latest file for v1.19.4:
fsmlib_0.4.5.zip 1-click install


 

This mod is no longer maintained

Spoiler!

Requires: Animation Manager

For other modders: would be nice to collaborate on combat related mod. Would be nice to have somebody to test features, to animate player and items, may be even to write some code, or just do research part. 

Description:

Finite State Machine (FSM) implemented as CollectibleBehavior and used for creating complex item behaviour that player can interact with by hotkeys, keyboard and mouse keys (environmental inptus are planned as well).

This library provides .json API and can be used for content mods (no C# coding required). But it can also be easily extended with C# code mods without need in any patches by using its C# API. Documentation for both APIs are not ready and will come soon.

You can ask question and leave you suggestion on VS discord server under the mod's post in mods channel.

Examples from tutorials (or for future tutorials): FSM example (no more)

Features:

A short list of what you can do with the library. All the functionality is added by behavior, so it is not depended on class.

Behavior can:

  • play specific sounds with configurable volume and range
  • play player animations like "bowaim"
  • play transformation animations, where item can be progressively smoothly rotated, moved or scaled
  • play variants animation, where a range of variants is used as frames like in stop motion animation
  • perform melee attack using item's stats and with configurable animation
  • perform range attack where projectile can be taken from players inventory
  • store items and block in item (using its attributes), and provide them to other systems (like shooting one)
  • use durability of items in players inventory or just checking if there are required items
  • change items variant group like this from torch: "variantgroups": [{"code": "state", "states": ["unlit", "lit", "extinct"]}]
  • prevent swaying animation and let player point items to where camera is pointing to
  • change player stats
  • spawn particle effects
  • damage item or restore durability
  • do basic aiming providing accuracy values for shooting system that depend on how long player is aiming
  • give player specified item or block

All this can be triggered by:

  • hotkey press
  • key press or release
  • mouse key press or release
  • player attempting to change slot or drop item
  • player being underwater

Currently all this applies only to items in:

  • active hotbar slot
  • offhand slot
  • hotbar and inventory slots

Additional:

  • generation of control hints
  • generation of description entries
  • unification of hotkeys
  • hotkeys for not hotkey key events

All this funtionality will be expanded over time. If you need anything specific you can suggest it here and it will be implemented (sooner than later, but there can be some irl stuff preventing me from implementing features fast, like in hours and days).

And also: all this is just a interaction part. The huge part of the library is actual fullfledged FSM, that can allow you to configure complicated behaviors.

Required for:

Version For Game version Downloads Release date Changelog Download 1-click mod install*
v0.4.5 27896 Apr 21st 2024 at 5:40 PM Show fsmlib_0.4.5.zip Install now
v0.4.4 2028 Apr 9th 2024 at 6:19 AM Show fsmlib_0.4.4.zip Install now
v0.4.3 387 Apr 8th 2024 at 7:54 PM Show fsmlib_0.4.3.zip Install now
v0.4.2 657 Apr 6th 2024 at 10:04 AM Show fsmlib_0.4.2.zip Install now
v0.4.1 3234 Apr 1st 2024 at 7:32 AM Show fsmlib_0.4.1.zip Install now
v0.4.0 553 Mar 30th 2024 at 5:55 PM Show fsmlib_0.4.0.zip Install now
v0.4.0-dev.1 981 Mar 24th 2024 at 10:09 AM Show fsmlib_0.4.0-dev.1.zip Install now
v0.3.1 1009 Mar 18th 2024 at 6:00 AM Show fsmlib_0.3.1.zip Install now
v0.3.0 1545 Mar 6th 2024 at 8:22 AM Show fsmlib_0.3.0.zip Install now
v0.2.15 4743 Feb 27th 2024 at 6:27 AM Show fsmlib_0.2.15.zip Install now
v0.2.14 412 Feb 24th 2024 at 1:47 AM Show fsmlib_0.2.14.zip Install now
v0.2.13 122 Feb 23rd 2024 at 11:50 PM Show fsmlib_0.2.13.zip Install now
v0.2.12 708 Feb 23rd 2024 at 5:28 AM Show fsmlib_0.2.12.zip Install now
v0.2.11 449 Feb 19th 2024 at 11:55 AM Show fsmlib_0.2.11.zip Install now
v0.2.10 244 Feb 18th 2024 at 3:28 PM Show fsmlib_0.2.10.zip Install now
v0.2.9 1814 Feb 13th 2024 at 1:18 PM Show fsmlib_0.2.9.zip Install now
v0.2.8 749 Feb 10th 2024 at 7:45 PM Show fsmlib_0.2.8.zip Install now
v0.2.7 803 Feb 5th 2024 at 2:26 PM Show fsmlib_0.2.7.zip Install now
v0.2.6 150 Feb 5th 2024 at 8:52 AM Show fsmlib_0.2.6.zip Install now
v0.2.5 191 Feb 4th 2024 at 10:28 PM Show fsmlib_0.2.5.zip Install now
v0.2.3 381 Feb 4th 2024 at 12:26 PM Show fsmlib_0.2.3.zip Install now
v0.2.2-pre.5 279 Feb 4th 2024 at 9:00 AM Show fsmlib_0.2.2-pre.5.zip Install now
v0.2.2-pre.4 319 Feb 3rd 2024 at 7:24 AM Show fsmlib_0.2.2-pre.4.zip Install now
v0.2.2-pre.3 640 Jan 30th 2024 at 10:54 AM Show fsmlib_0.2.2-pre.3.zip Install now
v0.2.2-pre.2 427 Jan 28th 2024 at 12:37 PM Show fsmlib_0.2.2-pre.2.zip Install now
v0.2.2-pre.1 658 Jan 24th 2024 at 2:14 PM Show fsmlib_0.2.2-pre.1.zip Install now
v0.2.0 793 Jan 11th 2024 at 10:15 AM Show fsmlib_0.2.0.zip Install now
v0.1.13 3097 Dec 13th 2023 at 1:19 AM Show fsmlib_0.1.13.zip Install now
v0.1.12 173 Dec 13th 2023 at 1:03 AM Show fsmlib_0.1.12.zip Install now
v0.1.11 494 Dec 12th 2023 at 4:37 AM Show fsmlib_0.1.11.zip Install now
v0.1.10 3813 Nov 1st 2023 at 4:03 AM Show fsmlib_0.1.10.zip Install now
v0.1.9 585 Oct 29th 2023 at 4:53 AM Show fsmlib_0.1.9.zip Install now
v0.1.8 957 Oct 23rd 2023 at 9:29 PM Show fsmlib_0.1.8.zip Install now
v0.1.7 292 Oct 23rd 2023 at 4:51 AM Show fsmlib_0.1.7.zip Install now
v0.1.6 572 Oct 20th 2023 at 6:25 PM Show fsmlib_0.1.6.zip Install now
v0.1.5 468 Oct 18th 2023 at 7:39 AM Show fsmlib_0.1.5.zip Install now
v0.1.4 474 Oct 15th 2023 at 4:16 PM Show fsmlib_0.1.4.zip Install now
v0.1.3 547 Oct 12th 2023 at 8:10 PM Show fsmlib_0.1.3.zip Install now
v0.1.2 394 Oct 10th 2023 at 10:32 PM Show fsmlib_0.1.2.zip Install now
v0.1.1 223 Oct 10th 2023 at 4:44 PM Show fsmlib_0.1.1.zip Install now
v0.1.0 489 Oct 8th 2023 at 9:37 AM Show fsmlib_0.1.0.zip Install now

10 Comments (oldest first | newest first)

💬 MaltiezAuthor, Apr 2nd 2024 at 7:16 AM

LarekFlynn

Please send logs (client-main), better in official VS discord server

This error is caused by some other mod that modifies vanilla methods related to slots and does a bad job at it. For me to be able to fix it I need to know what mod causes it (you need to figure it out, by turning mods off and testing, or something), and also I need logs. Moddb is a bad place for all this stuff, so you will need to get to official VS discord server.

💬 LarekFlynn, Apr 2nd 2024 at 1:54 AM

Game kept going but my arms were stuck in crossbow animation even after switching to other items and it wouldnt fire or reload the empty looking crossbow.

1.4.2024 20:36:47.671 [VerboseDebug] [FSMlib] [Delayed] System 'ammo-bolt' crashed while processing in 'load' operation in 'maltiezcrossbows:crossbow-stirrup-plain' collectible.

Request:{
"code": "ammo-bolt",
"action": "take",
"requirement": "bolt"
}

Exception:
System.ArgumentException: Supplied slot is not part of this inventory (backpack-4LCXe0iZRXZimAMofvGIBNxg)!
at Vintagestory.API.Common.InventoryBase.DidModifyItemSlot(ItemSlot slot, ItemStack extractedStack) in C:\Users\Tyron\Documents\vintagestory\game\VintagestoryApi\Common\Inventory\InventoryBase.cs:line 480
at Vintagestory.API.Common.ItemSlot.OnItemSlotModified_Patch2(ItemSlot this, ItemStack sinkStack)
at Vintagestory.API.Common.ItemSlot.TryPutInto_Patch1(ItemSlot this, ItemSlot sinkSlot, ItemStackMoveOperation& op)
at Vintagestory.API.Common.ItemSlot.TryPutInto(IWorldAccessor world, ItemSlot sinkSlot, Int32 quantity) in C:\Users\Tyron\Documents\vintagestory\game\VintagestoryApi\Common\Inventory\ItemSlot.cs:line 176
at MaltiezFSM.Systems.AmmoSelector.Process(IPlayer player) in D:\Projects\VintageStory\fsmlib\fsmlib\source\Systems\Common\ToolMode.cs:line 114
at MaltiezFSM.Systems.Requirements.Take(ItemSlot slot, IPlayer player, List`1 requirements) in D:\Projects\VintageStory\fsmlib\fsmlib\source\Systems\Requirements.cs:line 309
at MaltiezFSM.Systems.Requirements.Process(ItemSlot slot, IPlayer player, JsonObject parameters) in D:\Projects\VintageStory\fsmlib\fsmlib\source\Systems\Requirements.cs:line 138
at MaltiezFSM.Operations.BaseOperation.Process(ItemSlot slot, IPlayer player, IEnumerable`1 systems) in D:\Projects\VintageStory\fsmlib\fsmlib\source\Operations\BaseOperation.cs:line 84

💬 MaltiezAuthor, Jan 16th 2024 at 2:20 PM

Yamato200

Check if you have installed versions of the mods for your version of the game, and there are no later versions installed

💬 MaltiezAuthor, Jan 16th 2024 at 2:19 PM
💬 Yamato200, Jan 16th 2024 at 9:45 AM

This and the required animation manager both don't work for me somehow. The Mod manager says "unable to resolve some mod dependencies. please check log files. I don't even know where these logs are.

💬 MaltiezAuthor, Dec 28th 2023 at 6:50 PM

EduardoPupucon

Because you play an unreleased version of the game meant for testing and many mods (including this one) is not updated to it.

💬 EduardoPupucon, Dec 28th 2023 at 6:35 PM

every time i press right mouse button to reload my arquebus i get a crash and this error:
i have all of the dependencies and firearms

[code]
28/12/2023 15:21:15: Critical error occurred in the following mod: fsmlib@0.1.13
Loaded Mods: butchering@1.1.0, Swordz@1.1.3, game@1.19.0-rc.4, animationmanagerlib@0.3.0, liquidcontainers@1.2.0, creative@1.19.0-rc.4, survival@1.19.0-rc.4, em@2.5.0-pre.1, fsmlib@0.1.13, maltiezfirearms@0.3.9, tailorsdelight@1.2.1
System.MissingFieldException: Field not found: 'Vintagestory.API.Common.Entities.Entity.AnimManager'.
at MaltiezFSM.Systems.NoSway.SetAimAnimationCrutch(Boolean interact)
at MaltiezFSM.Systems.ActionCallbackTimer.Start() in D:\Projects\Firearms\fsmlib\fsmlib\src\Systems\Other\NoSwaySystem.cs:line 74
at MaltiezFSM.Systems.NoSway.Process(ItemSlot slot, EntityAgent player, JsonObject parameters) in D:\Projects\Firearms\fsmlib\fsmlib\src\Systems\Other\NoSwaySystem.cs:line 31
at MaltiezFSM.Operations.Delayed.MaltiezFSM.API.IOperation.Perform(ItemSlot slot, EntityAgent player, IState state, IInput input) in D:\Projects\Firearms\fsmlib\fsmlib\src\Operations\DelayedOperation.cs:line 292
at MaltiezFSM.Framework.FiniteStateMachine.RunOperation(ItemSlot slot, EntityAgent player, IOperation operation, IInput input, State state) in D:\Projects\Firearms\fsmlib\fsmlib\src\Framework\FiniteStateMachine.cs:line 214
at MaltiezFSM.Framework.FiniteStateMachine.Process(ItemSlot slot, EntityAgent player, IInput input) in D:\Projects\Firearms\fsmlib\fsmlib\src\Framework\FiniteStateMachine.cs:line 155
[/code]

💬 beagan, Oct 22nd 2023 at 12:22 PM

thank you for the reply, sorry i should've noticed that haha

💬 MaltiezAuthor, Oct 22nd 2023 at 2:23 AM

beagan

this works for 1.18.8+, last update was a day ago, as you can see

💬 beagan, Oct 22nd 2023 at 2:18 AM

does this need to be updated or does it work in .15

(edit comment delete)