ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

Sbox模组开发_cli-anything-sbox

2026/8/7 12:45:16 拓冰建站 浏览量
Sbox模组开发_cli-anything-sbox 以下为本文档的中文说明CLI Anything sbox 是 HKUDS 开发的一项面向 sbox 游戏引擎Facepunch Studios 出品基于 Source 2 引擎的原生命令行工具技能。该技能提供了超过 79 条命令分布在 14 个功能组中能够直接操作项目中的 .scene场景文件、.prefab预制体文件、.vmat材质文件、.sound声音文件、Input.config输入配置、Collision.config碰撞配置等 JSON 格式文件也能生成符合 C# 语言习惯的游戏组件代码并在项目上运行实时的资源图查询。该技能的工作方式非常独特——大部分命令直接在项目的 JSON 文件上操作无需启动 sbox 编辑器本身即可完成配置修改这大大提升了模组开发的工作效率。该技能适用于 sbox 游戏模组开发的全流程包括项目管理、场景和预制体编辑、材质与声音配置、本地化设置、C# 代码生成、资源依赖关系查询、项目验证以及一键启动编辑器。其核心特点包括丰富的命令覆盖游戏开发的各个方面、基于 Python 实现易于安装部署、以及不依赖编辑器即可完成大量配置工作的离线操作能力。sbox CLIAgent-native CLI for the sbox game engine (Facepunch Studios, Source 2). 79 commands across 14 groups. Manipulate.scene,.prefab,.vmat,.sound,Input.config,Collision.configJSON files directly, generate idiomatic C# components, and run a real-time asset graph over the project.Installationpipinstallgithttps://github.com/HKUDS/CLI-Anything.git#subdirectorysbox/agent-harnessRequirementsPython 3.10sbox installed via Steam - auto-detected, or setSBOX_PATHto a custom installation directory.Most commands work entirely on the project’s JSON files - sbox does not need to be running.Global Options--json Machine-readable JSON output (always pass for agent use) --project PATH Project directory (auto-detects from cwd .sbproj if omitted)Command Groupsproject - Manage sbox projectscli-anything-sbox project new--nameMyGame --output-dir ./MyGame cli-anything-sbox--jsonproject info cli-anything-sbox project config --max-players32--tick-rate64cli-anything-sbox--json--project./MyGame project add-package facepunch.libsdf cli-anything-sbox--json--project./MyGame project remove-package facepunch.libsdf# Lint: broken asset refs, duplicate GUIDs, malformed Input.configcli-anything-sbox--json--project./MyGame project validate cli-anything-sbox--project./MyGame project validate --no-inputs --no-guidsscene - Manipulate.scenefilescli-anything-sbox scene new--namegameplay-o./Assets/scenes/gameplay.scene cli-anything-sbox--jsonscene info ./scene.scene cli-anything-sbox--jsonscene list ./scene.scene cli-anything-sbox scene add-object ./scene.scene Enemy--position100,0,0--componentsmodel,box_collider,rigidbody--tagsenemycli-anything-sbox scene remove-object ./scene.scene--nameEnemy cli-anything-sbox scene add-component ./scene.sceneobject-guidSandbox.PointLight cli-anything-sbox scene remove-component ./scene.sceneobject-guid--component-type Sandbox.Rigidbody cli-anything-sbox--jsonscene modify-object ./scene.scene--guidguid--nameNewName--position200,0,0cli-anything-sbox--jsonscene clone-object ./scene.scene--nameEnemy --new-name EnemyCopy--position300,0,0cli-anything-sbox--jsonscene get-object ./scene.scene--nameSun cli-anything-sbox scene set-property ./scene.scene --fixed-update-freq64--timescale0.5cli-anything-sbox scene set-navmesh ./scene.scene--enabled--agent-height72--agent-radius16cli-anything-sbox--jsonscene list-presets cli-anything-sbox--jsonscene modify-component ./scene.sceneobject-guidcomponent-guid--properties{Damage:50}# Find objects matching one or more filters (AND-combined)cli-anything-sbox--jsonscene query ./scene.scene --has-component rigidbody --has-tag tower cli-anything-sbox--jsonscene query ./scene.scene --name-regex^Tower\\d$--in-bounds0,-500,-50,1000,500,50# Extract every asset reference (.vmdl, .vmat, .vsnd, .vtex, .vpcf, .prefab) from a scenecli-anything-sbox--jsonscene refs ./scene.scene# Apply the same modification to every object that matches a querycli-anything-sbox--jsonscene bulk-modify ./scene.scene --has-tag tower--position0,0,100--enable# Structural diff between two scenes (added/removed/modified GameObjects SceneProperties)cli-anything-sbox--jsonscenediff./old.scene ./new.scene# Insert a prefab as a GameObject in a scenecli-anything-sbox--jsonscene instantiate-prefab ./level.scene ./Assets/prefabs/bullet.prefab--position10,0,0prefab - Manage.prefabfilescli-anything-sbox prefab new--nameBullet-o./Assets/prefabs/bullet.prefab--componentsmodel,sphere_collider,rigidbodycli-anything-sbox--jsonprefab info ./Assets/prefabs/bullet.prefab cli-anything-sbox prefab from-scene ./scene.sceneobject-guid-o./Assets/prefabs/extracted.prefab cli-anything-sbox--jsonprefab add-component ./prefab.prefab rigidbody cli-anything-sbox prefab remove-component ./prefab.prefab --component-type Sandbox.Rigidb ody cli-anything-sbox--jsonprefab list# Asset references inside a prefabcli-anything-sbox--jsonprefab refs ./prefab.prefab# Modify component properties on a prefab (by component type or component GUID)cli-anything-sbox--jsonprefab modify-component ./prefab.prefab --component-type Sandbox.Rigidbody--properties{Gravity:false,MassOverride:50}# Structural diff between two prefabs (root named children)cli-anything-sbox--jsonprefabdiff./old.prefab ./new.prefabcodegen - Generate C# code# Plain Componentcli-anything-sbox codegen component--namePlayerController--methodsOnUpdate,OnFixedUpdate-o./Code/PlayerController.cs# Component with [Property] fieldscli-anything-sbox--jsoncodegen component--nameTower--properties[{name:Damage,type:float,default:25f},{name:Range,type:float,default:500f}]# Networked component (partial class) with RPC method stubscli-anything-sbox codegen component--nameNetPlayer--networked--methodsOnUpdate,OnFixedUpdate --rpc-methodsFire:Broadcast,TakeDamage:Host-o./Code/NetPlayer.cs# GameResourcecli-anything-sbox codegen gameresource--nameTowerData --display-nameTower Data--extensiontower-o./Code/TowerData.cs# Editor menu (Editor/ assembly)cli-anything-sbox codegen editor-menu--nameMyTools --menu-pathEditor/My Tools/Open-o./Editor/MyTools.cs# Plain Razor UI component (.razor .razor.scss)cli-anything-sbox codegen razor--nameHudPanel--properties[{name:Score,type:int,default:0}]-o./UI/HudPanel.razor# Static or base-derived classcli-anything-sbox codegen class--nameMath2--static-o./Code/Math2.cs# PanelComponent sibling ScreenPanel scaffold (handles the sbox quirk where# PanelComponent input only works when both are on the same GameObject).# Emits .razor .razor.scss a paste-ready GameObject snippet, or appends# directly to a scene with --scene.cli-anything-sbox--jsoncodegen panel-component--nameHudBar-o./UI/HudBar.razor cli-anything-sbox codegen panel-component--nameCrosshair-o./UI/Crosshair.razor--scene./Assets/scenes/game.sceneinput - ManageInput.configcli-anything-sbox--jsoninput list cli-anything-sbox inputadd--namePlaceTower--groupGameplay--keyboardmouse1--gamepadRightTrigger cli-anything-sbox input remove--namePlaceTower cli-anything-sbox inputset--nameAttack1--keyboardmouse1collision - ManageCollision.configcli-anything-sbox--jsoncollision list cli-anything-sbox collision add-layer--nameprojectile--defaultCollide cli-anything-sbox collision add-rule --layer-a projectile --layer-b solid--resultCollide cli-anything-sbox collision remove-rule --layer-a projectile --layer-b solid cli-anything-sbox collision remove-layer--nameprojectilematerial - Manage.vmatmaterialscli-anything-sbox--jsonmaterial new--namefloor--shadercomplex --color-texturetextures/floor.tga--metalness0.3-o./Assets/materials/floor.vmat cli-anything-sbox--jsonmaterial info ./Assets/materials/floor.vmat cli-anything-sbox--jsonmaterial list cli-anything-sbox--jsonmaterialset./Assets/materials/floor.vmat--metalness0.8sound - Manage.soundeventscli-anything-sbox--jsonsound new--namegunshot--soundssounds/gun1.vsnd,sounds/gun2.vsnd--volume0.8-o./Assets/sounds/gunshot.sound cli-anything-sbox--jsonsound info ./Assets/sounds/gunshot.sound cli-anything-sbox--jsonsound list cli-anything-sbox--jsonsoundset./Assets/sounds/gunshot.sound--volume0.5localization - Manage translationscli-anything-sbox localization new--langen-o./Localization/en.json cli-anything-sbox localizationset./Localization/en.json--keygame.title--valueMy Gamecli-anything-sbox--jsonlocalization list ./Localization/en.json cli-anything-sbox localization get ./Localization/en.json--keygame.titlecli-anything-sbox localization remove ./Localization/en.json--keygame.titlecli-anything-sbox localization bulk-se t ./Localization/en.json--keys{ui.start:Start,ui.quit:Quit}server - Dedicated servercli-anything-sbox server info cli-anything-sbox server start--gamemy_game--mapfacepunch.flatgrassasset - Asset management reverse lookupscli-anything-sbox--jsonasset list--typescene cli-anything-sbox--jsonasset info ./Assets/scenes/minimal.scene cli-anything-sbox asset compile ./Assets/materials/floor.vmat# Which scenes/prefabs reference this asset?cli-anything-sbox--json--project./MyGame asset find-refs models/myteam/widget.vmdl# Find unreferenced assets (per type, or across all referenceable types)cli-anything-sbox--json--project./MyGame asset find-unused cli-anything-sbox--json--project./MyGame asset find-unused--typemodel--typematerial# Rename an asset and update every scene/prefab reference (extension preserved if omitted)cli-anything-sbox--json--project./MyGame assetrenamemodels/team/widget.vmdl gizmo cli-anything-sbox--project./MyGame assetrenamemodels/team/widget.vmdl gizmo --dry-run# Move an asset across directories and update every referencecli-anything-sbox--json--project./MyGame asset move models/team/widget.vmdl models/shared/widget.vmdlsession - State managementcli-anything-sbox session status cli-anything-sbox session undo cli-anything-sbox session redotest - Automated map/scene generation harnesscli-anything-sboxtestsetup cli-anything-sbox--jsontestrunlaunch - Open project in sbox editorcli-anything-sbox launchComponent Presets29 short names usable with--componentsonscene add-object,prefab new, etc. Each maps to aSandbox.*component type.PresetComponent TypemodelSandbox.ModelRendererbox_colliderSandbox.BoxCollidersphere_colliderSandbox.SphereCollidercapsule_colliderSandbox.CapsuleColliderplane_colliderSandbox.PlaneCollidermodel_colliderSandbox.ModelColliderrigidbodySandbox.Rigidbodycharacter_controllerSandbox.CharacterControllerplayer_controllerSandbox.PlayerControllercameraSandbox.CameraComponentlight_directionalSandbox.DirectionalLightlight_pointSandbox.PointLightspot_lightSandbox.SpotLightambient_lightSandbox.AmbientLightsprite_rendererSandbox.SpriteRendererskinned_model_rendererSandbox.SkinnedModelRenderertext_rendererSandbox.TextRendererline_rendererSandbox.LineRendererdecal_rendererSandbox.DecalRenderertrail_rendererSandbox.TrailRendererparticle_effectSandbox.ParticleEffectsound_pointSandbox.SoundPointComponentnav_mesh_agentSandbox.NavMeshAgentscreen_panelSandbox.ScreenPanelworld_panelSandbox.WorldPanelfixed_jointSandbox.FixedJointhinge_jointSandbox.HingeJointspring_jointSandbox.SpringJointball_socket_jointSandbox.BallSocketJointscene list-presetsreturns the live preset registry as JSON.Agent Usage PatternPass--jsonfor every agent-driven invocation. Pipe throughjqto thread GUIDs and paths between commands:# Bootstrap a projectsbproj$(cli-anything-sbox--jsonproject new--nameMyGame --output-dir /tmp/MyGame|jq-r.sbproj)cd/tmp/MyGame# Add a tower with a specific component layout, capture its GUIDguid$(cli-anything-sbox--jsonscene add-object ./Assets/scenes/main.scene Tower\\--componentsmodel,box_collider,rigidbody--tagstower\\|jq-r.guid)# Generate the corresponding C# component, networkedcli-anything-sbox--jsoncodegen component--nameTower--networked\\--rpc-methodsFire:Host--properties[{name:Damage,type:float,default:25f}]\\-o./Code/Tower.cs# Bulk-tweak every tower in the scenecli-anything-sbox--jsonscene bulk-modify ./Assets/scenes/main.scene\\--has-tag tower--enable--position-y-add50# Validate before committingcli-anything-sbox--jsonproject validateREPL Modecli-anything-sboxwith no arguments enters an interactive REPL with a styled prompt:$ cli-anything-sbox cli-anything-sbox project info cli-anything-sbox scene list ./Assets/scenes/main.scene cli-anything-sbox codegen component --name Foo -o ./Code/Foo.cs cli-anything-sbox quitEnvironment VariablesVariableDescriptionDefaultSBOX_PATHsbox installation directoryAuto-detected from Steam library foldersCLI_ANYTHING_SKILL_REPOOverride the reporepl_skinreads SKILL.md fromHKUDS/CLI-Anything