Skip to content

Conversation

@Balimbanana
Copy link
Contributor

  • Added CEntityFactoryDictionary signatures and functions to map new classnames to existing ones.
  • Added CBaseTrigger::IsTouching(CBaseEntity *) offset and function to make it easier to determine if a player is touching a trigger.

The new signatures and offsets have not be fully tested on Windows and HL2MP which will need to be tested/adjusted before merging.

- Added CEntityFactoryDictionary signatures and functions to map new classnames to existing ones.
- Added CBaseTrigger::IsTouching(CBaseEntity *) offset and function to make it easier to determine if a player is touching a trigger.

The new signatures and offsets have not be fully tested on Windows and HL2MP which will need to be tested/adjusted before merging.
@Balimbanana
Copy link
Contributor Author

Balimbanana commented Jul 2, 2025

As for testing, I used bm_c1a0b

ent_create trigger_coop targetname cooptrig spawnflags 1 model *6 OnPlayersIn "textin,Display,,0,-1" OnPlayersOut "textout,Display,,0,-1" PlayerValue 50 target tptarg UseHud 1
ent_create info_target targetname tptarg angles "0 90 0"
ent_create game_text spawnflags 1 x -1 y -1 message "PLAYERS IN" channel 1 targetname textin color "255 255 255" fadein 1 fadeout 1 holdtime 1
ent_create game_text spawnflags 1 x -1 y -1 message "PLAYERS OUT" channel 1 targetname textout color "255 255 255" fadein 1 fadeout 1 holdtime 1
ent_fire cooptrig TeleportPlayersNotTouching

Re-enabled `SetUserData` and `GetUserData` for CBaseEntity and made it so nothing is created or initialized unless accessed.
Through the SetUserData and GetUserData functionality, trigger_coop now has PlayerValue, CountType, and UseHud using the new properties.
@Alienmario
Copy link
Collaborator

LMK when it's ready, I'll test it and polish the edges. Or if you'd prefer a review instead that's fine too.

Might even add a .fgd

Tested Black Mesa Windows and the only signature I can't seem to get working is InstallFactory(). Tried HL2MP, but none of the several signatures I tried are working correctly so I haven't included them here.
@Balimbanana
Copy link
Contributor Author

Which ever you prefer. I haven't been able to get the signature for InstallFactory working on Windows yet, and HL2MP signatures I have tried aren't working correctly.

@Alienmario
Copy link
Collaborator

There's a GetEntityFactoryDictionary method in CServerTools and used CEntityFactoryDictionary's functions are virtual.

This means we should be able to forgo signatures entirely and use quite stable offsets.
I'll include this in my edits.

Copy link
Collaborator

@Alienmario Alienmario left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The outputs to game_text don't seem to be working at the moment, will have to check it later.

@Alienmario
Copy link
Collaborator

Currently I'm seeing 2 issues:

  • outputs are being spammed when player is inside, they should only fire on state change
  • hud text is being spammed when player is inside, it should be offloaded to a timer

Copy link
Collaborator

@Alienmario Alienmario left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to finish this one off.

@Alienmario Alienmario requested a review from ampreeT August 2, 2025 23:28
@Alienmario
Copy link
Collaborator

I think it's looking pretty good. See if you can find any shortcomings. The test case is also working now, had to return MRES_ChangedHandled in Hook_KeyValue.

Copy link
Owner

@ampreeT ampreeT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good except for a few issues while testing on Windows:

  • Max player count is off by 1
Discord_68bXKazllK
  • Checkpoint EDT does not work for OnAllPlayersIn (did not check other outputs)

bm_c1a0a edt:

"modify"
{
	"targetname"	"LCS_AM_Airlock_trigger"
	"classname"		"trigger_once"
	"set"
	{
		"classname"	"trigger_coop"
	}
	"outputs"
	{
		"modify"
		{
			"output"	"OnTrigger"
			"replace"
			{
				"output"	"OnAllPlayersIn"
			}
		}
		"add"
		{
			"output"	"OnAllPlayersIn"
			"target"	"!self"
			"input"		"Disable"
		}
	}
}
"door1"
{
	"origin"	"272 28 520"
	"angles"	"0.0 90.0 0.0"
	"delay"		"0.35"
	"triggerid"	"LCS_AM_Airlock_trigger"
	"output"	"OnAllPlayersIn"
	"bringall"	"1"
}

@Alienmario
Copy link
Collaborator

Max player count is off by 1

That's probably correct. Assuming you spawned with PlayerValue 50 - that's 50% of all alive players -> 3 * 0.5 = 2 after rounding.

Checkpoint EDT does not work for OnAllPlayersIn (did not check other outputs)

Looks like output hooks won't work unless we can support adding new datamaps, on which I'm doubtful.
Will just have to remap the output types for checkpoints.

@Alienmario Alienmario requested a review from ampreeT August 3, 2025 20:42
@Alienmario
Copy link
Collaborator

In the interim I've added support for remapped outputs in checkpoints.

If we ever want to support custom entities properly, including datamaps, making a fork of this extension ought to be the sanest way.

Copy link
Owner

@ampreeT ampreeT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@Alienmario Alienmario merged commit 7fff1c2 into ampreeT:master Aug 4, 2025
2 checks passed
@Alienmario
Copy link
Collaborator

Thanks for starting this, @Balimbanana!

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.

3 participants