summaryrefslogtreecommitdiffstats
path: root/System.c4g/DTAutoTreeChop.c
blob: 2e859af0cebbf225d4c5fba161de5d9afa46c58c (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
#strict 2
#appendto TREE

static TREE_AutoChop;

global func NoAutoTreeChop() { return !TREE_AutoChop; }

func Construction()
{
	if(!NoAutoTreeChop() && FindObject2(Find_AtPoint(), Find_OCF(OCF_Exclusive)))
	{
		return RemoveObject();
	}
	AddEffect("CheckStructure", this, 100, 10, this);
	return _inherited(...);
}

func FxCheckStructureTimer()
{
	if(IsStanding())
	{
		if(!(GetOCF() & OCF_Chop) && !NoAutoTreeChop())
		{
			ChopDown();
		}
	}
	else
	{
		return FX_Execute_Kill;
	}
}