From f1869c38569f80f4434357a198327d5c6887b6ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Lach?= Date: Tue, 20 Jun 2023 17:53:48 +0200 Subject: [PATCH 1/3] =?UTF-8?q?!OSDN:#47827:S=C5=82awomir=20Lach=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test of basic counters support in lua diff --git a/data/default/default.lua b/data/default/default.lua index 6ed3a2b79f..5a5a415d85 100644 --- a/data/default/default.lua +++ b/data/default/default.lua @@ -244,3 +244,26 @@ function _deflua_unit_loss_messages(unit, player, reason) end signal.connect("unit_lost", "_deflua_unit_loss_messages") + +function game_started(turn, year) +if 1 == turn then +local i = 0 +local counter_string = nil +local counter = find.counter(i) +while not (nil == counter) do + if i == 0 then + counter_string = 'You can use counters in this game:' + end + + counter_string = counter_string .. '\n' .. Counter.rule_name(counter) + i = i + 1 + counter = find.counter(i) +end +if not (nil == counter_string) then + counter_string = counter_string .. '\nRead more about counters in freeciv documentation' + notify.event(nil, nil, E.SCRIPT, counter_string) +end +end +end + +signal.connect('turn_begin', 'game_started') -- 2.41.0