Discussion:
[hlcoders] triggering an entity from a plugin
Tom Schumann
2016-10-03 01:25:24 UTC
Permalink
Is it possible to trigger an entity from plugin code? If there is, how is
it done? I'd look up how some Half-Life 2 game entity does it but I'm not
overly familiar with Half-Life 2's entity set to know which entity to look
at.
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
Sam Vanheer
2016-10-06 13:41:31 UTC
Permalink
I looked around a bit and found nothing that can be used to trigger
entities from plugins. The code for I/O is in the game libraries, but no
interfaces appear to be exported for use in server plugins.

If you're making a plugin for a specific mod and the authors are
willing, you can ask for new interfaces to be added to allow for it.
They'll need to allow access to g_EventQueue to enable triggering.


The only possible alternative i see is calling CBaseEntity::AcceptInput.
This is a virtual function, so it's callable.

You can get the CBaseEntity pointer through some of the interfaces, but
there is no guarantee that every mod has that function in the same place
in the class's vtable.

If you're willing to experiment and make mod-specific configs then this
may be your only other option. I suggest looking into SourceMod to find
out how to call this function, since they've probably got the code for
it already.
Post by Tom Schumann
Is it possible to trigger an entity from plugin code? If there is, how is
it done? I'd look up how some Half-Life 2 game entity does it but I'm not
overly familiar with Half-Life 2's entity set to know which entity to look
at.
_______________________________________________
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
Tom Schumann
2016-10-07 08:52:54 UTC
Permalink
Many thanks - I'll look into the AcceptInput method (there are no Linux
binaries for what I'm working on but hopefully I can find it in the vtable).
Post by Sam Vanheer
I looked around a bit and found nothing that can be used to trigger
entities from plugins. The code for I/O is in the game libraries, but no
interfaces appear to be exported for use in server plugins.
If you're making a plugin for a specific mod and the authors are
willing, you can ask for new interfaces to be added to allow for it.
They'll need to allow access to g_EventQueue to enable triggering.
The only possible alternative i see is calling CBaseEntity::AcceptInput.
This is a virtual function, so it's callable.
You can get the CBaseEntity pointer through some of the interfaces, but
there is no guarantee that every mod has that function in the same place
in the class's vtable.
If you're willing to experiment and make mod-specific configs then this
may be your only other option. I suggest looking into SourceMod to find
out how to call this function, since they've probably got the code for
it already.
Post by Tom Schumann
Is it possible to trigger an entity from plugin code? If there is, how is
it done? I'd look up how some Half-Life 2 game entity does it but I'm not
overly familiar with Half-Life 2's entity set to know which entity to
look
Post by Tom Schumann
at.
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
Tom Schumann
2016-10-07 11:29:08 UTC
Permalink
Okay I've had a quite look and I think I've figured out how it all works -
my next question is how do I find an entity with a given classname or id or
whatever? I've had a bit of a look through the server code but can't quite
figure it and I've looked where I thought it might be based on my knowledge
of GoldSource but still haven't found an equivalent
to pfnFindEntityByString.
Post by Tom Schumann
Many thanks - I'll look into the AcceptInput method (there are no Linux
binaries for what I'm working on but hopefully I can find it in the vtable).
Post by Sam Vanheer
I looked around a bit and found nothing that can be used to trigger
entities from plugins. The code for I/O is in the game libraries, but no
interfaces appear to be exported for use in server plugins.
If you're making a plugin for a specific mod and the authors are
willing, you can ask for new interfaces to be added to allow for it.
They'll need to allow access to g_EventQueue to enable triggering.
The only possible alternative i see is calling CBaseEntity::AcceptInput.
This is a virtual function, so it's callable.
You can get the CBaseEntity pointer through some of the interfaces, but
there is no guarantee that every mod has that function in the same place
in the class's vtable.
If you're willing to experiment and make mod-specific configs then this
may be your only other option. I suggest looking into SourceMod to find
out how to call this function, since they've probably got the code for
it already.
Post by Tom Schumann
Is it possible to trigger an entity from plugin code? If there is, how
is
Post by Tom Schumann
it done? I'd look up how some Half-Life 2 game entity does it but I'm
not
Post by Tom Schumann
overly familiar with Half-Life 2's entity set to know which entity to
look
Post by Tom Schumann
at.
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
Sam Vanheer
2016-10-07 16:31:20 UTC
Permalink
Server plugins get an interface that lets them enumerate entities, take
a look at the entityinfomanager global. It's in the server plugin
sample, located in src\utils\serverplugin_sample.

