@LabelIndex 420387
@StringIndex 0
class 1 random_spawn : default_maker {
handler:
	EventHandler ON_START(i0,i1,def0) {
		if( on_start_spawn == 0 ) {
			return;
		}
		i1 = gg::Rand(myself.def_count);
		for(i0 = 0; i0 < myself.def_count; i0++) {
			def0 = myself::GetSpawnDefine(i0);
			if( gg::IsNull(def0) == 0 && i0 == i1 ) {
				if( myself::AtomicIncreaseTotal(def0,def0.total,1) ) {
					def0::Spawn2(def0.total,0,0);
				}
			}
		}
	}

	EventHandler ON_NPC_DELETED(deleted_def,i0,i1,i2,maker0,def0,reply) {
		i1 = gg::Rand(myself.def_count);
		def0 = myself::GetSpawnDefine(i1);
		if( gg::IsNull(def0) == 0 ) {
			i2 = ( def0.total - def0.npc_count );
			if( i2 > 0 ) {
				if( myself::AtomicIncreaseTotal(def0,1,1) ) {
					def0::Spawn2(1,def0.respawn_time,def0.respawn_rand);
				}
			}
		}
	}

}
