From e5139bf03a8df87158a2adb7752068180270f36e Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Mon, 10 Feb 2020 20:50:51 +0100 Subject: [PATCH 01/16] read_from_json_string overload to use string directly instead of JsonIn --- src/units.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/units.h b/src/units.h index 8a049464ec7e3..53f0266e18af2 100644 --- a/src/units.h +++ b/src/units.h @@ -720,6 +720,56 @@ T read_from_json_string( JsonIn &jsin, const std::vector +T read_from_json_string( std::string string, const std::vector> &units ) +{ + size_t i = 0; + // returns whether we are at the end of the string + const auto skip_spaces = [&]() { + while( i < string.size() && string[i] == ' ' ) { + ++i; + } + return i >= string.size(); + }; + const auto get_unit = [&]() { + if( skip_spaces() ) { + debugmsg( "invalid quantity string: missing unit" ); + } + for( const auto &pair : units ) { + const std::string &unit = pair.first; + if( string.size() >= unit.size() + i && string.compare( i, unit.size(), unit ) == 0 ) { + i += unit.size(); + return pair.second; + } + } + debugmsg( "invalid quantity string: unknown unit" ); + // above always throws + throw; + }; + + if( skip_spaces() ) { + debugmsg( "invalid quantity string: empty string" ); + } + T result{}; + do { + int sign_value = +1; + if( string[i] == '-' ) { + sign_value = -1; + ++i; + } else if( string[i] == '+' ) { + ++i; + } + if( i >= string.size() || !isdigit( string[i] ) ) { + debugmsg( "invalid quantity string: number expected" ); + } + int value = 0; + for( ; i < string.size() && isdigit( string[i] ); ++i ) { + value = value * 10 + ( string[i] - '0' ); + } + result += sign_value * value * get_unit(); + } while( !skip_spaces() ); + return result; +} template void dump_to_json_string( T t, JsonOut &jsout, From b82782ce9590642e6a705a2ac510ef8b497141df Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Mon, 10 Feb 2020 20:52:10 +0100 Subject: [PATCH 02/16] change emit_fields from set to map --- src/monster.cpp | 10 +++++++--- src/monstergenerator.cpp | 12 ++++++++---- src/mtype.h | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/monster.cpp b/src/monster.cpp index 1a1594433b278..1cb0502b09473 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -1941,8 +1941,12 @@ void monster::process_turn() { decrement_summon_timer(); if( !is_hallucination() ) { - for( const auto &e : type->emit_fields ) { - if( e == emit_id( "emit_shock_cloud" ) ) { + for( const std::pair &e : type->emit_fields ) { + if( !calendar::once_every( e.second ) ) { + continue; + } + const emit_id emid = e.first; + if( emid == emit_id( "emit_shock_cloud" ) ) { if( has_effect( effect_emp ) ) { continue; // don't emit electricity while EMPed } else if( has_effect( effect_supercharged ) ) { @@ -1950,7 +1954,7 @@ void monster::process_turn() continue; } } - g->m.emit_field( pos(), e ); + g->m.emit_field( pos(), emid ); } } diff --git a/src/monstergenerator.cpp b/src/monstergenerator.cpp index 7fc39dfbb71ab..1b6591e568568 100644 --- a/src/monstergenerator.cpp +++ b/src/monstergenerator.cpp @@ -760,7 +760,10 @@ void mtype::load( const JsonObject &jo, const std::string &src ) dies.push_back( mdeath::normal ); } - assign( jo, "emit_fields", emit_fields ); + for( JsonArray ja : jo.get_array( "emit_fields" ) ) { + emit_fields.emplace( ja.get_string( 0 ), read_from_json_string( ja.get_string( 1 ), + time_duration::units ) ); + } if( jo.has_member( "special_when_hit" ) ) { JsonArray jsarr = jo.get_array( "special_when_hit" ); @@ -1149,9 +1152,10 @@ void MonsterGenerator::check_monster_definitions() const } } - for( const auto &e : mon.emit_fields ) { - if( !e.is_valid() ) { - debugmsg( "monster %s has invalid emit source %s", mon.id.c_str(), e.c_str() ); + for( const std::pair &e : mon.emit_fields ) { + const emit_id emid = e.first; + if( !emid.is_valid() ) { + debugmsg( "monster %s has invalid emit source %s", mon.id.c_str(), emid.c_str() ); } } diff --git a/src/mtype.h b/src/mtype.h index d28bc9f100be2..c3fd06ee887d2 100644 --- a/src/mtype.h +++ b/src/mtype.h @@ -353,7 +353,7 @@ struct mtype { int mech_str_bonus = 0; /** Emission sources that cycle each turn the monster remains alive */ - std::set emit_fields; + std::map emit_fields; pathfinding_settings path_settings; From e3e210ec1cdc89244f317900d9eb362155d23afb Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Mon, 10 Feb 2020 20:53:28 +0100 Subject: [PATCH 03/16] update vanilla monsters, don't change balance --- data/json/monsters/fungus.json | 4 ++-- data/json/monsters/nether.json | 4 ++-- data/json/monsters/zed_electric.json | 2 +- data/json/monsters/zed_explosive.json | 2 +- data/json/monsters/zed_misc.json | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/data/json/monsters/fungus.json b/data/json/monsters/fungus.json index d398ac550bc0b..bd34d04377d9d 100644 --- a/data/json/monsters/fungus.json +++ b/data/json/monsters/fungus.json @@ -363,7 +363,7 @@ "vision_day": 5, "vision_night": 5, "harvest": "exempt", - "emit_fields": [ "emit_fungal_leak" ], + "emit_fields": [ [ "emit_fungal_leak", "1 s" ] ], "special_attacks": [ [ "SUICIDE", 20 ], [ "scratch", 15 ] ], "death_drops": "default_zombie_items", "death_function": [ "FUNGALBURST" ], @@ -397,7 +397,7 @@ "vision_day": 5, "vision_night": 3, "harvest": "zombie", - "emit_fields": [ "emit_fungal_haze_plume" ], + "emit_fields": [ [ "emit_fungal_haze_plume", "1 s" ] ], "special_attacks": [ { "type": "bite", "cooldown": 5 }, [ "scratch", 15 ] ], "death_function": [ "FUNGUS" ], "flags": [ "SEES", "STUMBLES", "WARM", "BASHES", "GROUP_BASH", "POISON", "HARDTOSHOOT", "NO_BREATHE", "PUSH_MON", "FILTHY" ] diff --git a/data/json/monsters/nether.json b/data/json/monsters/nether.json index 0cfb6a8c256e2..4aeeccfa0fafe 100644 --- a/data/json/monsters/nether.json +++ b/data/json/monsters/nether.json @@ -483,7 +483,7 @@ "vision_night": 50, "harvest": "exempt", "special_attacks": [ [ "TINDALOS_TELEPORT", 5 ] ], - "emit_fields": [ "emit_tindalos_gas_leak" ], + "emit_fields": [ [ "emit_tindalos_gas_leak", "1 s" ] ], "path_settings": { "max_dist": 10 }, "death_function": [ "MELT" ], "flags": [ @@ -526,7 +526,7 @@ "vision_night": 50, "harvest": "exempt", "special_attacks": [ [ "TINDALOS_TELEPORT", 5 ], [ "DISAPPEAR", 25 ] ], - "emit_fields": [ "emit_tindalos_gas_leak" ], + "emit_fields": [ [ "emit_tindalos_gas_leak", "1 s" ] ], "path_settings": { "max_dist": 10 }, "death_function": [ "MELT" ], "flags": [ diff --git a/data/json/monsters/zed_electric.json b/data/json/monsters/zed_electric.json index d18d60ce96ae8..34a21f5574b43 100644 --- a/data/json/monsters/zed_electric.json +++ b/data/json/monsters/zed_electric.json @@ -120,7 +120,7 @@ "vision_night": 3, "luminance": 16, "harvest": "CBM_SUBS", - "emit_fields": [ "emit_shock_cloud" ], + "emit_fields": [ [ "emit_shock_cloud", "1 s" ] ], "special_when_hit": [ "ZAPBACK", 75 ], "death_drops": "default_zombie_death_drops", "death_function": [ "NORMAL" ], diff --git a/data/json/monsters/zed_explosive.json b/data/json/monsters/zed_explosive.json index 11750b3a20aa4..b8367a1ffe8be 100644 --- a/data/json/monsters/zed_explosive.json +++ b/data/json/monsters/zed_explosive.json @@ -157,7 +157,7 @@ "melee_cut": 0, "vision_night": 3, "harvest": "exempt", - "emit_fields": [ "emit_toxic_leak" ], + "emit_fields": [ [ "emit_toxic_leak", "1 s" ] ], "special_attacks": [ [ "SUICIDE", 20 ], [ "scratch", 15 ] ], "death_drops": "default_zombie_items", "death_function": [ "GAS" ], diff --git a/data/json/monsters/zed_misc.json b/data/json/monsters/zed_misc.json index 67a8f5493cc88..1546b7996728e 100644 --- a/data/json/monsters/zed_misc.json +++ b/data/json/monsters/zed_misc.json @@ -1017,7 +1017,7 @@ "vision_day": 50, "vision_night": 3, "harvest": "exempt", - "emit_fields": [ "emit_smoke_stream" ], + "emit_fields": [ [ "emit_smoke_stream", "1 s" ] ], "special_attacks": [ { "type": "bite", "cooldown": 5 }, [ "scratch", 15 ] ], "death_function": [ "SMOKEBURST" ], "flags": [ From 4fa2a19b1a271d046ed96bb5c224b45c210180ff Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Mon, 10 Feb 2020 20:54:04 +0100 Subject: [PATCH 04/16] Gum spider stop spamming gum webs --- data/mods/My_Sweet_Cataclysm/sweet_monsters.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/mods/My_Sweet_Cataclysm/sweet_monsters.json b/data/mods/My_Sweet_Cataclysm/sweet_monsters.json index f4e0d87c30632..8944738e73cf7 100644 --- a/data/mods/My_Sweet_Cataclysm/sweet_monsters.json +++ b/data/mods/My_Sweet_Cataclysm/sweet_monsters.json @@ -369,7 +369,7 @@ "vision_day": 5, "vision_night": 5, "harvest": "gum_spider", - "emit_fields": [ "emit_gum_web" ], + "emit_fields": [ [ "emit_gum_web", "30 m" ] ], "death_function": [ "NORMAL" ], "flags": [ "SEES", "SMELLS", "HEARS", "CLIMBS", "PATH_AVOID_FIRE", "PATH_AVOID_FALL" ], "reproduction": { "baby_egg": "gum", "baby_count": 10, "baby_timer": 5 } From 54dba67c52b38bdbcaf067a0236918d1e033ca26 Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Mon, 10 Feb 2020 20:54:22 +0100 Subject: [PATCH 05/16] doc --- doc/MONSTERS.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/MONSTERS.md b/doc/MONSTERS.md index a2798f3ad60b7..0ef709e621669 100644 --- a/doc/MONSTERS.md +++ b/doc/MONSTERS.md @@ -234,6 +234,11 @@ An item group that is used to spawn items when the monster dies. This can be an How the monster behaves on death. See JSON_FLAGS.md for a list of possible functions. One can add or remove entries in mods via "add:death_function" and "remove:death_function". +## "emit_field" +(array of arrays of emit_id and time_duration, optional) + +What field the monster emits and how often it does so. Time duration can use strings: "1 h", "60 m", "3600 s" etc... + ## "regenerates" (integer, optional) From f00acf14c0d2c585fb77eeb685ad3bf835942b70 Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Mon, 10 Feb 2020 20:59:49 +0100 Subject: [PATCH 06/16] Update mods, don't change balance --- data/mods/Magiclysm/monsters/dragon.json | 2 +- .../Modular_Turrets/monster_override.json | 2 +- data/mods/Salvaged_Robots/monsters.json | 22 +++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/data/mods/Magiclysm/monsters/dragon.json b/data/mods/Magiclysm/monsters/dragon.json index 491d65f515bef..202c66911f2a0 100644 --- a/data/mods/Magiclysm/monsters/dragon.json +++ b/data/mods/Magiclysm/monsters/dragon.json @@ -155,7 +155,7 @@ "//": "Large means powerful, but it does not mean fast.", "speed": 100, "delete": { "flags": [ "PATH_AVOID_DANGER_2" ] }, - "emit_fields": [ "emit_dragon_adult_fright" ], + "emit_fields": [ [ "emit_dragon_adult_fright", "1 s" ] ], "special_attacks": [ { "type": "bite", "cooldown": 10 }, [ "scratch", 3 ], diff --git a/data/mods/Modular_Turrets/monster_override.json b/data/mods/Modular_Turrets/monster_override.json index 229fe875507a2..7cb5919793ec0 100644 --- a/data/mods/Modular_Turrets/monster_override.json +++ b/data/mods/Modular_Turrets/monster_override.json @@ -170,7 +170,7 @@ "copy-from": "mon_defbot_base", "name": "riotcontrol robot", "description": "An automated defense robot still active due to its internal power source. This one is equipped with an electric prod, tear gas sprayer, and integrated 40mm beanbag launcher.", - "emit_fields": [ "emit_tear_gas_pulse" ], + "emit_fields": [ [ "emit_tear_gas_pulse", "1 s" ] ], "melee_damage": [ { "damage_type": "electric", "amount": 6 } ], "starting_ammo": { "40x46mm_m1006": 100 }, "special_attacks": [ diff --git a/data/mods/Salvaged_Robots/monsters.json b/data/mods/Salvaged_Robots/monsters.json index 247708b5d115b..5fcfcd6fa0453 100644 --- a/data/mods/Salvaged_Robots/monsters.json +++ b/data/mods/Salvaged_Robots/monsters.json @@ -140,7 +140,7 @@ "morale": 10, "dodge": 8, "armor_cut": 4, - "emit_fields": [ "emit_sparks" ], + "emit_fields": [ [ "emit_sparks", "1 s" ] ], "revert_to_itype": "bot_distract_hack", "death_function": [ "MELT" ], "special_attacks": [ [ "PARROT", 0 ] ], @@ -160,7 +160,7 @@ "aggression": 10, "morale": 0, "dodge": 4, - "emit_fields": [ "emit_fire_plume" ], + "emit_fields": [ [ "emit_fire_plume", "1 s" ] ], "death_function": [ "MELT" ], "extend": { "flags": [ "STUMBLES", "HARDTOSHOOT", "PET_WONT_FOLLOW", "FIREY" ] } }, @@ -243,7 +243,7 @@ "description": "A salvaged eyebot repurposed into a floating space heater. It emits a constant jet of warm air to heat an enclosed space.", "revert_to_itype": "bot_eyebot_heater", "fear_triggers": [ "HURT" ], - "emit_fields": [ "emit_hot_air2_stream" ], + "emit_fields": [ [ "emit_hot_air2_stream", "1 s" ] ], "extend": { "flags": [ "PET_WONT_FOLLOW", "WARM" ] } }, { @@ -257,7 +257,7 @@ "description": "A salvaged eyebot repurposed into a floating space heater. It emits a constant jet of dangerously hot air to heat an enclosed space. Warning! Can result in rapid heatstroke!", "revert_to_itype": "bot_eyebot_furnace", "fear_triggers": [ "HURT" ], - "emit_fields": [ "emit_hot_air4_stream" ], + "emit_fields": [ [ "emit_hot_air4_stream", "1 s" ] ], "death_function": [ "BROKEN", "EXPLODE" ], "extend": { "flags": [ "PET_WONT_FOLLOW", "WARM" ] } }, @@ -410,7 +410,7 @@ "morale": 10, "fear_triggers": [ "HURT" ], "revert_to_itype": "bot_utilibot_digester", - "emit_fields": [ "emit_acid_trail" ], + "emit_fields": [ [ "emit_acid_trail", "1 s" ] ], "extend": { "flags": [ "STUMBLES", "ABSORBS", "ACIDPROOF" ] } }, { @@ -533,7 +533,7 @@ "description": "A salvaged medibot stuffed with marijuana, covered in multicolored blinking lights, and programmed to dance. Why on Earth would you build this crazy thing?", "color": "yellow", "luminance": 100, - "emit_fields": [ "emit_weed_puff" ], + "emit_fields": [ [ "emit_weed_puff", "1 s" ] ], "melee_skill": 4, "melee_dice": 2, "melee_dice_sides": 4, @@ -1205,7 +1205,7 @@ "vision_day": 20, "revert_to_itype": "bot_defbot_samurai", "special_when_hit": [ "ZAPBACK", 5 ], - "emit_fields": [ "emit_electric_arcs" ], + "emit_fields": [ [ "emit_electric_arcs", "1 s" ] ], "extend": { "flags": [ "ELECTRIC" ] } }, { @@ -1229,7 +1229,7 @@ "dodge": 3, "vision_day": 50, "revert_to_itype": "bot_defbot_paladin", - "emit_fields": [ "emit_smoke_trail" ], + "emit_fields": [ [ "emit_smoke_trail", "1 s" ] ], "starting_ammo": { "gasoline": 1000 }, "special_attacks": [ [ "PARROT", 0 ], @@ -1368,7 +1368,7 @@ "luminance": 200, "armor_bash": 8, "revert_to_itype": "bot_advbot_glitter", - "emit_fields": [ "emit_dazzle_trail" ], + "emit_fields": [ [ "emit_dazzle_trail", "1 s" ] ], "special_attacks": [ { "type": "gun", @@ -1397,7 +1397,7 @@ "melee_damage": [ { "damage_type": "acid", "amount": 8 } ], "armor_bash": 8, "armor_cut": 8, - "emit_fields": [ "emit_acid_trail" ], + "emit_fields": [ [ "emit_acid_trail", "1 s" ] ], "special_when_hit": [ "ACIDSPLASH", 100 ], "special_attacks": [ [ "ACID_BARF", 10 ], @@ -1588,7 +1588,7 @@ "attack_effs": [ { "id": "downed", "chance": 20, "duration": 10 }, { "id": "irradiated", "chance": 50 } ], "vision_day": 20, "revert_to_itype": "bot_tankbot_sultan", - "emit_fields": [ "emit_nuclear_trail" ], + "emit_fields": [ [ "emit_nuclear_trail", "1 s" ] ], "special_attacks": [ [ "SMASH", 30 ], [ "GRAB", 20 ] ], "extend": { "flags": [ "STUMBLES", "GRABS" ] } } From bb7b15c0508387444768864bbf4ba8757bb831ad Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Thu, 20 Feb 2020 09:48:13 +0100 Subject: [PATCH 07/16] update crazy cataclysm --- data/mods/CrazyCataclysm/crazy_monsters.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/mods/CrazyCataclysm/crazy_monsters.json b/data/mods/CrazyCataclysm/crazy_monsters.json index f3d87a6d0a7d1..baca18b9760fa 100644 --- a/data/mods/CrazyCataclysm/crazy_monsters.json +++ b/data/mods/CrazyCataclysm/crazy_monsters.json @@ -98,7 +98,7 @@ "armor_cut": 4, "vision_day": 30, "vision_night": 10, - "emit_fields": [ "emit_smoke_stream" ], + "emit_fields": [ [ "emit_smoke_stream", "1 s" ] ], "special_attacks": [ { "type": "bite", "cooldown": 5 } ], "anger_triggers": [ "HURT", "PLAYER_CLOSE" ], "placate_triggers": [ "MEAT" ], From 62f04e8438456e01f80f10feeee3ef6e5cb77852 Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Sat, 22 Feb 2020 13:26:46 +0100 Subject: [PATCH 08/16] Revert "Update mods, don't change balance" This reverts commit f00acf14c0d2c585fb77eeb685ad3bf835942b70. --- data/mods/Magiclysm/monsters/dragon.json | 2 +- .../Modular_Turrets/monster_override.json | 2 +- data/mods/Salvaged_Robots/monsters.json | 22 +++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/data/mods/Magiclysm/monsters/dragon.json b/data/mods/Magiclysm/monsters/dragon.json index 202c66911f2a0..491d65f515bef 100644 --- a/data/mods/Magiclysm/monsters/dragon.json +++ b/data/mods/Magiclysm/monsters/dragon.json @@ -155,7 +155,7 @@ "//": "Large means powerful, but it does not mean fast.", "speed": 100, "delete": { "flags": [ "PATH_AVOID_DANGER_2" ] }, - "emit_fields": [ [ "emit_dragon_adult_fright", "1 s" ] ], + "emit_fields": [ "emit_dragon_adult_fright" ], "special_attacks": [ { "type": "bite", "cooldown": 10 }, [ "scratch", 3 ], diff --git a/data/mods/Modular_Turrets/monster_override.json b/data/mods/Modular_Turrets/monster_override.json index 7cb5919793ec0..229fe875507a2 100644 --- a/data/mods/Modular_Turrets/monster_override.json +++ b/data/mods/Modular_Turrets/monster_override.json @@ -170,7 +170,7 @@ "copy-from": "mon_defbot_base", "name": "riotcontrol robot", "description": "An automated defense robot still active due to its internal power source. This one is equipped with an electric prod, tear gas sprayer, and integrated 40mm beanbag launcher.", - "emit_fields": [ [ "emit_tear_gas_pulse", "1 s" ] ], + "emit_fields": [ "emit_tear_gas_pulse" ], "melee_damage": [ { "damage_type": "electric", "amount": 6 } ], "starting_ammo": { "40x46mm_m1006": 100 }, "special_attacks": [ diff --git a/data/mods/Salvaged_Robots/monsters.json b/data/mods/Salvaged_Robots/monsters.json index 5fcfcd6fa0453..247708b5d115b 100644 --- a/data/mods/Salvaged_Robots/monsters.json +++ b/data/mods/Salvaged_Robots/monsters.json @@ -140,7 +140,7 @@ "morale": 10, "dodge": 8, "armor_cut": 4, - "emit_fields": [ [ "emit_sparks", "1 s" ] ], + "emit_fields": [ "emit_sparks" ], "revert_to_itype": "bot_distract_hack", "death_function": [ "MELT" ], "special_attacks": [ [ "PARROT", 0 ] ], @@ -160,7 +160,7 @@ "aggression": 10, "morale": 0, "dodge": 4, - "emit_fields": [ [ "emit_fire_plume", "1 s" ] ], + "emit_fields": [ "emit_fire_plume" ], "death_function": [ "MELT" ], "extend": { "flags": [ "STUMBLES", "HARDTOSHOOT", "PET_WONT_FOLLOW", "FIREY" ] } }, @@ -243,7 +243,7 @@ "description": "A salvaged eyebot repurposed into a floating space heater. It emits a constant jet of warm air to heat an enclosed space.", "revert_to_itype": "bot_eyebot_heater", "fear_triggers": [ "HURT" ], - "emit_fields": [ [ "emit_hot_air2_stream", "1 s" ] ], + "emit_fields": [ "emit_hot_air2_stream" ], "extend": { "flags": [ "PET_WONT_FOLLOW", "WARM" ] } }, { @@ -257,7 +257,7 @@ "description": "A salvaged eyebot repurposed into a floating space heater. It emits a constant jet of dangerously hot air to heat an enclosed space. Warning! Can result in rapid heatstroke!", "revert_to_itype": "bot_eyebot_furnace", "fear_triggers": [ "HURT" ], - "emit_fields": [ [ "emit_hot_air4_stream", "1 s" ] ], + "emit_fields": [ "emit_hot_air4_stream" ], "death_function": [ "BROKEN", "EXPLODE" ], "extend": { "flags": [ "PET_WONT_FOLLOW", "WARM" ] } }, @@ -410,7 +410,7 @@ "morale": 10, "fear_triggers": [ "HURT" ], "revert_to_itype": "bot_utilibot_digester", - "emit_fields": [ [ "emit_acid_trail", "1 s" ] ], + "emit_fields": [ "emit_acid_trail" ], "extend": { "flags": [ "STUMBLES", "ABSORBS", "ACIDPROOF" ] } }, { @@ -533,7 +533,7 @@ "description": "A salvaged medibot stuffed with marijuana, covered in multicolored blinking lights, and programmed to dance. Why on Earth would you build this crazy thing?", "color": "yellow", "luminance": 100, - "emit_fields": [ [ "emit_weed_puff", "1 s" ] ], + "emit_fields": [ "emit_weed_puff" ], "melee_skill": 4, "melee_dice": 2, "melee_dice_sides": 4, @@ -1205,7 +1205,7 @@ "vision_day": 20, "revert_to_itype": "bot_defbot_samurai", "special_when_hit": [ "ZAPBACK", 5 ], - "emit_fields": [ [ "emit_electric_arcs", "1 s" ] ], + "emit_fields": [ "emit_electric_arcs" ], "extend": { "flags": [ "ELECTRIC" ] } }, { @@ -1229,7 +1229,7 @@ "dodge": 3, "vision_day": 50, "revert_to_itype": "bot_defbot_paladin", - "emit_fields": [ [ "emit_smoke_trail", "1 s" ] ], + "emit_fields": [ "emit_smoke_trail" ], "starting_ammo": { "gasoline": 1000 }, "special_attacks": [ [ "PARROT", 0 ], @@ -1368,7 +1368,7 @@ "luminance": 200, "armor_bash": 8, "revert_to_itype": "bot_advbot_glitter", - "emit_fields": [ [ "emit_dazzle_trail", "1 s" ] ], + "emit_fields": [ "emit_dazzle_trail" ], "special_attacks": [ { "type": "gun", @@ -1397,7 +1397,7 @@ "melee_damage": [ { "damage_type": "acid", "amount": 8 } ], "armor_bash": 8, "armor_cut": 8, - "emit_fields": [ [ "emit_acid_trail", "1 s" ] ], + "emit_fields": [ "emit_acid_trail" ], "special_when_hit": [ "ACIDSPLASH", 100 ], "special_attacks": [ [ "ACID_BARF", 10 ], @@ -1588,7 +1588,7 @@ "attack_effs": [ { "id": "downed", "chance": 20, "duration": 10 }, { "id": "irradiated", "chance": 50 } ], "vision_day": 20, "revert_to_itype": "bot_tankbot_sultan", - "emit_fields": [ [ "emit_nuclear_trail", "1 s" ] ], + "emit_fields": [ "emit_nuclear_trail" ], "special_attacks": [ [ "SMASH", 30 ], [ "GRAB", 20 ] ], "extend": { "flags": [ "STUMBLES", "GRABS" ] } } From 6ece934a680aa1c48eb6024ff9b35a9b0c36f9b4 Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Sat, 22 Feb 2020 13:27:04 +0100 Subject: [PATCH 09/16] Revert "update crazy cataclysm" This reverts commit bb7b15c0508387444768864bbf4ba8757bb831ad. --- data/mods/CrazyCataclysm/crazy_monsters.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/mods/CrazyCataclysm/crazy_monsters.json b/data/mods/CrazyCataclysm/crazy_monsters.json index baca18b9760fa..f3d87a6d0a7d1 100644 --- a/data/mods/CrazyCataclysm/crazy_monsters.json +++ b/data/mods/CrazyCataclysm/crazy_monsters.json @@ -98,7 +98,7 @@ "armor_cut": 4, "vision_day": 30, "vision_night": 10, - "emit_fields": [ [ "emit_smoke_stream", "1 s" ] ], + "emit_fields": [ "emit_smoke_stream" ], "special_attacks": [ { "type": "bite", "cooldown": 5 } ], "anger_triggers": [ "HURT", "PLAYER_CLOSE" ], "placate_triggers": [ "MEAT" ], From 4291b1b71d8234f86d61de23f7d1d5250367a889 Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Sat, 22 Feb 2020 13:30:40 +0100 Subject: [PATCH 10/16] Revert "update vanilla monsters, don't change balance" This reverts commit e3e210ec1cdc89244f317900d9eb362155d23afb. --- data/json/monsters/fungus.json | 4 ++-- data/json/monsters/nether.json | 4 ++-- data/json/monsters/zed_electric.json | 2 +- data/json/monsters/zed_explosive.json | 2 +- data/json/monsters/zed_misc.json | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/data/json/monsters/fungus.json b/data/json/monsters/fungus.json index bd34d04377d9d..d398ac550bc0b 100644 --- a/data/json/monsters/fungus.json +++ b/data/json/monsters/fungus.json @@ -363,7 +363,7 @@ "vision_day": 5, "vision_night": 5, "harvest": "exempt", - "emit_fields": [ [ "emit_fungal_leak", "1 s" ] ], + "emit_fields": [ "emit_fungal_leak" ], "special_attacks": [ [ "SUICIDE", 20 ], [ "scratch", 15 ] ], "death_drops": "default_zombie_items", "death_function": [ "FUNGALBURST" ], @@ -397,7 +397,7 @@ "vision_day": 5, "vision_night": 3, "harvest": "zombie", - "emit_fields": [ [ "emit_fungal_haze_plume", "1 s" ] ], + "emit_fields": [ "emit_fungal_haze_plume" ], "special_attacks": [ { "type": "bite", "cooldown": 5 }, [ "scratch", 15 ] ], "death_function": [ "FUNGUS" ], "flags": [ "SEES", "STUMBLES", "WARM", "BASHES", "GROUP_BASH", "POISON", "HARDTOSHOOT", "NO_BREATHE", "PUSH_MON", "FILTHY" ] diff --git a/data/json/monsters/nether.json b/data/json/monsters/nether.json index 4aeeccfa0fafe..0cfb6a8c256e2 100644 --- a/data/json/monsters/nether.json +++ b/data/json/monsters/nether.json @@ -483,7 +483,7 @@ "vision_night": 50, "harvest": "exempt", "special_attacks": [ [ "TINDALOS_TELEPORT", 5 ] ], - "emit_fields": [ [ "emit_tindalos_gas_leak", "1 s" ] ], + "emit_fields": [ "emit_tindalos_gas_leak" ], "path_settings": { "max_dist": 10 }, "death_function": [ "MELT" ], "flags": [ @@ -526,7 +526,7 @@ "vision_night": 50, "harvest": "exempt", "special_attacks": [ [ "TINDALOS_TELEPORT", 5 ], [ "DISAPPEAR", 25 ] ], - "emit_fields": [ [ "emit_tindalos_gas_leak", "1 s" ] ], + "emit_fields": [ "emit_tindalos_gas_leak" ], "path_settings": { "max_dist": 10 }, "death_function": [ "MELT" ], "flags": [ diff --git a/data/json/monsters/zed_electric.json b/data/json/monsters/zed_electric.json index 34a21f5574b43..d18d60ce96ae8 100644 --- a/data/json/monsters/zed_electric.json +++ b/data/json/monsters/zed_electric.json @@ -120,7 +120,7 @@ "vision_night": 3, "luminance": 16, "harvest": "CBM_SUBS", - "emit_fields": [ [ "emit_shock_cloud", "1 s" ] ], + "emit_fields": [ "emit_shock_cloud" ], "special_when_hit": [ "ZAPBACK", 75 ], "death_drops": "default_zombie_death_drops", "death_function": [ "NORMAL" ], diff --git a/data/json/monsters/zed_explosive.json b/data/json/monsters/zed_explosive.json index b8367a1ffe8be..11750b3a20aa4 100644 --- a/data/json/monsters/zed_explosive.json +++ b/data/json/monsters/zed_explosive.json @@ -157,7 +157,7 @@ "melee_cut": 0, "vision_night": 3, "harvest": "exempt", - "emit_fields": [ [ "emit_toxic_leak", "1 s" ] ], + "emit_fields": [ "emit_toxic_leak" ], "special_attacks": [ [ "SUICIDE", 20 ], [ "scratch", 15 ] ], "death_drops": "default_zombie_items", "death_function": [ "GAS" ], diff --git a/data/json/monsters/zed_misc.json b/data/json/monsters/zed_misc.json index 1546b7996728e..67a8f5493cc88 100644 --- a/data/json/monsters/zed_misc.json +++ b/data/json/monsters/zed_misc.json @@ -1017,7 +1017,7 @@ "vision_day": 50, "vision_night": 3, "harvest": "exempt", - "emit_fields": [ [ "emit_smoke_stream", "1 s" ] ], + "emit_fields": [ "emit_smoke_stream" ], "special_attacks": [ { "type": "bite", "cooldown": 5 }, [ "scratch", 15 ] ], "death_function": [ "SMOKEBURST" ], "flags": [ From e2ed107d00d88bfefb62c82e6003a6a6f29d1369 Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Sat, 22 Feb 2020 13:32:22 +0100 Subject: [PATCH 11/16] Revert "read_from_json_string overload to use string directly instead of JsonIn" This reverts commit e5139bf03a8df87158a2adb7752068180270f36e. --- src/units.h | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) diff --git a/src/units.h b/src/units.h index 53f0266e18af2..8a049464ec7e3 100644 --- a/src/units.h +++ b/src/units.h @@ -720,56 +720,6 @@ T read_from_json_string( JsonIn &jsin, const std::vector -T read_from_json_string( std::string string, const std::vector> &units ) -{ - size_t i = 0; - // returns whether we are at the end of the string - const auto skip_spaces = [&]() { - while( i < string.size() && string[i] == ' ' ) { - ++i; - } - return i >= string.size(); - }; - const auto get_unit = [&]() { - if( skip_spaces() ) { - debugmsg( "invalid quantity string: missing unit" ); - } - for( const auto &pair : units ) { - const std::string &unit = pair.first; - if( string.size() >= unit.size() + i && string.compare( i, unit.size(), unit ) == 0 ) { - i += unit.size(); - return pair.second; - } - } - debugmsg( "invalid quantity string: unknown unit" ); - // above always throws - throw; - }; - - if( skip_spaces() ) { - debugmsg( "invalid quantity string: empty string" ); - } - T result{}; - do { - int sign_value = +1; - if( string[i] == '-' ) { - sign_value = -1; - ++i; - } else if( string[i] == '+' ) { - ++i; - } - if( i >= string.size() || !isdigit( string[i] ) ) { - debugmsg( "invalid quantity string: number expected" ); - } - int value = 0; - for( ; i < string.size() && isdigit( string[i] ); ++i ) { - value = value * 10 + ( string[i] - '0' ); - } - result += sign_value * value * get_unit(); - } while( !skip_spaces() ); - return result; -} template void dump_to_json_string( T t, JsonOut &jsout, From a61599f34e097f9a4eca034c44facd5ef993a629 Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Sat, 22 Feb 2020 13:43:34 +0100 Subject: [PATCH 12/16] emits_field is an array of objects, loading is backward compatible --- src/monstergenerator.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/monstergenerator.cpp b/src/monstergenerator.cpp index 1b6591e568568..5cd694947ee3f 100644 --- a/src/monstergenerator.cpp +++ b/src/monstergenerator.cpp @@ -760,9 +760,19 @@ void mtype::load( const JsonObject &jo, const std::string &src ) dies.push_back( mdeath::normal ); } - for( JsonArray ja : jo.get_array( "emit_fields" ) ) { - emit_fields.emplace( ja.get_string( 0 ), read_from_json_string( ja.get_string( 1 ), - time_duration::units ) ); + if( jo.has_array( "emit_fields" ) ) { + JsonArray jar = jo.get_array( "emit_fields" ); + if( jar.has_string( 0 ) ) { + for( const std::string id : jar ) { + emit_fields.emplace( emit_id( id ), 1_seconds ); + } + } else { + while( jar.has_more() ) { + JsonObject obj = jar.next_object(); + emit_fields.emplace( emit_id( obj.get_string( "emit_id" ) ), + read_from_json_string( *obj.get_raw( "delay" ), time_duration::units ) ); + } + } } if( jo.has_member( "special_when_hit" ) ) { From 1e9cbc259e8cd28d14b02b63097a10f08569132c Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Sat, 22 Feb 2020 13:44:16 +0100 Subject: [PATCH 13/16] update doc --- doc/MONSTERS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/MONSTERS.md b/doc/MONSTERS.md index 0ef709e621669..54c725f0ee0bd 100644 --- a/doc/MONSTERS.md +++ b/doc/MONSTERS.md @@ -235,7 +235,8 @@ An item group that is used to spawn items when the monster dies. This can be an How the monster behaves on death. See JSON_FLAGS.md for a list of possible functions. One can add or remove entries in mods via "add:death_function" and "remove:death_function". ## "emit_field" -(array of arrays of emit_id and time_duration, optional) +(array of objects of emit_id and time_duration, optional) +"emit_fields": [ { "emit_id": "emit_gum_web", "delay": "30 m" } ], What field the monster emits and how often it does so. Time duration can use strings: "1 h", "60 m", "3600 s" etc... From cb7124e45abce255cfa89b594ab5c41e9ed14d38 Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Sat, 22 Feb 2020 13:44:32 +0100 Subject: [PATCH 14/16] rebalance gum spider --- data/mods/My_Sweet_Cataclysm/sweet_monsters.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/mods/My_Sweet_Cataclysm/sweet_monsters.json b/data/mods/My_Sweet_Cataclysm/sweet_monsters.json index 8944738e73cf7..b1e66b30d73e8 100644 --- a/data/mods/My_Sweet_Cataclysm/sweet_monsters.json +++ b/data/mods/My_Sweet_Cataclysm/sweet_monsters.json @@ -369,7 +369,7 @@ "vision_day": 5, "vision_night": 5, "harvest": "gum_spider", - "emit_fields": [ [ "emit_gum_web", "30 m" ] ], + "emit_fields": [ { "emit_id": "emit_gum_web", "delay": "30 m" } ], "death_function": [ "NORMAL" ], "flags": [ "SEES", "SMELLS", "HEARS", "CLIMBS", "PATH_AVOID_FIRE", "PATH_AVOID_FALL" ], "reproduction": { "baby_egg": "gum", "baby_count": 10, "baby_timer": 5 } From ca0d4f72fd9182ff8876522e3edfaae13676f7e0 Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Sat, 22 Feb 2020 13:57:39 +0100 Subject: [PATCH 15/16] update jsons --- data/json/monsters/fungus.json | 4 ++-- data/json/monsters/nether.json | 4 ++-- data/json/monsters/zed_electric.json | 2 +- data/json/monsters/zed_explosive.json | 2 +- data/json/monsters/zed_misc.json | 2 +- data/mods/CrazyCataclysm/crazy_monsters.json | 2 +- data/mods/Magiclysm/monsters/dragon.json | 2 +- .../Modular_Turrets/monster_override.json | 2 +- data/mods/Salvaged_Robots/monsters.json | 20 +++++++++---------- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/data/json/monsters/fungus.json b/data/json/monsters/fungus.json index d398ac550bc0b..7159a2eb35361 100644 --- a/data/json/monsters/fungus.json +++ b/data/json/monsters/fungus.json @@ -363,7 +363,7 @@ "vision_day": 5, "vision_night": 5, "harvest": "exempt", - "emit_fields": [ "emit_fungal_leak" ], + "emit_fields": [ { "emit_id": "emit_fungal_leak", "delay": "1 s" } ], "special_attacks": [ [ "SUICIDE", 20 ], [ "scratch", 15 ] ], "death_drops": "default_zombie_items", "death_function": [ "FUNGALBURST" ], @@ -397,7 +397,7 @@ "vision_day": 5, "vision_night": 3, "harvest": "zombie", - "emit_fields": [ "emit_fungal_haze_plume" ], + "emit_fields": [ { "emit_id": "emit_fungal_haze_plume", "delay": "1 s" } ], "special_attacks": [ { "type": "bite", "cooldown": 5 }, [ "scratch", 15 ] ], "death_function": [ "FUNGUS" ], "flags": [ "SEES", "STUMBLES", "WARM", "BASHES", "GROUP_BASH", "POISON", "HARDTOSHOOT", "NO_BREATHE", "PUSH_MON", "FILTHY" ] diff --git a/data/json/monsters/nether.json b/data/json/monsters/nether.json index 0cfb6a8c256e2..66e84b39199c6 100644 --- a/data/json/monsters/nether.json +++ b/data/json/monsters/nether.json @@ -483,7 +483,7 @@ "vision_night": 50, "harvest": "exempt", "special_attacks": [ [ "TINDALOS_TELEPORT", 5 ] ], - "emit_fields": [ "emit_tindalos_gas_leak" ], + "emit_fields": [ { "emit_id": "emit_tindalos_gas_leak", "delay": "1 s" } ], "path_settings": { "max_dist": 10 }, "death_function": [ "MELT" ], "flags": [ @@ -526,7 +526,7 @@ "vision_night": 50, "harvest": "exempt", "special_attacks": [ [ "TINDALOS_TELEPORT", 5 ], [ "DISAPPEAR", 25 ] ], - "emit_fields": [ "emit_tindalos_gas_leak" ], + "emit_fields": [ { "emit_id": "emit_tindalos_gas_leak", "delay": "1 s" } ], "path_settings": { "max_dist": 10 }, "death_function": [ "MELT" ], "flags": [ diff --git a/data/json/monsters/zed_electric.json b/data/json/monsters/zed_electric.json index d18d60ce96ae8..55894aad0f20e 100644 --- a/data/json/monsters/zed_electric.json +++ b/data/json/monsters/zed_electric.json @@ -120,7 +120,7 @@ "vision_night": 3, "luminance": 16, "harvest": "CBM_SUBS", - "emit_fields": [ "emit_shock_cloud" ], + "emit_fields": [ { "emit_id": "emit_shock_cloud", "delay": "1 s" } ], "special_when_hit": [ "ZAPBACK", 75 ], "death_drops": "default_zombie_death_drops", "death_function": [ "NORMAL" ], diff --git a/data/json/monsters/zed_explosive.json b/data/json/monsters/zed_explosive.json index 11750b3a20aa4..f77a004ea5bd5 100644 --- a/data/json/monsters/zed_explosive.json +++ b/data/json/monsters/zed_explosive.json @@ -157,7 +157,7 @@ "melee_cut": 0, "vision_night": 3, "harvest": "exempt", - "emit_fields": [ "emit_toxic_leak" ], + "emit_fields": [ { "emit_id": "emit_toxic_leak", "delay": "1 s" } ], "special_attacks": [ [ "SUICIDE", 20 ], [ "scratch", 15 ] ], "death_drops": "default_zombie_items", "death_function": [ "GAS" ], diff --git a/data/json/monsters/zed_misc.json b/data/json/monsters/zed_misc.json index 67a8f5493cc88..25de114cd86bb 100644 --- a/data/json/monsters/zed_misc.json +++ b/data/json/monsters/zed_misc.json @@ -1017,7 +1017,7 @@ "vision_day": 50, "vision_night": 3, "harvest": "exempt", - "emit_fields": [ "emit_smoke_stream" ], + "emit_fields": [ { "emit_id": "emit_smoke_stream", "delay": "1 s" } ], "special_attacks": [ { "type": "bite", "cooldown": 5 }, [ "scratch", 15 ] ], "death_function": [ "SMOKEBURST" ], "flags": [ diff --git a/data/mods/CrazyCataclysm/crazy_monsters.json b/data/mods/CrazyCataclysm/crazy_monsters.json index f3d87a6d0a7d1..455fa6fd3647e 100644 --- a/data/mods/CrazyCataclysm/crazy_monsters.json +++ b/data/mods/CrazyCataclysm/crazy_monsters.json @@ -98,7 +98,7 @@ "armor_cut": 4, "vision_day": 30, "vision_night": 10, - "emit_fields": [ "emit_smoke_stream" ], + "emit_fields": [ { "emit_id": "emit_smoke_stream", "delay": "1 s" } ], "special_attacks": [ { "type": "bite", "cooldown": 5 } ], "anger_triggers": [ "HURT", "PLAYER_CLOSE" ], "placate_triggers": [ "MEAT" ], diff --git a/data/mods/Magiclysm/monsters/dragon.json b/data/mods/Magiclysm/monsters/dragon.json index 491d65f515bef..351bcde817762 100644 --- a/data/mods/Magiclysm/monsters/dragon.json +++ b/data/mods/Magiclysm/monsters/dragon.json @@ -155,7 +155,7 @@ "//": "Large means powerful, but it does not mean fast.", "speed": 100, "delete": { "flags": [ "PATH_AVOID_DANGER_2" ] }, - "emit_fields": [ "emit_dragon_adult_fright" ], + "emit_fields": [ { "emit_id": "emit_dragon_adult_fright", "delay": "1 s" } ], "special_attacks": [ { "type": "bite", "cooldown": 10 }, [ "scratch", 3 ], diff --git a/data/mods/Modular_Turrets/monster_override.json b/data/mods/Modular_Turrets/monster_override.json index 229fe875507a2..96658ff66b73a 100644 --- a/data/mods/Modular_Turrets/monster_override.json +++ b/data/mods/Modular_Turrets/monster_override.json @@ -170,7 +170,7 @@ "copy-from": "mon_defbot_base", "name": "riotcontrol robot", "description": "An automated defense robot still active due to its internal power source. This one is equipped with an electric prod, tear gas sprayer, and integrated 40mm beanbag launcher.", - "emit_fields": [ "emit_tear_gas_pulse" ], + "emit_fields": [ { "emit_id": "emit_tear_gas_pulse", "delay": "1 s" } ], "melee_damage": [ { "damage_type": "electric", "amount": 6 } ], "starting_ammo": { "40x46mm_m1006": 100 }, "special_attacks": [ diff --git a/data/mods/Salvaged_Robots/monsters.json b/data/mods/Salvaged_Robots/monsters.json index 247708b5d115b..112510c8afc32 100644 --- a/data/mods/Salvaged_Robots/monsters.json +++ b/data/mods/Salvaged_Robots/monsters.json @@ -140,7 +140,7 @@ "morale": 10, "dodge": 8, "armor_cut": 4, - "emit_fields": [ "emit_sparks" ], + "emit_fields": [ { "emit_id": "emit_sparks", "delay": "1 s" } ], "revert_to_itype": "bot_distract_hack", "death_function": [ "MELT" ], "special_attacks": [ [ "PARROT", 0 ] ], @@ -160,7 +160,7 @@ "aggression": 10, "morale": 0, "dodge": 4, - "emit_fields": [ "emit_fire_plume" ], + "emit_fields": [ { "emit_id": "emit_fire_plume", "delay": "1 s" } ], "death_function": [ "MELT" ], "extend": { "flags": [ "STUMBLES", "HARDTOSHOOT", "PET_WONT_FOLLOW", "FIREY" ] } }, @@ -243,7 +243,7 @@ "description": "A salvaged eyebot repurposed into a floating space heater. It emits a constant jet of warm air to heat an enclosed space.", "revert_to_itype": "bot_eyebot_heater", "fear_triggers": [ "HURT" ], - "emit_fields": [ "emit_hot_air2_stream" ], + "emit_fields": [ { "emit_id": "emit_hot_air2_stream", "delay": "1 s" } ], "extend": { "flags": [ "PET_WONT_FOLLOW", "WARM" ] } }, { @@ -410,7 +410,7 @@ "morale": 10, "fear_triggers": [ "HURT" ], "revert_to_itype": "bot_utilibot_digester", - "emit_fields": [ "emit_acid_trail" ], + "emit_fields": [ { "emit_id": "emit_acid_trail", "delay": "1 s" } ], "extend": { "flags": [ "STUMBLES", "ABSORBS", "ACIDPROOF" ] } }, { @@ -533,7 +533,7 @@ "description": "A salvaged medibot stuffed with marijuana, covered in multicolored blinking lights, and programmed to dance. Why on Earth would you build this crazy thing?", "color": "yellow", "luminance": 100, - "emit_fields": [ "emit_weed_puff" ], + "emit_fields": [ { "emit_id": "emit_weed_puff", "delay": "1 s" } ], "melee_skill": 4, "melee_dice": 2, "melee_dice_sides": 4, @@ -1205,7 +1205,7 @@ "vision_day": 20, "revert_to_itype": "bot_defbot_samurai", "special_when_hit": [ "ZAPBACK", 5 ], - "emit_fields": [ "emit_electric_arcs" ], + "emit_fields": [ { "emit_id": "emit_electric_arcs", "delay": "1 s" } ], "extend": { "flags": [ "ELECTRIC" ] } }, { @@ -1229,7 +1229,7 @@ "dodge": 3, "vision_day": 50, "revert_to_itype": "bot_defbot_paladin", - "emit_fields": [ "emit_smoke_trail" ], + "emit_fields": [ { "emit_id": "emit_smoke_trail", "delay": "1 s" } ], "starting_ammo": { "gasoline": 1000 }, "special_attacks": [ [ "PARROT", 0 ], @@ -1368,7 +1368,7 @@ "luminance": 200, "armor_bash": 8, "revert_to_itype": "bot_advbot_glitter", - "emit_fields": [ "emit_dazzle_trail" ], + "emit_fields": [ { "emit_id": "emit_dazzle_trail", "delay": "1 s" } ], "special_attacks": [ { "type": "gun", @@ -1397,7 +1397,7 @@ "melee_damage": [ { "damage_type": "acid", "amount": 8 } ], "armor_bash": 8, "armor_cut": 8, - "emit_fields": [ "emit_acid_trail" ], + "emit_fields": [ { "emit_id": "emit_acid_trail", "delay": "1 s" } ], "special_when_hit": [ "ACIDSPLASH", 100 ], "special_attacks": [ [ "ACID_BARF", 10 ], @@ -1588,7 +1588,7 @@ "attack_effs": [ { "id": "downed", "chance": 20, "duration": 10 }, { "id": "irradiated", "chance": 50 } ], "vision_day": 20, "revert_to_itype": "bot_tankbot_sultan", - "emit_fields": [ "emit_nuclear_trail" ], + "emit_fields": [ { "emit_id": "emit_nuclear_trail", "delay": "1 s" } ], "special_attacks": [ [ "SMASH", 30 ], [ "GRAB", 20 ] ], "extend": { "flags": [ "STUMBLES", "GRABS" ] } } From 29e9df6b3b6b139f8387f7ee6cc1a2eab2c74251 Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Sat, 22 Feb 2020 15:34:45 +0100 Subject: [PATCH 16/16] temporary tag for legacy code --- src/monstergenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monstergenerator.cpp b/src/monstergenerator.cpp index 5cd694947ee3f..6206c3e7e1aba 100644 --- a/src/monstergenerator.cpp +++ b/src/monstergenerator.cpp @@ -762,7 +762,7 @@ void mtype::load( const JsonObject &jo, const std::string &src ) if( jo.has_array( "emit_fields" ) ) { JsonArray jar = jo.get_array( "emit_fields" ); - if( jar.has_string( 0 ) ) { + if( jar.has_string( 0 ) ) { // TEMPORARY until 0.F for( const std::string id : jar ) { emit_fields.emplace( emit_id( id ), 1_seconds ); }