|
28 | 28 | #include "console/engineAPI.h" |
29 | 29 | #include "collision/boxConvex.h" |
30 | 30 | #include "console/script.h" |
| 31 | +#include "console/consoleInternal.h" |
31 | 32 |
|
32 | 33 | #include "core/stream/bitStream.h" |
33 | 34 | #include "math/mathIO.h" |
@@ -172,8 +173,9 @@ Trigger::Trigger() |
172 | 173 |
|
173 | 174 | mPhysicsRep = NULL; |
174 | 175 | mTripOnce = false; |
| 176 | + mTripped = false; |
175 | 177 | mTrippedBy = 0xFFFFFFFF; |
176 | | - mTripIf = ""; |
| 178 | + mTripIf.clear(); |
177 | 179 |
|
178 | 180 | //Default up a basic square |
179 | 181 | Point3F vecs[3] = { Point3F(1.0, 0.0, 0.0), |
@@ -748,21 +750,11 @@ void Trigger::potentialEnterObject(GameBase* enter) |
748 | 750 | mObjects.push_back(enter); |
749 | 751 | deleteNotify(enter); |
750 | 752 |
|
751 | | - if(evalCmD(&mEnterCommand)) |
| 753 | + if(isServerObject() && evalCmD(&mEnterCommand)) |
752 | 754 | { |
753 | 755 | String command = String("%obj = ") + enter->getIdString() + ";"; |
754 | 756 | command = command + String("%this = ") + getIdString() + ";" + mEnterCommand; |
755 | | - |
756 | | - StringTableEntry objectName = getName(); |
757 | | - if (objectName != NULL) |
758 | | - objectName = getIdString(); |
759 | | - |
760 | | - StringTableEntry groupName = getGroup()->getName(); |
761 | | - if (groupName != NULL) |
762 | | - groupName = getGroup()->getIdString(); |
763 | | - |
764 | | - String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName); |
765 | | - Con::evaluate(command.c_str(), false, context); |
| 757 | + Con::evaluate(command.c_str(), false, Con::getCurrentScriptModulePath()); |
766 | 758 | } |
767 | 759 |
|
768 | 760 | if( mDataBlock && testTrippable() && testCondition()) |
@@ -807,29 +799,19 @@ void Trigger::processTick(const Move* move) |
807 | 799 | mObjects.erase(i); |
808 | 800 | clearNotify(remove); |
809 | 801 |
|
810 | | - if (evalCmD(&mLeaveCommand)) |
| 802 | + if (isServerObject() && evalCmD(&mLeaveCommand)) |
811 | 803 | { |
812 | 804 | String command = String("%obj = ") + remove->getIdString() + ";"; |
813 | 805 | command = command + String("%this = ") + getIdString() + ";" + mLeaveCommand; |
814 | | - |
815 | | - StringTableEntry objectName = getName(); |
816 | | - if (objectName != NULL) |
817 | | - objectName = getIdString(); |
818 | | - |
819 | | - StringTableEntry groupName = getGroup()->getName(); |
820 | | - if (groupName != NULL) |
821 | | - groupName = getGroup()->getIdString(); |
822 | | - |
823 | | - String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName); |
824 | | - Con::evaluate(command.c_str(), false, context); |
| 806 | + Con::evaluate(command.c_str(), false, Con::getCurrentScriptModulePath()); |
825 | 807 | } |
826 | 808 | if (testTrippable() && testCondition()) |
827 | 809 | mDataBlock->onLeaveTrigger_callback( this, remove ); |
828 | 810 | mTripped = true; |
829 | 811 | } |
830 | 812 | } |
831 | 813 |
|
832 | | - if (evalCmD(&mTickCommand)) |
| 814 | + if (isServerObject() && evalCmD(&mTickCommand)) |
833 | 815 | { |
834 | 816 | StringTableEntry objectName = getName(); |
835 | 817 | if (objectName != NULL) |
|
0 commit comments