From e7585906ea0dbb003cba9fbdd5ad05bc1720fa8e Mon Sep 17 00:00:00 2001 From: Sachith Hasaranga Seneviratne Date: Tue, 5 Aug 2014 20:20:26 +0530 Subject: [PATCH] Added enable method specific to Physical Objects to allow previously disabled track objects to be renabled --- data/scripts/farm/triggers.as | 5 +++++ src/scriptengine/script_track.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/data/scripts/farm/triggers.as b/data/scripts/farm/triggers.as index 7465bacbe..001a157e3 100644 --- a/data/scripts/farm/triggers.as +++ b/data/scripts/farm/triggers.as @@ -29,6 +29,11 @@ void haybail_deactivate() */ displayMessage("Haybail reactivated"); //enable("hayBail.b3d"); + TrackObject @t_obj2 = getTrackObject("hayBail.b3d"); + //t_obj2.setEnable(false); + PhysicalObject @haybail = t_obj2.getPhysicalObject(); + haybail.enable(); + squashKart(0,35.0); //id of kart,time to squash TrackObject @t_obj = getTrackObject("hayBail.b3d"); Animator @haybailAnimator = t_obj.getAnimator(); diff --git a/src/scriptengine/script_track.cpp b/src/scriptengine/script_track.cpp index 5a3d776a1..65b4b9d73 100644 --- a/src/scriptengine/script_track.cpp +++ b/src/scriptengine/script_track.cpp @@ -65,6 +65,10 @@ namespace Scripting { ((PhysicalObject*)(memory))->removeBody(); } + void enable(void *memory) + { + ((PhysicalObject*)(memory))->addBody(); + } void setPaused(bool mode, void *memory) { ((ThreeDAnimation*)(memory))->setPaused(mode); @@ -217,6 +221,7 @@ namespace Scripting r = engine->RegisterObjectMethod("TrackObject", "PhysicalObject @getPhysicalObject()", asMETHOD(TrackObject, getPhysicalObjectForScript), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod("PhysicalObject", "bool isFlattener()", asMETHOD(PhysicalObject, isFlattenKartObject), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod("PhysicalObject", "void disable()", asFUNCTION(disable), asCALL_CDECL_OBJLAST); assert(r >= 0); + r = engine->RegisterObjectMethod("PhysicalObject", "void enable()", asFUNCTION(enable), asCALL_CDECL_OBJLAST); assert(r >= 0); //Mesh or Skeletal Animation