From 3900957bf4394e569dcd737edcefe88e349c7212 Mon Sep 17 00:00:00 2001 From: misterprimus Date: Sun, 18 Aug 2019 20:08:29 -0400 Subject: [PATCH 1/4] fix frozen acid drops --- data/json/items/chemicals_and_resources.json | 1 + src/map.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/data/json/items/chemicals_and_resources.json b/data/json/items/chemicals_and_resources.json index 807544121d404..24d4e3cb12305 100644 --- a/data/json/items/chemicals_and_resources.json +++ b/data/json/items/chemicals_and_resources.json @@ -391,6 +391,7 @@ "phase": "liquid", "category": "chems", "fun": -45, + "freezing_point": 25, "drop_action": { "type": "emit_actor", "emits": [ "emit_acid_splash" ], "scale_qty": true } }, { diff --git a/src/map.cpp b/src/map.cpp index eb0fb09b6960a..2fe56c1910cc3 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -4287,10 +4287,12 @@ item &map::add_item_or_charges( const tripoint &pos, item obj, bool overflow ) if( ( !has_flag( "NOITEM", pos ) || ( has_flag( "LIQUIDCONT", pos ) && obj.made_of( LIQUID ) ) ) && valid_limits( pos ) ) { // Pass map into on_drop, because this map may not be the global map object (in mapgen, for instance). - if( obj.on_drop( pos, *this ) ) { - return null_item_reference(); - } + if( obj.made_of( LIQUID ) ) { + if( obj.on_drop( pos, *this ) ) { + return null_item_reference(); + } + } // If tile can contain items place here... return place_item( pos ); From 5f2e8accff2cf18f41e5010eb146d63991702961 Mon Sep 17 00:00:00 2001 From: misterprimus Date: Sun, 18 Aug 2019 20:09:03 -0400 Subject: [PATCH 2/4] Update chemicals_and_resources.json --- data/json/items/chemicals_and_resources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/json/items/chemicals_and_resources.json b/data/json/items/chemicals_and_resources.json index 24d4e3cb12305..05f03074eddc3 100644 --- a/data/json/items/chemicals_and_resources.json +++ b/data/json/items/chemicals_and_resources.json @@ -391,7 +391,7 @@ "phase": "liquid", "category": "chems", "fun": -45, - "freezing_point": 25, + "freezing_point": 25, "drop_action": { "type": "emit_actor", "emits": [ "emit_acid_splash" ], "scale_qty": true } }, { From e2caa06219b294fb0b327ea543af6ba00d8d068d Mon Sep 17 00:00:00 2001 From: misterprimus Date: Sun, 18 Aug 2019 21:06:42 -0400 Subject: [PATCH 3/4] improve code for other situations --- data/json/items/chemicals_and_resources.json | 4 +++- src/map.cpp | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/data/json/items/chemicals_and_resources.json b/data/json/items/chemicals_and_resources.json index 05f03074eddc3..0236944416a41 100644 --- a/data/json/items/chemicals_and_resources.json +++ b/data/json/items/chemicals_and_resources.json @@ -378,7 +378,7 @@ "name_plural": "concentrated acid", "weight": 250, "color": "green", - "flags": [ "ACID" ], + "flags": [ "ACID", "DROP_ACTION_ONLY_IF_LIQUID" ], "use_action": "BLECH", "container": "jug_plastic", "comestible_type": "DRINK", @@ -459,6 +459,7 @@ "name_plural": "sulfuric acid", "symbol": "=", "color": "white", + "flags": [ "DROP_ACTION_ONLY_IF_LIQUID" ], "description": "Sulfuric acid: viscous, foul-smelling and extremely corrosive, particularly to organic matter and evil clowns. Although used to prepare a number of chemicals, it is mostly known as battery acid, due to its widest commercial application.", "volume": 1, "weight": 460, @@ -495,6 +496,7 @@ "name_plural": "nitric acid", "symbol": "=", "color": "white", + "flags": [ "DROP_ACTION_ONLY_IF_LIQUID" ], "description": "Nitric acid, a strong oxidant and extremely corrosive material. Mainly used in the production of synthetic fertilizers, for etching of circuit boards and in woodworking. Remains quite useful both for making a vast array of pyrotechnic and explosive agents and as a direct weapon: not many beings enjoy being doused in nitric acid.", "volume": 1, "weight": 375, diff --git a/src/map.cpp b/src/map.cpp index 2fe56c1910cc3..d6e77a115e2d5 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -4287,7 +4287,7 @@ item &map::add_item_or_charges( const tripoint &pos, item obj, bool overflow ) if( ( !has_flag( "NOITEM", pos ) || ( has_flag( "LIQUIDCONT", pos ) && obj.made_of( LIQUID ) ) ) && valid_limits( pos ) ) { // Pass map into on_drop, because this map may not be the global map object (in mapgen, for instance). - if( obj.made_of( LIQUID ) ) { + if( obj.made_of( LIQUID ) || !obj.has_flag( "DROP_ACTION_ONLY_IF_LIQUID" ) ) { if( obj.on_drop( pos, *this ) ) { return null_item_reference(); } @@ -4304,9 +4304,10 @@ item &map::add_item_or_charges( const tripoint &pos, item obj, bool overflow ) if( !inbounds( e ) ) { continue; } - - if( obj.on_drop( e, *this ) ) { - return null_item_reference(); + if( obj.made_of( LIQUID ) || !obj.has_flag( "DROP_ACTION_ONLY_IF_LIQUID" ) ) { + if( obj.on_drop( e, *this ) ) { + return null_item_reference(); + } } if( !valid_tile( e ) || !valid_limits( e ) || From aee2c872bb1819b4c7d31c3ad1384d25cdbf0275 Mon Sep 17 00:00:00 2001 From: misterprimus Date: Sun, 18 Aug 2019 22:15:25 -0400 Subject: [PATCH 4/4] Update chemicals_and_resources.json --- data/json/items/chemicals_and_resources.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/json/items/chemicals_and_resources.json b/data/json/items/chemicals_and_resources.json index 0236944416a41..19f496552cfa5 100644 --- a/data/json/items/chemicals_and_resources.json +++ b/data/json/items/chemicals_and_resources.json @@ -391,7 +391,7 @@ "phase": "liquid", "category": "chems", "fun": -45, - "freezing_point": 25, + "freezing_point": 25, "drop_action": { "type": "emit_actor", "emits": [ "emit_acid_splash" ], "scale_qty": true } }, { @@ -468,6 +468,7 @@ "charges": 2, "phase": "liquid", "container": "bottle_glass", + "freezing_point": 25, "drop_action": { "type": "emit_actor", "emits": [ "emit_acid_drop" ], "scale_qty": true } }, { @@ -505,6 +506,7 @@ "charges": 2, "phase": "liquid", "container": "bottle_glass", + "freezing_point": -44, "drop_action": { "type": "emit_actor", "emits": [ "emit_acid_drop" ], "scale_qty": true } }, {