Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

DeusEx.LogicTrigger


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
//=============================================================================
// LogicTrigger
//=============================================================================
class LogicTrigger expands Trigger;

// Allows boolean relationships between two different events
// To trigger - set the Event of whatever to match the Tag of this trigger
// For input 1 - set the Group of whatever to match inGroup1 of this trigger
// For input 2 - set the Group of whatever to match inGroup2 of this trigger

enum ELogicType
{
    GATE_AND,
    GATE_OR,
    GATE_XOR
};

var() name inGroup1, inGroup2;
var() ELogicType Op;
var() bool Not;
var() bool OneShot;
var bool in1, in2, out, outhit;

function Trigger(Actor Other, Pawn Instigator)
{
    local Actor A;

    if (Other.Group == inGroup1)
        in1 = !in1;
    if (Other.Group == inGroup2)
        in2 = !in2;

    switch(Op)
    {
        case GATE_AND:  out = in1 && in2;
                        break;
        case GATE_OR:   out = in1 || in2;
                        break;
        case GATE_XOR:  out = bool(int(in1) ^ int(in2));    // why isn't there a boolean XOR?
                        break;
    }

    if (Not)
        out = !out;

    // Trigger event on out==true
    if (out && !outhit)
    {
        if (OneShot)
            outhit = True;
        if(Event != '')
            foreach AllActors(class 'Actor', A, Event)
                A.Trigger(Self, Instigator);
    }

    Super.Trigger(Other, Instigator);
}

defaultproperties
{
     CollisionRadius=0.000000
     bCollideActors=False
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Mon 8/11/2021 16:22:52.000 - Creation time: Mon 8/11/2021 16:31:28.215 - Created with UnCodeX