unlockables basics
[carveJwlIkooP6JGAAIwe30JlM.git] / world_gate.c
index a4cf8fdc703e8b21ae976918e924bbb5206fb671..0a645518770484ce6ace789cc59bbdb6cfe9d5f7 100644 (file)
@@ -265,6 +265,7 @@ VG_STATIC ent_gate *world_intersect_gates( world_instance *world,
       ent_gate *gate = mdl_arritm( &world->ent_gate, i );
 
       if( !(gate->flags & k_ent_gate_linked) ) continue;
+      if( gate->flags & k_ent_gate_locked ) continue;
 
       if( gate->flags & k_ent_gate_nonlocal ){
          if( world_loader.state != k_world_loader_none ){
@@ -367,4 +368,17 @@ matched:;
    }
 }
 
+VG_STATIC void ent_gate_call( world_instance *world, ent_call *call ){
+   u32 index = mdl_entity_id_id( call->id );
+   ent_gate *gate = mdl_arritm( &world->ent_gate, index );
+
+   if( call->function == 0 ){ /* unlock() */
+      gate->flags &= ~k_ent_gate_locked;
+   }
+   else {
+      vg_print_backtrace();
+      vg_error( "Unhandled function id: %u\n", call->function );
+   }
+}
+
 #endif /* WORLD_GATE_C */