Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HL2 player character switching system #377

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Blixibon
Copy link
Member

@Blixibon Blixibon commented Jan 27, 2025

This PR adds a new "protagonist" system for the HL2 player class and HL2 weapons. This system can be used to switch between preset player models, hand models, and player contexts at ease. These protagonist presets are mounted via a scripts/protagonist_manifest.txt file, which then mounts other files variously formatted like this:

	"BASE_hl2_c_arms"
	{
		"wpn_viewmodels_c"
		{
			"weapon_357"		"models/weapons/hl2_c/v_357.mdl"
			"weapon_ar2"		"models/weapons/hl2_c/v_irifle.mdl"
			"weapon_bugbait"	"models/weapons/hl2_c/v_bugbait.mdl"
			"weapon_crossbow"	"models/weapons/hl2_c/v_crossbow.mdl"
			"weapon_crowbar"	"models/weapons/hl2_c/v_crowbar.mdl"
			"weapon_frag"		"models/weapons/hl2_c/v_grenade.mdl"
			"weapon_physcannon"	"models/weapons/hl2_c/v_physcannon.mdl"
			"weapon_pistol"		"models/weapons/hl2_c/v_pistol.mdl"
			"weapon_rpg"		"models/weapons/hl2_c/v_rpg.mdl"
			"weapon_shotgun"	"models/weapons/hl2_c/v_shotgun.mdl"
			"weapon_slam"		"models/weapons/hl2_c/v_slam.mdl"
			"weapon_smg1"		"models/weapons/hl2_c/v_smg1.mdl"
			"weapon_stunstick"	"models/weapons/hl2_c/v_stunstick.mdl"
		}
	}
	
	//----------------------------------------------------------------------------

	"alyx"
	{
		"inherits_from"		"BASE_hl2_c_arms"
		"playermodel"		"models/alyx.mdl"
		"hands"			"models/weapons/hl2_c/c_arms_alyx.mdl"

		"response_contexts"	"classname:npc_alyx"
	}

	"barney"
	{
		"inherits_from"		"BASE_hl2_c_arms"
		"playermodel"		"models/barney.mdl"
		"hands"			"models/weapons/hl2_c/c_arms_police.mdl"

		"response_contexts"	"classname:npc_barney"
	}

The currently selected protagonist can be selected via a new ProtagonistName keyvalue and a new SetProtagonist input, as well as an equivalent function in VScript.

This PR also adds a new hand_rig weapon script keyvalue which can be used to distinguish between arms-ready viewmodels that were created using different rigs. There are currently only presets for default, css, and blender. Note that this is currently only used by the protagonist system.


PR Checklist

  • My PR follows all guidelines in the CONTRIBUTING.md file
  • My PR targets a develop branch OR targets another branch with a specific goal in mind

@Blixibon Blixibon force-pushed the mapbase/feature/protagonist-system branch 4 times, most recently from ed019c7 to f611793 Compare January 28, 2025 21:54
@TeamSpen210
Copy link

If the no_suit criteria is only used there, it might be better to use silent_suit or something since it's otherwise fully operational. It's out of scope for this PR and probably a lot of work, but I do wonder if it'd be good to change the suit to instead use response rules. I think you could do the damage diagnosis there with a bunch of rules, allowing complete customisation.

@Blixibon
Copy link
Member Author

If the no_suit criteria is only used there, it might be better to use silent_suit or something since it's otherwise fully operational. It's out of scope for this PR and probably a lot of work, but I do wonder if it'd be good to change the suit to instead use response rules. I think you could do the damage diagnosis there with a bunch of rules, allowing complete customisation.

I agree with making it silent_suit.

I've never considered making the suit use response rules instead. That would require putting the player on CAI_ExpresserHost<>, which I wouldn't be opposed to, but it would open a bunch of other questions and have implications for Mapbase mods which already use responsive players. I'll consider that another time.

@Blixibon Blixibon force-pushed the mapbase/feature/protagonist-system branch from f611793 to 416ccf0 Compare January 30, 2025 17:50
@Blixibon Blixibon force-pushed the mapbase/feature/protagonist-system branch from 416ccf0 to ee75608 Compare January 31, 2025 15:10
@Blixibon Blixibon marked this pull request as ready for review January 31, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants