Fixed the ID for script created triggers were not being added to the track_object instance

This commit is contained in:
Sachith Hasaranga Seneviratne 2014-08-13 11:57:49 +05:30
parent 8aa4e998f2
commit b2a563c746
5 changed files with 12 additions and 6 deletions

View File

@ -4,8 +4,10 @@ void onStart()
Vec3 creationloc = Vec3(69.97 ,8.08 ,-107.84);
Vec3 creationloc2 = Vec3(100.72, 10.20,-26.22);
createTrigger("haybail_deactivate", creationloc, 20.00);
createTrigger("haybail",creationloc2 , 30.00);
createTrigger("haybail_deactivate", creationloc, 20.00);
createTrigger("haybail_activate",creationloc2 , 30.00);
//disableTrigger("haybail_deactivate");
//disableTrigger("haybail_activate");
TrackObject @t_obj = getTrackObject("cow");
SoundEmitter @cowmoo = t_obj.getSoundEmitter();

View File

@ -1,8 +1,8 @@
void haybail()
void haybail_activate()
{
/*to activate this add the following line to stk-assets/farm/scene.xml
/*to activate this you may also add the following line to stk-assets/farm/scene.xml (instead of creating it via the start script
<object type="action-trigger" action="haybail" distance="30.0" xyz="100.72 10.20 -26.22" hpr="0.0 -0.0 0.0" scale="7.00 7.00 7.00"/>
<object type="action-trigger" action="haybail_activate" distance="30.0" xyz="100.72 10.20 -26.22" hpr="0.0 -0.0 0.0" scale="7.00 7.00 7.00"/>
*/
displayMessage("Haybail deactivated");
@ -24,7 +24,7 @@ void haybail_deactivate()
{
/*to activate this add the following line to stk-assets/farm/scene.xml
<object type="action-trigger" action="haybail-activate" distance="10.0" xyz="69.97 8.08 -107.84" hpr="0.0 -0.0 0.0" scale="7.00 7.00 7.00"/>
<object type="action-trigger" action="haybail-deactivate" distance="10.0" xyz="69.97 8.08 -107.84" hpr="0.0 -0.0 0.0" scale="7.00 7.00 7.00"/>
*/
displayMessage("Haybail reactivated");

View File

@ -180,6 +180,7 @@ namespace Scripting
new TrackObjectPresentationActionTrigger(posi, *script_name, distance);
TrackObject* tobj = new TrackObject(posi, hpr, scale,
"none", newtrigger, false /* isDynamic */, NULL /* physics settings */);
tobj->setID(*script_name);
World::getWorld()->getTrack()->getTrackObjectManager()->insertObject(tobj);
}

View File

@ -109,6 +109,7 @@ public:
* e.g. be overwritten by physical objects etc. */
virtual void handleExplosion(const Vec3& pos, bool directHit) {};
void setEnable(bool mode);
void setID(std::string obj_id) { m_id = obj_id; }
const std::string& getLodGroup() const { return m_lod_group; }

View File

@ -353,6 +353,8 @@ public:
virtual void onTriggerItemApproached(Item* who) OVERRIDE;
virtual void reset() OVERRIDE { m_action_active = true; }
virtual void setEnable(bool status) OVERRIDE{ m_action_active = status; }
};