From 3dee6a87cfd38f6a3384866b2753b59358062d98 Mon Sep 17 00:00:00 2001 From: sv-esk Date: Fri, 4 Mar 2016 20:22:19 +0200 Subject: [PATCH] modify modtools/force.lua avoid segfault in case of invalid or abscent cv argument remove CivAttack. It was broken in 40.0X --- scripts/modtools/force.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/modtools/force.lua b/scripts/modtools/force.lua index 2ae5300fa..a1f4ed9d7 100644 --- a/scripts/modtools/force.lua +++ b/scripts/modtools/force.lua @@ -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