Merge branch 'master' of harrygodden.com:/home/carveJwlIkooP6JGAAIwe30JlM
[carveJwlIkooP6JGAAIwe30JlM.git] / world_volumes.c
index 2f0569df364df22a93eedbc3a2797c2887bc79e4..7f2b685170e6f1ce784ef60529e4927dd32516a1 100644 (file)
@@ -19,10 +19,19 @@ static void world_volumes_update( world_instance *world, v3f pos ){
          world_static.active_trigger_volumes[ j ++ ] = idx;
          boxf cube = {{-1.0f,-1.0f,-1.0f},{1.0f,1.0f,1.0f}};
          vg_line_boxf_transformed( volume->to_world, cube, 0xff00ccff );
-         /* triggr on stay ..... */
       }
       else{
-         /* trigger on exit...... */
+         /* 
+          * LEGACY BEHAVIOUR: < v104 does not have leave events
+          */
+         if( world->meta.info.version >= 104 ){
+            ent_call basecall;
+            basecall.function = k_ent_function_trigger_leave;
+            basecall.id = mdl_entity_id( k_ent_volume, idx );
+            basecall.data = NULL;
+
+            entity_call( world, &basecall );
+         }
       }
    }
    world_static.active_trigger_volume_count = j;
@@ -37,13 +46,10 @@ static void world_volumes_update( world_instance *world, v3f pos ){
       random_ticks ++;
    }
 
-   float radius = 25.0f;
-   boxf volume_proximity;
-   v3_add( pos, (v3f){ radius, radius, radius }, volume_proximity[1] );
-   v3_sub( pos, (v3f){ radius, radius, radius }, volume_proximity[0] );
+   float radius = 32.0f;
 
    bh_iter it;
-   bh_iter_init_box( 0, &it, volume_proximity );
+   bh_iter_init_range( 0, &it, pos, radius );
    i32 idx;
 
    while( bh_next( world->entity_bh, &it, &idx ) ){