Skip to content

Commit b35e9ea

Browse files
committed
add think function
1 parent 99c0c6b commit b35e9ea

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

api_custom_entities.sma

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,9 @@ bool:@Entity_IsCustom(this) {
588588
new Float:flGameTime = get_gametime();
589589

590590
new Trie:itPData = @Entity_GetPData(this);
591-
new iDeadFlag = pev(this, pev_deadflag);
591+
new iId = GetPDataMember(itPData, CE_MEMBER_ID);
592592

593+
new iDeadFlag = pev(this, pev_deadflag);
593594
switch (iDeadFlag) {
594595
case DEAD_NO: {
595596
new Float:flNextKill = GetPDataMember(itPData, CE_MEMBER_NEXTKILL);
@@ -607,6 +608,8 @@ bool:@Entity_IsCustom(this) {
607608
}
608609
}
609610
}
611+
612+
ExecuteHookFunction(CEFunction_Think, iId, this);
610613
}
611614

612615
@Entity_Touch(this, pToucher) {

include/api_custom_entities.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ enum CEFunction {
4141
CEFunction_KVD, // Calls when new key value obtained
4242
CEFunction_Activate, // Calls every trigger activation check
4343
CEFunction_Activated, // Calls when player activates trigger
44-
CEFunction_Init // Calls when entity is initialized (on first spawn)
44+
CEFunction_Init, // Calls when entity is initialized (on first spawn)
45+
CEFunction_Think // Calls when entity thinking
4546
};
4647

4748
/*

0 commit comments

Comments
 (0)