FindEntityByClassname is the function you'll probably want to use.
Post by Tom Schumann
Okay I've had a quite look and I think I've figured out how it all works -
my next question is how do I find an entity with a given classname or id or
whatever? I've had a bit of a look through the server code but can't quite
figure it and I've looked where I thought it might be based on my knowledge
of GoldSource but still haven't found an equivalent
to pfnFindEntityByString.
Post by Tom Schumann
Many thanks - I'll look into the AcceptInput method (there are no Linux
binaries for what I'm working on but hopefully I can find it in the vtable).
Post by Sam Vanheer
I looked around a bit and found nothing that can be used to trigger
entities from plugins. The code for I/O is in the game libraries, but no
interfaces appear to be exported for use in server plugins.
If you're making a plugin for a specific mod and the authors are
willing, you can ask for new interfaces to be added to allow for it.
They'll need to allow access to g_EventQueue to enable triggering.
The only possible alternative i see is calling CBaseEntity::AcceptInput.
This is a virtual function, so it's callable.
You can get the CBaseEntity pointer through some of the interfaces, but
there is no guarantee that every mod has that function in the same place
in the class's vtable.
If you're willing to experiment and make mod-specific configs then this
may be your only other option. I suggest looking into SourceMod to find
out how to call this function, since they've probably got the code for
it already.
Post by Tom Schumann
Is it possible to trigger an entity from plugin code? If there is, how
is
Post by Tom Schumann
it done? I'd look up how some Half-Life 2 game entity does it but I'm
not
Post by Tom Schumann
overly familiar with Half-Life 2's entity set to know which entity to
look
Post by Tom Schumann
at.
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
Tom Schumann
2016-10-07 20:41:39 UTC
Permalink
Ah thanks - very helpful. Just need to find where this is in the Orange Box
code now...
Post by Sam Vanheer
Server plugins get an interface that lets them enumerate entities, take
a look at the entityinfomanager global. It's in the server plugin
sample, located in src\utils\serverplugin_sample.
FindEntityByClassname is the function you'll probably want to use.
Post by Tom Schumann
Okay I've had a quite look and I think I've figured out how it all works
-
Post by Tom Schumann
my next question is how do I find an entity with a given classname or id
or
Post by Tom Schumann
whatever? I've had a bit of a look through the server code but can't
quite
Post by Tom Schumann
figure it and I've looked where I thought it might be based on my
knowledge
Post by Tom Schumann
of GoldSource but still haven't found an equivalent
to pfnFindEntityByString.
Post by Tom Schumann
Many thanks - I'll look into the AcceptInput method (there are no Linux
binaries for what I'm working on but hopefully I can find it in the
vtable).
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
I looked around a bit and found nothing that can be used to trigger
entities from plugins. The code for I/O is in the game libraries, but
no
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
interfaces appear to be exported for use in server plugins.
If you're making a plugin for a specific mod and the authors are
willing, you can ask for new interfaces to be added to allow for it.
They'll need to allow access to g_EventQueue to enable triggering.
The only possible alternative i see is calling
CBaseEntity::AcceptInput.
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
This is a virtual function, so it's callable.
You can get the CBaseEntity pointer through some of the interfaces, but
there is no guarantee that every mod has that function in the same
place
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
in the class's vtable.
If you're willing to experiment and make mod-specific configs then this
may be your only other option. I suggest looking into SourceMod to find
out how to call this function, since they've probably got the code for
it already.
Post by Tom Schumann
Is it possible to trigger an entity from plugin code? If there is, how
is
Post by Tom Schumann
it done? I'd look up how some Half-Life 2 game entity does it but I'm
not
Post by Tom Schumann
overly familiar with Half-Life 2's entity set to know which entity to
look
Post by Tom Schumann
at.
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
Tom Schumann
2016-10-07 21:23:11 UTC
Permalink
Hm, looks like this isn't exposed through the Orange Box code - it looks
like the FindEntityByX functions that I can find operate on some sort of
global entity list rather than through some exposed interface - is that
right?
Post by Tom Schumann
Ah thanks - very helpful. Just need to find where this is in the Orange
Box code now...
Post by Sam Vanheer
Server plugins get an interface that lets them enumerate entities, take
a look at the entityinfomanager global. It's in the server plugin
sample, located in src\utils\serverplugin_sample.
FindEntityByClassname is the function you'll probably want to use.
Post by Tom Schumann
Okay I've had a quite look and I think I've figured out how it all
works -
Post by Tom Schumann
my next question is how do I find an entity with a given classname or
id or
Post by Tom Schumann
whatever? I've had a bit of a look through the server code but can't
quite
Post by Tom Schumann
figure it and I've looked where I thought it might be based on my
knowledge
Post by Tom Schumann
of GoldSource but still haven't found an equivalent
to pfnFindEntityByString.
Post by Tom Schumann
Many thanks - I'll look into the AcceptInput method (there are no Linux
binaries for what I'm working on but hopefully I can find it in the
vtable).
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
I looked around a bit and found nothing that can be used to trigger
entities from plugins. The code for I/O is in the game libraries, but
no
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
interfaces appear to be exported for use in server plugins.
If you're making a plugin for a specific mod and the authors are
willing, you can ask for new interfaces to be added to allow for it.
They'll need to allow access to g_EventQueue to enable triggering.
The only possible alternative i see is calling
CBaseEntity::AcceptInput.
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
This is a virtual function, so it's callable.
You can get the CBaseEntity pointer through some of the interfaces,
but
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
there is no guarantee that every mod has that function in the same
place
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
in the class's vtable.
If you're willing to experiment and make mod-specific configs then
this
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
may be your only other option. I suggest looking into SourceMod to
find
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
out how to call this function, since they've probably got the code for
it already.
Post by Tom Schumann
Is it possible to trigger an entity from plugin code? If there is,
how
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
is
Post by Tom Schumann
it done? I'd look up how some Half-Life 2 game entity does it but I'm
not
Post by Tom Schumann
overly familiar with Half-Life 2's entity set to know which entity to
look
Post by Tom Schumann
at.
_______________________________________________
To unsubscribe, edit your list preferences, or view the list
archives,
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
Post by Tom Schumann
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
Sam Vanheer
2016-10-07 21:36:09 UTC
Permalink
That interface appears to be new with the 2013 version of the SDK.

