remove python2.x support
[blender.git] / source / gameengine / GameLogic / SCA_AlwaysSensor.cpp
1 /**
2  * Always trigger
3  *
4  * $Id$
5  *
6  * ***** BEGIN GPL LICENSE BLOCK *****
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  *
22  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23  * All rights reserved.
24  *
25  * The Original Code is: all of this file.
26  *
27  * Contributor(s): none yet.
28  *
29  * ***** END GPL LICENSE BLOCK *****
30  */
31
32 #ifdef HAVE_CONFIG_H
33 #include <config.h>
34 #endif
35
36 #ifdef WIN32
37 // This warning tells us about truncation of __long__ stl-generated names.
38 // It can occasionally cause DevStudio to have internal compiler warnings.
39 #pragma warning( disable : 4786 )     
40 #endif
41
42 #include "SCA_AlwaysSensor.h"
43 #include "SCA_LogicManager.h"
44 #include "SCA_EventManager.h"
45
46 /* ------------------------------------------------------------------------- */
47 /* Native functions                                                          */
48 /* ------------------------------------------------------------------------- */
49
50 SCA_AlwaysSensor::SCA_AlwaysSensor(class SCA_EventManager* eventmgr,
51                                                                  SCA_IObject* gameobj)
52         : SCA_ISensor(gameobj,eventmgr)
53 {
54         //SetDrawColor(255,0,0);
55         Init();
56 }
57
58 void SCA_AlwaysSensor::Init()
59 {
60         m_alwaysresult = true;
61 }
62
63 SCA_AlwaysSensor::~SCA_AlwaysSensor()
64 {
65         /* intentionally empty */
66 }
67
68
69
70 CValue* SCA_AlwaysSensor::GetReplica()
71 {
72         CValue* replica = new SCA_AlwaysSensor(*this);//m_float,GetName());
73         // this will copy properties and so on...
74         replica->ProcessReplica();
75
76         return replica;
77 }
78
79
80
81 bool SCA_AlwaysSensor::IsPositiveTrigger()
82
83         return (m_invert ? false : true);
84 }
85
86
87
88 bool SCA_AlwaysSensor::Evaluate()
89 {
90         /* Nice! :) */
91                 //return true;
92         /* even nicer ;) */
93                 //return false;
94         
95         /* nicest ! */
96         bool result = m_alwaysresult;
97         m_alwaysresult = false;
98         return result;
99 }
100
101 /* ------------------------------------------------------------------------- */
102 /* Python functions                                                          */
103 /* ------------------------------------------------------------------------- */
104
105 /* Integration hooks ------------------------------------------------------- */
106 PyTypeObject SCA_AlwaysSensor::Type = {
107         PyVarObject_HEAD_INIT(NULL, 0)
108         "SCA_AlwaysSensor",
109         sizeof(PyObjectPlus_Proxy),
110         0,
111         py_base_dealloc,
112         0,
113         0,
114         0,
115         0,
116         py_base_repr,
117         0,0,0,0,0,0,0,0,0,
118         Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
119         0,0,0,0,0,0,0,
120         Methods,
121         0,
122         0,
123         &SCA_ISensor::Type,
124         0,0,0,0,0,0,
125         py_base_new
126 };
127
128 PyMethodDef SCA_AlwaysSensor::Methods[] = {
129         {NULL,NULL} //Sentinel
130 };
131
132 PyAttributeDef SCA_AlwaysSensor::Attributes[] = {
133         { NULL }        //Sentinel
134 };
135
136 /* eof */