MCPcopy Create free account
hub / github.com/DFHack/dfhack / survey_evil_weather

Function survey_evil_weather

plugins/embark-assistant/survey.cpp:240–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238 //=================================================================================
239
240 void survey_evil_weather(embark_assist::defs::world_tile_data *survey_results) {
241 df::world_data *world_data = world->world_data;
242
243 for (uint16_t i = 0; i < world->interaction_instances.all.size(); i++) {
244 auto interaction = world->raws.interactions[world->interaction_instances.all[i]->interaction_id];
245 uint16_t region_index = world->interaction_instances.all[i]->region_index;
246 bool blood_rain = false;
247 bool permanent_syndrome_rain = false;
248 bool temporary_syndrome_rain = false;
249 bool thralling = false;
250 bool reanimating = false;
251
252 if (interaction->sources.size() &&
253 interaction->sources[0]->getType() == df::interaction_source_type::REGION) {
254 for (uint16_t k = 0; k < interaction->targets.size(); k++) {
255 if (interaction->targets[k]->getType() == df::interaction_target_type::CORPSE) {
256 for (uint16_t l = 0; l < interaction->effects.size(); l++) {
257 if (interaction->effects[l]->getType() == df::interaction_effect_type::ANIMATE) {
258 reanimating = true;
259 break;
260 }
261 }
262 }
263 else if (interaction->targets[k]->getType() == df::interaction_target_type::MATERIAL) {
264 df::interaction_target_materialst* material = virtual_cast<df::interaction_target_materialst>(interaction->targets[k]);
265 if (material && DFHack::MaterialInfo(material->mat_type, material->mat_index).isInorganic()) {
266 for (const auto &syndrome : world->raws.inorganics[material->mat_index]->material.syndrome.syndrome) {
267 for (const auto &ce : syndrome->ce) {
268 df::creature_interaction_effect_type ce_type = ce->getType();
269 if (ce_type == df::creature_interaction_effect_type::FLASH_TILE) {
270 // Using this as a proxy. There seems to be a group of 4 effects for thralls:
271 // display symbol, flash symbol, phys att change and one more.
272 thralling = true;
273 }
274 else if (ce_type == df::creature_interaction_effect_type::PAIN ||
275 ce_type == df::creature_interaction_effect_type::SWELLING ||
276 ce_type == df::creature_interaction_effect_type::OOZING ||
277 ce_type == df::creature_interaction_effect_type::BRUISING ||
278 ce_type == df::creature_interaction_effect_type::BLISTERS ||
279 ce_type == df::creature_interaction_effect_type::NUMBNESS ||
280 ce_type == df::creature_interaction_effect_type::PARALYSIS ||
281 ce_type == df::creature_interaction_effect_type::FEVER ||
282 ce_type == df::creature_interaction_effect_type::BLEEDING ||
283 ce_type == df::creature_interaction_effect_type::COUGH_BLOOD ||
284 ce_type == df::creature_interaction_effect_type::VOMIT_BLOOD ||
285 ce_type == df::creature_interaction_effect_type::NAUSEA ||
286 ce_type == df::creature_interaction_effect_type::UNCONSCIOUSNESS ||
287 ce_type == df::creature_interaction_effect_type::NECROSIS ||
288 ce_type == df::creature_interaction_effect_type::IMPAIR_FUNCTION ||
289 ce_type == df::creature_interaction_effect_type::DROWSINESS ||
290 ce_type == df::creature_interaction_effect_type::DIZZINESS ||
291 ce_type == df::creature_interaction_effect_type::ERRATIC_BEHAVIOR) { // Doubtful if possible for region.
292 if (ce->end == -1) {
293 permanent_syndrome_rain = true;
294 }
295 else {
296 temporary_syndrome_rain = true;
297 }

Callers 1

Calls 3

getTypeMethod · 0.80
MaterialInfoClass · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected