From 5736e4413aef4e7717d1c248451d899ab27e9d97 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 3 Oct 2021 00:47:23 +0300 Subject: [PATCH 41/41] default.lua: Add a chance that a map is found from a hut Add new event type E_HUT_MAP for the message when that happens Requested by ihnatus See osdn #42974 Signed-off-by: Marko Lindqvist --- common/events.c | 1 + common/events.h | 1 + data/default/default.lua | 15 ++++++++++++++- data/misc/events.spec | 1 + data/stdsounds.soundspec | 1 + fc_version | 2 +- 6 files changed, 19 insertions(+), 2 deletions(-) diff --git a/common/events.c b/common/events.c index 73c27695af..4794ba7199 100644 --- a/common/events.c +++ b/common/events.c @@ -224,6 +224,7 @@ static struct { GEN_EV(E_UNIT_ACTION_TARGET_HOSTILE, E_S_UNIT, N_("Unit did to you")), GEN_EV(E_UNIT_ACTION_TARGET_OTHER, E_S_UNIT, N_("Unit did")), GEN_EV(E_INFRAPOINTS, E_S_NATION, N_("Infrapoints")), + GEN_EV(E_HUT_MAP, E_S_HUT, N_("Map found from a hut")), /* The sound system also generates "e_game_quit", although there's no * corresponding identifier E_GAME_QUIT. */ }; diff --git a/common/events.h b/common/events.h index 238163d20f..64a72ef98b 100644 --- a/common/events.h +++ b/common/events.h @@ -172,6 +172,7 @@ extern "C" { #define SPECENUM_VALUE133 E_UNIT_ACTION_TARGET_OTHER #define SPECENUM_VALUE134 E_UNIT_ACTION_TARGET_HOSTILE #define SPECENUM_VALUE135 E_INFRAPOINTS +#define SPECENUM_VALUE136 E_HUT_MAP /* * Note: If you add a new event, make sure you make a similar change * to the events array in "common/events.c" using GEN_EV, to diff --git a/data/default/default.lua b/data/default/default.lua index 3e70842434..11e6010b2e 100644 --- a/data/default/default.lua +++ b/data/default/default.lua @@ -127,9 +127,20 @@ function _deflua_hut_get_barbarians(unit) return alive end +-- Reveal map around the hut +function _deflua_hut_reveal_map(unit) + local owner = unit.owner + + notify.event(owner, unit.tile, E.HUT_MAP, + _("You find a map of the surrounding terrain.")) + for revealtile in unit.tile:circle_iterate(30) do + revealtile:show(owner) + end +end + -- Randomly choose a hut event function _deflua_hut_enter_callback(unit) - local chance = random(0, 11) + local chance = random(0, 13) local alive = true if chance == 0 then @@ -150,6 +161,8 @@ function _deflua_hut_enter_callback(unit) if not _deflua_hut_get_city(unit) then _deflua_hut_consolation_prize(unit) end + elseif chance == 12 or chance == 13 then + _deflua_hut_reveal_map(unit) end -- continue processing if unit is alive diff --git a/data/misc/events.spec b/data/misc/events.spec index 1b0c7f69b6..c07fdf227d 100644 --- a/data/misc/events.spec +++ b/data/misc/events.spec @@ -73,6 +73,7 @@ tiles = { "row", "column", "tag" 2, 5, "e_hut_settler" 2, 6, "e_hut_tech" 2, 7, "e_hut_barb_city_near" + 4, 10, "e_hut_map" 2, 8, "e_tech_gain" 2, 9, "e_tech_learned" diff --git a/data/stdsounds.soundspec b/data/stdsounds.soundspec index fa8d8f4a95..4e23ecc4f4 100644 --- a/data/stdsounds.soundspec +++ b/data/stdsounds.soundspec @@ -254,6 +254,7 @@ e_bad_command = "stdsounds/illegal.ogg" ; [fcol] ;e_hut_merc = "" ;e_hut_settler = "" ;e_hut_tech = "" +;e_hut_map = "" ;e_imp_auctioned = "" ;e_imp_auto = "" ;e_imp_build = "" diff --git a/fc_version b/fc_version index e600ee76c7..d5cf780680 100755 --- a/fc_version +++ b/fc_version @@ -56,7 +56,7 @@ DEFAULT_FOLLOW_TAG=S3_2 # - No new mandatory capabilities can be added to the release branch; doing # so would break network capability of supposedly "compatible" releases. # -NETWORK_CAPSTRING="+Freeciv.Devel-3.2-2021.Oct.02b" +NETWORK_CAPSTRING="+Freeciv.Devel-3.2-2021.Oct.03" FREECIV_DISTRIBUTOR="" -- 2.33.0