diff options
Diffstat (limited to 'Items.c4d/Sensors.c4d/LivingSensor.c4d')
| -rw-r--r-- | Items.c4d/Sensors.c4d/LivingSensor.c4d/DefCore.txt | 18 | ||||
| -rw-r--r-- | Items.c4d/Sensors.c4d/LivingSensor.c4d/Graphics.png | bin | 0 -> 3709 bytes | |||
| -rw-r--r-- | Items.c4d/Sensors.c4d/LivingSensor.c4d/Names.txt | 2 | ||||
| -rw-r--r-- | Items.c4d/Sensors.c4d/LivingSensor.c4d/Script.c | 112 | ||||
| -rw-r--r-- | Items.c4d/Sensors.c4d/LivingSensor.c4d/StringTblDE.txt | 7 | ||||
| -rw-r--r-- | Items.c4d/Sensors.c4d/LivingSensor.c4d/StringTblUS.txt | 7 |
6 files changed, 146 insertions, 0 deletions
diff --git a/Items.c4d/Sensors.c4d/LivingSensor.c4d/DefCore.txt b/Items.c4d/Sensors.c4d/LivingSensor.c4d/DefCore.txt new file mode 100644 index 0000000..21f6b36 --- /dev/null +++ b/Items.c4d/Sensors.c4d/LivingSensor.c4d/DefCore.txt @@ -0,0 +1,18 @@ +[DefCore]
+id=LV7I
+Name=Living sensor
+Category=C4D_Object|C4D_SelectMaterial|C4D_SelectKnowledge|C4D_SelectHomebase
+Width=10
+Height=6
+Offset=-5,-3
+Mass=10
+Value=5
+Components=METL=1;
+Picture=10,0,64,64
+Vertices=1
+VertexFriction=100
+Grab=2
+Collectible=1
+MaxUserSelect=10
+Rebuy=1
+NoPushEnter=1
diff --git a/Items.c4d/Sensors.c4d/LivingSensor.c4d/Graphics.png b/Items.c4d/Sensors.c4d/LivingSensor.c4d/Graphics.png Binary files differnew file mode 100644 index 0000000..74f2588 --- /dev/null +++ b/Items.c4d/Sensors.c4d/LivingSensor.c4d/Graphics.png diff --git a/Items.c4d/Sensors.c4d/LivingSensor.c4d/Names.txt b/Items.c4d/Sensors.c4d/LivingSensor.c4d/Names.txt new file mode 100644 index 0000000..b959d0d --- /dev/null +++ b/Items.c4d/Sensors.c4d/LivingSensor.c4d/Names.txt @@ -0,0 +1,2 @@ +DE:Lebewesensensor
+US:Living sensor
diff --git a/Items.c4d/Sensors.c4d/LivingSensor.c4d/Script.c b/Items.c4d/Sensors.c4d/LivingSensor.c4d/Script.c new file mode 100644 index 0000000..00ba923 --- /dev/null +++ b/Items.c4d/Sensors.c4d/LivingSensor.c4d/Script.c @@ -0,0 +1,112 @@ +#strict 2
+#include LS7I
+
+local range;
+static LV7I_MaxRange;
+local rangeTarget;
+
+func MaxRange()
+{
+ return LV7I_MaxRange || 200;
+}
+
+func SetMaxRange(int range)
+{
+ if(this)
+ {
+ DebugLog("WARNING: LV7I->SetMaxRange() sets the maximum available distance for all living sensors.");
+ DebugLog("Use this function in definition context only (this also disables this warning).");
+ }
+
+ LV7I_MaxRange = range;
+}
+
+func Init()
+{
+ range = 50;
+ return _inherited(...);
+}
+
+func Triggers() { return [["$AnimalTrigger$"], ["$NoAnimalTrigger$"], ["$AlliedTrigger$"], ["$NoAlliedTrigger$"], ["$HostileTrigger$"], ["$NoHostileTrigger$"]]; }
+
+func SetupMenuID() { return LV7I; }
+
+func Setup(object caller, int& menuIndex)
+{
+ selectCaller = caller;
+ AddMenuItem(Format("$Range$", range), "ChangeRange", GetID(), caller, 0, menuIndex++, 0, C4MN_Add_ForceNoDesc);
+ if(!GetEffect("IntShowRange", caller))
+ {
+ AddEffect("IntShowRange", caller, 1, 1, this);
+ rangeTarget = caller;
+ }
+ return true;
+}
+
+func ChangeRange(id id, int index, bool right)
+{
+ range = BoundBy(range - (right * 2 - 1), 1, MaxRange());
+ _Setup(selectCaller);
+ SelectMenuItem(index, selectCaller);
+}
+
+func FxIntShowRangeTimer(object target, int effectNumber)
+{
+ ClearParticles("PSpark", this);
+ if(Contained())
+ {
+ ClearParticles("PSpark", Contained());
+ }
+ if(!target || GetMenu(target) != SetupMenuID())
+ {
+ rangeTarget = 0;
+ return FX_Execute_Kill;
+ }
+
+ var ret = 0;
+ var step = BoundBy(500 * MaxRange() / range, 500, 2000);
+ var size = 30; //BoundBy((range * 3) / 5, 20, 60);
+ for(var r = 0; r < 36000 - step + 1; r += step)
+ {
+ ret += CreateParticle("PSpark", Cos(r, range, 100), Sin(r, range, 100), 0, 0, size, GetPlrColorDw(GetOwner()), Contained() || this);
+ }
+}
+
+func AnimalCondition()
+{
+ return Find_Or(Find_Category(4096), Find_Func("IsAnimal")); // C4D_SelectAnimal is 4096 but is not available as constant
+}
+
+func Check(bool retrigger)
+{
+ if(!rangeTarget)
+ {
+ ClearParticles("PSpark", this);
+ }
+ for(var mode in [[0, Find_Or(AnimalCondition(), Find_Owner(NO_OWNER)), RGB(255, 255, 0)], [1, Find_And(Find_Not(Find_Hostile(GetOwner())), Find_Not(AnimalCondition())), RGB(0, 192, 0)], [2, Find_And(Find_Hostile(GetOwner()), Find_Not(AnimalCondition())), RGB(192, 0, 0)]])
+ {
+ var living = FindObject2(Find_Distance(range), Find_OCF(OCF_Alive), mode[1], Sort_Random());
+ TestAndTrigger(mode[0], living, living, mode[2], retrigger);
+ }
+}
+
+func TestAndTrigger(int type, bool present, object obj, int color, bool retrigger)
+{
+ present = !!present;
+ if(present)
+ {
+ CreateParticle("PSpark", (type - 1) * 5, 1, 0, 0, 50, color, this);
+ }
+ if((!!(triggered & (1 << type))) != present || retrigger)
+ {
+ if(present)
+ {
+ triggered |= (1 << type);
+ }
+ else
+ {
+ triggered &= ~(1 << type);
+ }
+ return Trigger(2 * type + !present, obj);
+ }
+}
diff --git a/Items.c4d/Sensors.c4d/LivingSensor.c4d/StringTblDE.txt b/Items.c4d/Sensors.c4d/LivingSensor.c4d/StringTblDE.txt new file mode 100644 index 0000000..4b36fb6 --- /dev/null +++ b/Items.c4d/Sensors.c4d/LivingSensor.c4d/StringTblDE.txt @@ -0,0 +1,7 @@ +AnimalTrigger=Tier erkannt +NoAnimalTrigger=Tier entfernt +AlliedTrigger=Verbündeter erkannt +NoAlliedTrigger=Verbündeter entfernt +HostileTrigger=Feind erkannt +NoHostileTrigger=Feind entfernt +Range=Reichweite: %d Pixel diff --git a/Items.c4d/Sensors.c4d/LivingSensor.c4d/StringTblUS.txt b/Items.c4d/Sensors.c4d/LivingSensor.c4d/StringTblUS.txt new file mode 100644 index 0000000..110758b --- /dev/null +++ b/Items.c4d/Sensors.c4d/LivingSensor.c4d/StringTblUS.txt @@ -0,0 +1,7 @@ +AnimalTrigger=Animal detected +NoAnimalTrigger=Animal removed +AlliedTrigger=Allied detected +NoAlliedTrigger=Allied removed +HostileTrigger=Enemy detected +NoHostileTrigger=Enemy removed +Range=Range: %d pixels |
