{"id":13690107,"url":"https://github.com/openface/onset-metaobjects","last_synced_at":"2025-05-02T06:31:53.570Z","repository":{"id":137292112,"uuid":"250909419","full_name":"openface/onset-metaobjects","owner":"openface","description":"Inventory system and rich object framework for Onset","archived":false,"fork":false,"pushed_at":"2020-04-04T03:04:51.000Z","size":1603,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-12T15:43:22.713Z","etag":null,"topics":["onset"],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openface.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-03-28T22:50:46.000Z","updated_at":"2020-10-31T19:46:58.000Z","dependencies_parsed_at":"2024-01-14T17:03:49.827Z","dependency_job_id":"79824eb5-abf9-45a7-86a7-df80e98dafab","html_url":"https://github.com/openface/onset-metaobjects","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openface%2Fonset-metaobjects","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openface%2Fonset-metaobjects/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openface%2Fonset-metaobjects/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openface%2Fonset-metaobjects/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openface","download_url":"https://codeload.github.com/openface/onset-metaobjects/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251998629,"owners_count":21678005,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["onset"],"created_at":"2024-08-02T16:00:43.824Z","updated_at":"2025-05-02T06:31:52.968Z","avatar_url":"https://github.com/openface.png","language":"Lua","funding_links":[],"categories":["Packages and Plugins"],"sub_categories":["Libraries"],"readme":"# MetaObjects - Inventory \u0026 rich object system for Onset\n\n## Features\n\nAll MetaObjects share these common functionalities:\n\n- **Pickups** - Objects can be picked up and stored in player's inventory.\n- **Inventory** - Stores finite number of items.  Objects can be used, equipped, or dropped.\n- **Equipable** - Objects can configurably be equipped/unequipped.\n- **Usable** - Objects can configurably be used/consumed a finite number of times.\n- **Extendable** - Object files can be extended using server-side events.\n\nNote: Hold the [I] key to bring up the inventory menu.\n\n## How To Use\n\nThe MetaObjects package is intended to work along with other packages.  To include it\nyour server, add it to the packages section in the server configuration file.  (Eg. `server_config.json`)\n\nImport it from a server-side script:\n\n```\nMetaObjects = ImportPackage(\"metaobjects\")\n```\n\n## Exported API Functions\n\nOnce this package is imported, you can use it's exported functions in your server-side scripts.\nMetaObjects are always referenced by their name.\n\n#### RegisterObject(name, meta)\nRegister a new metaobject by name and configuration.\n\n```\nMetaObjects.RegisterObject(\"mop\", {\n    interaction = {\n        animation = { name = \"WALLLEAN03\" }\n    },\n    modelid = 1673,\n    max_carry = 1,\n    attachment = { x = 50, y = 40, z = -114, rx = 0, ry = -40, rz = -30, bone = \"hand_r\" },\n    usable = false,\n    equipable = true\n})\n```\n\n### Pickups API\n\n| Function / Args                              |                                       |\n|----------------------------------------------|---------------------------------------|\n| `CreateObjectPickupNearPlayer(player, name)` | Spawn metaobject pickup near a player |\n| `CreateObjectPickup(name, x, y, z)`          | Spawn metaobject at given location    |\n\n\n### Inventory API\n\n| Function / Args                           |                                                          |\n|-------------------------------------------|----------------------------------------------------------|\n| `AddObjectToInventory(player, name)`      | Add a metaobject to a player's inventory                 |\n| `GetInventoryAvailableSlots(player)`      | Get number of available inventory slots for a player     |\n| `GetInventoryCount(player, name)`         | Get the count for a given objects in player's inventory  |\n| `UseObjectFromInventory(player, name)`    | Player uses a given metaobject.                          |\n| `EquipObjectFromInventory(player, name)`  | Player equips a given metaobject.                        |\n| `UnequipObject(player, name)`             | Player unequips a given metaobject, if equipped.         |\n| `DropObjectFromInventory(player, name)`   | Remove object from player inventory and place on ground. |\n| `DeleteObjectFromInventory(player, name)` | Remove object from player inventory and discard.         |\n\n## MetaObject Configuration\n\n#### modelid (int)\nModelID to use in-game and in inventory.  See full list [here](https://dev.playonset.com/wiki/Objects).\n\n#### max_carry (integer)\nMax number of these player can carry at once.\n\n#### attachment (table)\nHow to attach object to the player when equipped or used.  These parameters are similar to those in [SetObjectAttached](https://dev.playonset.com/wiki/SetObjectAttached).\n\n```\nattachment = { \n    x = -20, \n    y = 5, \n    z = 22, \n    rx = 82, \n    ry = 180, \n    rz = 10, \n    bone = \"hand_r\" \n},\n```\n\n#### usable (boolean)\nWhether or not this object can used directly from the inventory.\n\n#### max_use (integer)\nMax number of times this object can be used (if usable).  The object is discarded after this limit is exceeded.\n\n#### equipable (boolean)\nWhether or not this object can be equipped directly from the inventory. \n\n#### interaction (table)\nPlay animation and sounds when equipping or using an item.  See [AnimationList](https://dev.playonset.com/wiki/AnimationList).  Sounds are rendered in 3D from the player to all nearby clients within 1000 units.\n\n```\ninteraction = {\n    sound = \"sounds/chainsaw.wav\",\n    animation = { name = \"FISHING\", duration = 4000 }\n},\n```\n\nNote: Not all animations require a duration.  Animations are cancelled when the player\nunequips the object.\n\n## TODO\n\n- [ ] Auto-equip when picked up when configured\n- [ ] Unequip any equipped weapon when equipping an object\n- [ ] Add armor bonus to vest object\n- [ ] Consider ExtendObject, similar to RegisterObject, but allows overrides\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenface%2Fonset-metaobjects","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenface%2Fonset-metaobjects","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenface%2Fonset-metaobjects/lists"}