setup.worldSettings ??= {};
setup.worldSettings.crime = {
	always:{
		label: 'Always',
		abduction:{
			day_low: 10000,
			day_med: 10000,
			day_high:10000,
			night_low: 10000,
			night_med: 10000,
			night_high:10000
		},
		harassment:{
			day_low: 10000,
			day_med: 10000,
			day_high:10000,
			night_low: 10000,
			night_med: 10000,
			night_high:10000
		},
		rape:{
			day_low: 10000,
			day_med: 10000,
			day_high:10000,
			night_low: 10000,
			night_med: 10000,
			night_high:10000
		},
		theft:{
			day_low: 10000,
			day_med: 10000,
			day_high:10000,
			night_low: 10000,
			night_med: 10000,
			night_high:10000
		}
	},
	default:{
		label: 'Default',
		abduction:{
			day_low: 0,
			day_med: 0,
			day_high:10,
			night_low: 10,
			night_med: 100,
			night_high:1000
		},
		harassment:{
			day_low: 10,
			day_med: 20,
			day_high:50,
			night_low: 50,
			night_med: 200,
			night_high:1000
		},
		rape:{
			day_low: 0,
			day_med: 0,
			day_high:10,
			night_low: 10,
			night_med: 100,
			night_high:1000
		},
		theft:{
			day_low: 10,
			day_med: 20,
			day_high:50,
			night_low: 50,
			night_med: 200,
			night_high:1000
		}
	},
	high:{
		label: 'High',
		abduction:{
			day_low: 5,
			day_med: 10,
			day_high:20,
			night_low: 20,
			night_med: 200,
			night_high:2000
		},
		harassment:{
			day_low: 20,
			day_med: 50,
			day_high:100,
			night_low: 100,
			night_med: 500,
			night_high:2000
		},
		rape:{
			day_low: 5,
			day_med: 10,
			day_high:20,
			night_low: 20,
			night_med: 200,
			night_high:2000
		},
		theft:{
			day_low: 20,
			day_med: 50,
			day_high:100,
			night_low: 100,
			night_med: 500,
			night_high:2000
		}
	},
	minimal:{
		label: 'Minimal',
		abduction:{
			day_low: 0,
			day_med: 0,
			day_high:0,
			night_low: 0,
			night_med: 0,
			night_high:0
		},
		harassment:{
			day_low: 0,
			day_med: 0,
			day_high:0,
			night_low: 0,
			night_med: 0,
			night_high:0
		},
		rape:{
			day_low: 0,
			day_med: 0,
			day_high:0,
			night_low: 0,
			night_med: 0,
			night_high:0
		},
		theft:{
			day_low: 0,
			day_med: 0,
			day_high:0,
			night_low: 0,
			night_med: 0,
			night_high:0
		}
	},
	realistic:{
		label: 'Realistic',
		abduction:{
			day_low: 0,
			day_med: 0,
			day_high:1,
			night_low: 1,
			night_med: 2,
			night_high:5
		},
		harassment:{
			day_low: 2,
			day_med: 5,
			day_high:10,
			night_low: 10,
			night_med: 20,
			night_high:50
		},
		rape:{
			day_low: 0,
			day_med: 0,
			day_high:1,
			night_low: 1,
			night_med: 2,
			night_high:5
		},
		theft:{
			day_low: 2,
			day_med: 5,
			day_high:10,
			night_low: 10,
			night_med: 20,
			night_high:50
		}
	}
}

setup.crimeLikelihood = function(crimeId:string,location:LocationIdentifier){
	const time = State.variables.time;
	const crimeSettingId = State.variables.settings.world?.crime ?? 'default';

	const dayOrNight = time.isNight ? 'night' : 'day';

	var crime_risk = 'med';

	let passageTags = location.tags;
	outer:for(let tagCrime of [crimeId,'crime']){
		for(let tagDayNight of [dayOrNight,null]){
			for(let tagSeverety of ['low','med','high']){
				let generatedTag = tagCrime+'_'+(tagDayNight ? tagDayNight +'_' : '') + tagSeverety;
				if(passageTags.includes(generatedTag)){
					crime_risk = tagSeverety;
					break outer;
				}
				//console.warn(generatedTag);
			}
		}
	}

	const subId = `${dayOrNight}_${crime_risk}`;

	//console.warn('CL',passage,crimeSettingId,crimeId,subId,setup.worldSettings.crime[crimeSettingId][crimeId][subId]);

	return setup.worldSettings.crime[crimeSettingId][crimeId][subId];
}