1 /// Some default stacks.
6 /// This global gets set to the verb in question each time the stack manager calls verb_call
11 /// Return the value of this verb. Return VS_CALL_REMOVE to delete it.
13 /// This verb is beeing removed NOW (not sent when verb_call returns VS_CALL_REMOVE)
17 .float(float message) verb_call;
19 /// Points to this verb's stack.
22 /// Static value of this verb
23 .float verb_static_value;
25 /// verb_call returns this when a verb in not doable
27 /// verb_call(VCM_DO) returns this when a verb is executing
28 #define VS_CALL_YES_DOING -1
29 /// verb_call(VCM_DO) returns this when a verb did execure and is done
30 #define VS_CALL_YES_DONE -2
31 /// verb_call(VCM_DO) returns this when a verb should be deleted by the stack manager
32 #define VS_CALL_REMOVE -3
35 Push a new verb onto the specified stack. Set vrb_life to make it time-limited.
37 entity verbstack_push(entity stack, float(float eval) vrb_call, float val_static, float vrb_life,entity verb_owner)
48 vrb.owner = verb_owner;
49 vrb.verbstack = stack;
50 vrb.verb_call = vrb_call;
51 vrb.verb_static_value = val_static;
55 vrb.think = SUB_Remove;
56 vrb.nextthink = time + vrb_life;
63 Find the best verb in this stack and execurte it.
64 ALso remove any verbs returning VS_CALL_REMOVE on VCM_EVAL or VCM_DO
66 float verbstack_pop(entity stack)
68 entity vrb, bestverb, oldself;
69 float value, bestvalue;
73 vrb = findchainentity(verbstack,stack);
79 value = verb.verb_call(VCM_EVAL);
83 if(value == VS_CALL_REMOVE)
100 value = verb.verb_call(VCM_DO);
102 if(value == VS_CALL_REMOVE)
111 float verbstack_popfifo(entity stack)
117 verb = findentity(stack,verbstack,stack);
123 ret = verb.verb_call(VCM_DO);
125 if(ret == VS_CALL_REMOVE)
134 Find the best verb in this stack and return it.
135 ALso remove any verbs returning VS_CALL_REMOVE on VCM_EVAL.
137 entity verbstack_pull(entity stack)
140 entity bestverb, oldself;
141 float value, bestvalue;
145 vrb = findchainentity(verbstack,stack);
152 value = verb.verb_call(VCM_EVAL);
156 if(value == VS_CALL_REMOVE)
161 if(value > bestvalue)
174 entity verbstack_pullfifo(entity stack)
176 return findentity(stack,verbstack,stack);
180 Delete every verb on this stack, signaling them with VCM_REMOVE first.
182 void verbstack_flush(entity stack)
188 vrb = findchainentity(verbstack,stack);
195 verb.verb_call(VCM_REMOVE);