Possible fix for issue 369: Wrong kill animation after being hit by enemy on a sloped...
[supertux.git] / src / object / scripted_object.cpp
index 56a1fd5..e17de28 100644 (file)
@@ -47,7 +47,7 @@ ScriptedObject::ScriptedObject(const Reader& lisp) :
   lisp.get("solid", solid);
   lisp.get("physic-enabled", physic_enabled);
   lisp.get("visible", visible);
-  lisp.get("z-pos", layer);
+  layer = reader_get_layer (lisp, /* default = */ LAYER_OBJECTS);
   if( solid ){
     set_group( COLGROUP_MOVING_STATIC );
   } else {
@@ -59,14 +59,14 @@ void
 ScriptedObject::expose(HSQUIRRELVM vm, SQInteger table_idx)
 {
   if (name.empty()) return;
-  expose_object(vm, table_idx, dynamic_cast<Scripting::ScriptedObject *>(this), name, false);
+  expose_object(vm, table_idx, dynamic_cast<scripting::ScriptedObject *>(this), name, false);
 }
 
 void
 ScriptedObject::unexpose(HSQUIRRELVM vm, SQInteger table_idx)
 {
   if (name.empty()) return;
-  Scripting::unexpose_object(vm, table_idx, name);
+  scripting::unexpose_object(vm, table_idx, name);
 }
 
 void
@@ -143,6 +143,18 @@ ScriptedObject::is_solid()
   return solid;
 }
 
+bool
+ScriptedObject::gravity_enabled() const
+{
+       return physic.gravity_enabled();
+}
+
+void
+ScriptedObject::enable_gravity(bool f)
+{
+       physic.enable_gravity(f);
+}
+
 void
 ScriptedObject::set_action(const std::string& animation)
 {
@@ -207,6 +219,4 @@ ScriptedObject::collision(GameObject& , const CollisionHit& )
   return FORCE_MOVE;
 }
 
-IMPLEMENT_FACTORY(ScriptedObject, "scriptedobject");
-
 /* EOF */