Updated for scripting branch merge.

This commit is contained in:
MajorCooke 2016-02-04 22:41:02 -06:00
commit 35b7a5ccc1
11 changed files with 61 additions and 10 deletions

View file

@ -6360,6 +6360,35 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax)
return 0;
}
//===========================================================================
//
// A_SetChaseThreshold(int threshold, bool def, int ptr)
//
// Sets the current chase threshold of the actor (pointer). If def is true,
// changes the default threshold which the actor resets to once it switches
// targets and doesn't have the +QUICKTORETALIATE flag.
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetChaseThreshold)
{
PARAM_ACTION_PROLOGUE;
PARAM_INT(threshold);
PARAM_BOOL_OPT(def) { def = false; }
PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; }
AActor *mobj = COPY_AAPTR(self, ptr);
if (!mobj)
{
ACTION_SET_RESULT(false);
return 0;
}
if (def)
mobj->DefThreshold = (threshold >= 0) ? threshold : 0;
else
mobj->threshold = (threshold >= 0) ? threshold : 0;
return 0;
}
//==========================================================================
//
// A_CheckProximity(jump, classname, distance, count, flags, ptr)
@ -6687,4 +6716,4 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMovementDirection)
}
}
return numret;
}
}

View file

@ -651,4 +651,6 @@ void InitThingdef()
symt.AddSymbol(new PField(NAME_ReactionTime,TypeSInt32, VARF_Native, myoffsetof(AActor,reactiontime)));
symt.AddSymbol(new PField(NAME_MeleeRange, TypeFixed, VARF_Native, myoffsetof(AActor,meleerange)));
symt.AddSymbol(new PField(NAME_Speed, TypeFixed, VARF_Native, myoffsetof(AActor,Speed)));
symt.AddSymbol(new PField(NAME_Threshold, TypeFixed, VARF_Native, myoffsetof(AActor,threshold)));
symt.AddSymbol(new PField(NAME_DefThreshold,TypeFixed, VARF_Native, myoffsetof(AActor,DefThreshold)));
}

View file

@ -544,6 +544,17 @@ DEFINE_PROPERTY(painthreshold, I, Actor)
defaults->PainThreshold = id;
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(chasethreshold, I, Actor)
{
PROP_INT_PARM(id, 0);
if (id < 0)
I_Error("ChaseThreshold cannot be negative.");
defaults->DefThreshold = id;
}
//==========================================================================
//
//==========================================================================