Skip to content

Draconic Playermodel Registry

Vuthakral edited this page Apr 21, 2023 · 4 revisions

About

The Draconic Playermodel Registry is a few functions which are used to register extensions natively with playermodels, as a system for playermodel authors to create native compatibility with other developers' addons. Below you will find two sections. One which describes a native Draconic Base setup, and the other which can be used if you want to optionally define support for this; should players happen to also have the Draconic Base installed.

Native Setup

local MyNewPlayermodel = {
	["Model"] = "path/to/model/mdl",
	["Hands"] = "",
	["Background"] = "path/to/vmt",
	["Podium"] = {"path/to/model.mdl", Vector(0,0,0)},
	["DefaultCam"] = {
		["Pos"] = Vector(80.69, 36.7, 52.02),
		["Ang"] = Angle(10.278, 203.334, 0),
	},
	["VoiceSet"] = "",
	["Extensions"] = { 
		["Claws"] = false,
	}
}
DRC:RegisterPlayerModel(MyNewPlayermodel)

To explain each thing here, the "Model" and "Hands" values don't need much explanation.

  • The Background is the image that will be used for the playermodel preview in the Draconic menu. NOTE: The background image will always be displayed at a resolution of 590x666, so when making a background image you should crop it at this aspect ratio and then stretch/squish it to a 512x512 (or nearest similar resolution) canvas.
  • The Podium subtable is the 3D model which the playermodel preview will be standing upon in the Draconic menu, and the vector is an offset to correct any slight misplacements of the model.
  • DefaultCam is the default pos/ang that the camera will be set to when the model is selected/swapped to in the menu.
  • VoiceSet -- See this page. The VoiceSet tied to the playermodel you are adding, use the VoiceSet's ID value. Will only work if the player has "automatic voicesets" enabled.
  • Extensions -- This is used to mark base values for addon compatibility with other addons. Claws is a default included with the Draconic Base, and is utilized by the built-in "Unarmed" SWEP with the base.

Optional Setup / Marking existing playermodels.

DRC:RegisterPlayerExtension("zombie", "Extensions", "Claws", true)

This is example lua pulled from the Draconic Base itself. It shows how you can update or create new extension markers tied to specific playermodels. This one, for instance, marks the default HL2 zombie playermodel as having claws.

How do I pull Registry Values for use in my content?

DRC:GetPlayerModelValue(name, val, subval)
  • name is the registered name of the playermodel. For example, the HL2 zombie's is just zombie.
  • val is the value you want to target to return. Natively valid examples include VoiceSet, Podium, and Extensions
  • subval is exclusively for pulling Extensions, i.e. from reading higher up examples you can see the value Claws set to true for the HL2 zombie. Calling DRC:GetPlayerModelValue("zombie", "Extensions", "Claws") will return true.
Clone this wiki locally