summaryrefslogtreecommitdiffstats
path: root/Script.c
blob: f60a7d82befc03cf3c489d8a529585e54b716fdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#strict 2

static ContextMenuEntry_Helper;
static const DT_EffectContext_Helper = CM7I;

global func AddContextMenuEntry(callback, condition, object target)
{
	ContextMenuEntry_Helper = ContextMenuEntry_Helper || CreateObject(CM7I);
	return AddEffect("IntCtxMenuEntry", target || this, 1, 0, ContextMenuEntry_Helper, 0, callback, condition);
}

global func RemoveContextMenuEntry(int id, object target)
{
	return RemoveEffect(0, target || this, id);
}

func FxIntCtxMenuEntryStart(object target, int effectNumber, int temp, callback, condition)
{
	if(!temp)
	{
		EffectVar(0, target, effectNumber) = callback;
		EffectVar(1, target, effectNumber) = condition;
	}
}

func FxIntCtxMenuEntryConditionContext(object target, int effectNumber, object menuObject, id image)
{
	return !EffectVar(1, target, effectNumber) || Call(EffectVar(1, target, effectNumber), [target, effectNumber, menuObject, image]);
}

func FxIntCtxMenuEntryContext(object target, int effectNumber, object menuObject, id image)
{
	[Dynamischer Eintrag|Condition=FxIntCtxMenuEntryConditionContext|Image=FLNT]
	return EffectVar(0, target, effectNumber) && target->Call(EffectVar(0, target, effectNumber), [target, effectNumber, menuObject, image]);
}