You could try using the engine global's PEntityOfEntIndex to get each
entity and then manually convert to CBaseEntity using
edict_t::GetUnknown, and then calling GetBaseEntity.

You'll have to manually check the classname, which again is mod specific
based on class layout, but it's not impossible.
Post by Tom Schumann
Hm, looks like this isn't exposed through the Orange Box code - it looks
like the FindEntityByX functions that I can find operate on some sort of
global entity list rather than through some exposed interface - is that
right?
Post by Tom Schumann
Ah thanks - very helpful. Just need to find where this is in the Orange
Box code now...
Post by Sam Vanheer
Server plugins get an interface that lets them enumerate entities, take
a look at the entityinfomanager global. It's in the server plugin
sample, located in src\utils\serverplugin_sample.
FindEntityByClassname is the function you'll probably want to use.
Post by Tom Schumann
Okay I've had a quite look and I think I've figured out how it all
works -
Post by Tom Schumann
my next question is how do I find an entity with a given classname or
id or
Post by Tom Schumann
whatever? I've had a bit of a look through the server code but can't
quite
Post by Tom Schumann
figure it and I've looked where I thought it might be based on my
knowledge
Post by Tom Schumann
of GoldSource but still haven't found an equivalent
to pfnFindEntityByString.
Post by Tom Schumann
Many thanks - I'll look into the AcceptInput method (there are no Linux
binaries for what I'm working on but hopefully I can find it in the
vtable).
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
I looked around a bit and found nothing that can be used to trigger
entities from plugins. The code for I/O is in the game libraries, but
no
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
interfaces appear to be exported for use in server plugins.
If you're making a plugin for a specific mod and the authors are
willing, you can ask for new interfaces to be added to allow for it.
They'll need to allow access to g_EventQueue to enable triggering.
The only possible alternative i see is calling
CBaseEntity::AcceptInput.
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
This is a virtual function, so it's callable.
You can get the CBaseEntity pointer through some of the interfaces,
but
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
there is no guarantee that every mod has that function in the same
place
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
in the class's vtable.
If you're willing to experiment and make mod-specific configs then
this
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
may be your only other option. I suggest looking into SourceMod to
find
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
out how to call this function, since they've probably got the code for
it already.
Post by Tom Schumann
Is it possible to trigger an entity from plugin code? If there is,
how
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
is
Post by Tom Schumann
it done? I'd look up how some Half-Life 2 game entity does it but I'm
not
Post by Tom Schumann
overly familiar with Half-Life 2's entity set to know which entity to
look
Post by Tom Schumann
at.
_______________________________________________
To unsubscribe, edit your list preferences, or view the list
archives,
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
Post by Tom Schumann
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
Tom Schumann
2016-10-07 22:11:48 UTC
Permalink
Yeah okay, I was thinking that looping through each entity might end up
being the way to go. I guess class name isn't exposed though edict_t, and
it might be hard to find the entity id but I'm sure it's there somewhere.
Post by Sam Vanheer
That interface appears to be new with the 2013 version of the SDK.
You could try using the engine global's PEntityOfEntIndex to get each
entity and then manually convert to CBaseEntity using
edict_t::GetUnknown, and then calling GetBaseEntity.
You'll have to manually check the classname, which again is mod specific
based on class layout, but it's not impossible.
Post by Tom Schumann
Hm, looks like this isn't exposed through the Orange Box code - it looks
like the FindEntityByX functions that I can find operate on some sort of
global entity list rather than through some exposed interface - is that
right?
Post by Tom Schumann
Ah thanks - very helpful. Just need to find where this is in the Orange
Box code now...
Post by Sam Vanheer
Server plugins get an interface that lets them enumerate entities, take
a look at the entityinfomanager global. It's in the server plugin
sample, located in src\utils\serverplugin_sample.
FindEntityByClassname is the function you'll probably want to use.
Post by Tom Schumann
Okay I've had a quite look and I think I've figured out how it all
works -
Post by Tom Schumann
my next question is how do I find an entity with a given classname or
id or
Post by Tom Schumann
whatever? I've had a bit of a look through the server code but can't
quite
Post by Tom Schumann
figure it and I've looked where I thought it might be based on my
knowledge
Post by Tom Schumann
of GoldSource but still haven't found an equivalent
to pfnFindEntityByString.
Post by Tom Schumann
Many thanks - I'll look into the AcceptInput method (there are no
Linux
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
Post by Tom Schumann
Post by Tom Schumann
binaries for what I'm working on but hopefully I can find it in the
vtable).
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
I looked around a bit and found nothing that can be used to trigger
entities from plugins. The code for I/O is in the game libraries,
but
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
no
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
interfaces appear to be exported for use in server plugins.
If you're making a plugin for a specific mod and the authors are
willing, you can ask for new interfaces to be added to allow for it.
They'll need to allow access to g_EventQueue to enable triggering.
The only possible alternative i see is calling
CBaseEntity::AcceptInput.
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
This is a virtual function, so it's callable.
You can get the CBaseEntity pointer through some of the interfaces,
but
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
there is no guarantee that every mod has that function in the same
place
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
in the class's vtable.
If you're willing to experiment and make mod-specific configs then
this
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
may be your only other option. I suggest looking into SourceMod to
find
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
out how to call this function, since they've probably got the code
for
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
it already.
Post by Tom Schumann
Is it possible to trigger an entity from plugin code? If there is,
how
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
is
Post by Tom Schumann
it done? I'd look up how some Half-Life 2 game entity does it but
I'm
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
not
Post by Tom Schumann
overly familiar with Half-Life 2's entity set to know which entity
to
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
look
Post by Tom Schumann
at.
_______________________________________________
To unsubscribe, edit your list preferences, or view the list
archives,
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
Post by Tom Schumann
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list
archives,
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
Post by Tom Schumann
Post by Tom Schumann
Post by Sam Vanheer
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlcoders

Loading...