Are you sure your data is up-to-date?
That being said, I'm not even sure why you are hooking this method instead of hooking the inputs your are looking for directly. Basically, an input is only a member method of an entity class. The AcceptInput method is an helper that read the datamap of the entity to retrieve the pointer of the input and then call it. When you are hooking that helper, you will not get called when someone is calling the input directly. For example, your hook will never gets called when a Source.Python plugin is calling an input because we are not passing by that extra layer and we call the input method directly. Anyways, hooking a specific input is quite easy since you can simply use Entity.get_input that returns a Function instance. Here is a basic example:
Syntax: Select all
from entities.constants import WORLD_ENTITY_INDEX
from entities.entity import Entity
from memory.hooks import PreHook
world_entity = Entity(WORLD_ENTITY_INDEX)
@PreHook(world_entity.get_input('Kill'))
def pre_input_kill(stack_data):
if stack_data[0] != world_entity.pointer:
return
print('Don\'t kill the world unless you want to crash... dumbass.')
return False
world_entity.remove()
Alternatively, you could also use EntityPreHook and benefit from the fact you don't have to get an instance first:
Syntax: Select all
from entities.constants import WORLD_ENTITY_INDEX
from entities.entity import Entity
from entities.hooks import EntityCondition
from entities.hooks import EntityPreHook
@EntityPreHook(EntityCondition.equals_entity_classname('worldspawn'),
lambda entity: entity.get_input('Kill'))
def pre_input_kill(stack_data):
if stack_data[0] != Entity(WORLD_ENTITY_INDEX).pointer:
return
print('Don\'t kill the world unless you want to crash... dumbass.')
return False
Entity(WORLD_ENTITY_INDEX).remove()