ゲーム

Garry's Mod

Garry's Mod を valkyr に接続する方法: ブリッジをインストールして設定し、対応するイベントとアクションを確認します。

方式
Server side Lua addon
状態
未テストのサンプル
イベント
frame shot sound spawn
アクション
kick restrict ban

Status: untested example. Not run (no Garry's Mod server was available).

Scope

Server side Lua for the operator's own Garry's Mod server. The file lives in lua/autorun/server/, so it is never sent to or run on players' machines. It reads state the server already has and sends it to a valkyr-server the operator runs. Server operators must follow the game's rules for server operators.

What it does

  • every 50 ms: a frame per living human player (position, eye angles, on ground, jump key);
  • PlayerSpawn: spawn with the team;
  • EntityFireBullets plus ScalePlayerDamage in the same tick: a shot with target and bone (hit group to head, body or limb);
  • PlayerFootstep: sound with a 20 m radius;
  • batches to POST /v1/matches/{match_id}/events with HTTP(), polls GET /v1/actions and kicks for kick, restrict and ban; ends the match on shutdown.

Player ids are the 32 bit Steam account ids (ply:AccountID()), which fit exactly in Lua numbers. JSON is written by hand so ids and times stay integers.

Units: Source units are treated as inches (the Hammer convention): valkyr (x, y, z) = (X, Z, Y) * 0.0254, yaw = 90 - yaw, pitch = -pitch. Gamemodes with custom player scales should adjust the valkyr-server movement limits.

Install

Copy lua/autorun/server/valkyr.lua into garrysmod/lua/autorun/server/ (or into an addon with the same layout) and set the console variables in server.cfg:

TextText
valkyr_url "http://127.0.0.1:7420"valkyr_key "replace-with-an-ingest-key"valkyr_prefix "gmod-server1"

If HTTP requests to localhost are blocked by your server's HTTP allow list, add the valkyr-server address to it.

ゲーム名とプラットフォーム名は各所有者に帰属し、互換性の説明のためにのみ使用しています。valkyr はそれらと提携していません。

GitHub でこのページを編集