Merge remote-tracking branches 'sv-esk/iscitizen' and 'sv-esk/validation' into develop

develop
lethosor 2016-03-04 19:09:26 -05:00
commit b6f1650a01
2 changed files with 17 additions and 16 deletions

@ -818,26 +818,22 @@ bool Units::isCitizen(df::unit *unit)
// except that the game appears to let melancholy/raving
// dwarves count as citizens.
if (!isDwarf(unit) || !isSane(unit))
return false;
if (unit->flags1.bits.marauder ||
unit->flags1.bits.invader_origin ||
unit->flags1.bits.active_invader ||
unit->flags1.bits.forest ||
unit->flags1.bits.merchant ||
unit->flags1.bits.diplomat)
unit->flags1.bits.diplomat ||
unit->flags2.bits.visitor ||
unit->flags2.bits.visitor_uninvited ||
unit->flags2.bits.underworld ||
unit->flags2.bits.resident)
return false;
if (unit->flags1.bits.tame)
return true;
if (!isSane(unit))
return false;
return unit->civ_id == ui->civ_id &&
unit->civ_id != -1 &&
!unit->flags2.bits.underworld &&
!unit->flags2.bits.resident &&
!unit->flags2.bits.visitor_uninvited &&
!unit->flags2.bits.visitor;
return isOwnGroup(unit);
}
bool Units::isDwarf(df::unit *unit)
@ -901,7 +897,7 @@ bool Units::isOwnGroup(df::unit* unit)
for (size_t i = 0; i < histfig->entity_links.size(); i++)
{
auto link = histfig->entity_links[i];
if (link->entity_id == ui->group_id && (*link).getType() == df::histfig_entity_link_type::MEMBER)
if (link->entity_id == ui->group_id && link->getType() == df::histfig_entity_link_type::MEMBER)
return true;
}
return false;

@ -6,7 +6,7 @@
modtools/force
==============
This tool triggers events like megabeasts, caravans, invaders, and migrants.
This tool triggers events like megabeasts, caravans, and migrants.
=end]]
local utils = require 'utils'
@ -44,7 +44,6 @@ arguments:
WildlifeCurious
WildlifeMischievous
WildlifeFlier
CivAttack
NightCreature
-civ entity
specify the civ of the event, if applicable
@ -54,7 +53,7 @@ arguments:
EVIL
28
]])
print('force: -eventType [Megabeast, Migrants, Caravan, Diplomat, WildlifeCurious, WildlifeMischievous, WildlifeFlier, CivAttack, NightCreature] -civ [player,ENTITY_ID]')
print('force: -eventType [Megabeast, Migrants, Caravan, Diplomat, WildlifeCurious, WildlifeMischievous, WildlifeFlier, NightCreature] -civ [player,ENTITY_ID]')
return
end
@ -67,7 +66,13 @@ end
if args.civ == 'player' then
args.civ = df.historical_entity.find(df.global.ui.civ_id)
elseif args.civ then
local civ = args.civ
args.civ = findCiv(args.civ)
if not args.civ then
error('Invalid civ: ' .. civ)
end
elseif args.eventType == 'Caravan' or args.eventType == 'Diplomat' then
error('Specify civ for this eventType')
end
if args.eventType == 'Migrants' then