From 93ddddae60a39f32f33996190be62c700deeb010 Mon Sep 17 00:00:00 2001 From: Mittendrein Markus Date: Tue, 17 May 2016 14:10:25 +0200 Subject: Initial --- System.c4g/DTAutoTreeChop.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 System.c4g/DTAutoTreeChop.c (limited to 'System.c4g/DTAutoTreeChop.c') diff --git a/System.c4g/DTAutoTreeChop.c b/System.c4g/DTAutoTreeChop.c new file mode 100644 index 0000000..2e859af --- /dev/null +++ b/System.c4g/DTAutoTreeChop.c @@ -0,0 +1,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; + } +} -- cgit v1.2.3-54-g00ecf