StrataSource / Portal-2-Community-Edition

Task tracker for Portal 2: Community Edition
https://www.portal2communityedition.com
146 stars 3 forks source link

Feature: Add Feature to Allow Dropping Specific Player Weapons on Demand. #1563

Open Pacca64 opened 8 months ago

Pacca64 commented 8 months ago

Which component should be improved?

Gameplay

Describe your suggestion

There are currently only two ways I know of to make a player drop a weapon; kill them in single player, or make them pass through a trigger_weapon_strip. The former is obviously restrictive, the latter simply dumps ALL the players weapons with no restriction. There are some Mapbase changes to CBaseCombatCharacter that add inputs for dropping specific weapons, but those changes don't appear to be in p2:ce yet. There is a command called "dropprimary" that seems to be intended to drop the currently active weapon, but I honestly don't think this command has ever worked in any released version of source. There is also an input alias that was added for the panorama input UI for dropping weapons, but as far as I can tell it's impossible to implement this under normal circumstances without code access.

Internally, there's a function in CBaseCombatCharacter (CBaseCombatCharacter.Weapon_Drop([weapon handle])) that is used internally when the player dies (to drop the active weapon) and when trigger_weapon_strip is activated (it goes through all held player weapons and drops them 1 by 1 with that function), so I imagine this particular feature would be pretty easy to implement.

As an example use case, I wanted to make a fizzler treat specific held weapons as "Unauthorized" and destroy them. Using a trigger_weapon_strip also forces the player to drop authorized weapons like the portal gun, and other means of directly removing weapons from the player are tricky and prone to glitches (for example, using env_entity_dissolver on a held weapon causes the viewmodel to stay stuck on it, causes the weapon world model to visibly dissolve at the players feet, and occasionally causes the dissolving sound effects to glitch; this is likely outside of the intended scope of the entity). The ability to drop only specific, map chosen weapons when entering the fizzler, and then letting the fizzler (or an env_entity_dissolver if the portal or paintguns should be considered unauthorized) dissolve them normally as physics objects would be much cleaner.

craftablescience commented 8 months ago

Weapon_Drop is exposed to the Panorama weapons api, although this change may not be released for everyone yet, I'm not sure (check the changelogs and @koerismo's panorama types repo for more info). Either way this function exists in Panorama and will likely exist in the new scripting stuff