Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exosuit features no longer work #59657

Closed
Drew4484 opened this issue Jul 27, 2022 · 18 comments
Closed

Exosuit features no longer work #59657

Drew4484 opened this issue Jul 27, 2022 · 18 comments
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Monsters Monsters both friendly and unfriendly. (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@Drew4484
Copy link
Contributor

Describe the bug

Something in the last few weeks broke most of the exosuit functionality. Flags and relic passive effects no longer work when activated. Transforms still work.

Steps to reproduce

  1. Spawn an exosuit frame and power supply.
  2. Activate exosuit.
  3. Note that exosuit is active as vision is no longer obstructed.
  4. Check player stats, +10 strength bonus is not visible.
  5. Notice you are freezing to death as the climate control is not functioning.

Also impacts modules like the small and large load support modules, which can be reproduced easily.

Expected behavior

Activating a module or the frame itself should provide passive bonus effects.

Screenshots

No response

Versions and configuration

  • OS: Windows
    • OS Version: 10.0.19044.1826 (21H2)
  • Game Version: 2fbf47c [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    No Fungal Growth [no_fungal_growth],
    Bionic Professions [package_bionic_professions],
    Aftershock [aftershock],
    Aftershock: Exoplanet [aftershock_exoplanet]
    ]

Additional context

Also happens on non-exoplanet worlds, see below

  • OS: Windows
    • OS Version: 10.0.19044.1826 (21H2)
  • Game Version: 2fbf47c [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    No Fungal Growth [no_fungal_growth],
    Aftershock [aftershock]
    ]
@Drew4484 Drew4484 added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label Jul 27, 2022
@Drew4484
Copy link
Contributor Author

Drew4484 commented Aug 1, 2022

Confirmed by @irwiss and @Merikona

@Drew4484 Drew4484 added (S2 - Confirmed) Bug that's been confirmed to exist and removed (S1 - Need confirmation) Report waiting on confirmation of reproducibility labels Aug 1, 2022
@Drew4484
Copy link
Contributor Author

First noticed the issue while working on #58670, so approximately 06/24/2022 for a start date.

@Maleclypse
Copy link
Member

I can't make it work on Cataclysm-DDA experimental build 2022-05-02-2346 and I tested with saving and reloading to see if it required a reload like some errors do occasionally.

@Maleclypse
Copy link
Member

irwiss — Today at 6:19 AM
think there's already inherit: false for flags... btw flags is also at least part of the reason for the missing STR bonus that's tracked in the 0.G stable tracker - IS_UPS makes item processing branch into process_UPS where it's trying to look up a CABLE_SPOOL and when it doesn't find one it sets active=false on exosuit (silently, and not calling deactivate() so exosuit doesn't revert to non-powered in inventory) so the enchantment doesn't work

From the discord this morning

@I-am-Erk
Copy link
Member

What is the status on this one? I see some related PRs, are these still broken?

@I-am-Erk I-am-Erk mentioned this issue Nov 24, 2022
12 tasks
@Drew4484
Copy link
Contributor Author

What is the status on this one? I see some related PRs, are these still broken?

I need to sit down and do an item by item check tonight, I'll update or close this as appropriate.

@Jordanb716
Copy link

Jordanb716 commented Nov 24, 2022

Part of this reported in #58836, so if fixed that can be closed as well.
Edit: #58836 is a vanilla issue, still might be related though?

@GuardianDll
Copy link
Member

and also #61701

@LyleSY
Copy link
Contributor

LyleSY commented Nov 25, 2022

I can't replicate this in vanilla, I see no monster or item called "exosuit"

@Drew4484
Copy link
Contributor Author

I can't replicate this in vanilla, I see no monster or item called "exosuit"

These are Aftershock items.

@LyleSY
Copy link
Contributor

LyleSY commented Nov 25, 2022

I tried this with an X-02: 'Grunt' Combat Mech in vanilla. There I saw no strength boost and no protection from cold.

@LyleSY LyleSY added Monsters Monsters both friendly and unfriendly. [C++] Changes (can be) made in C++. Previously named `Code` labels Nov 25, 2022
@I-am-Erk
Copy link
Member

Ok. This one probably does need fixing for stable unfortunately. I'll see if I can find some time to pin it down tonight somehow

@andrei8l
Copy link
Contributor

Isn't this working correctly? I'm getting the strength bonus and some warmth after activating the frame

Screencast.from.2022-11-28.07-45-55.webm

@andrei8l
Copy link
Contributor

I tried this with an X-02: 'Grunt' Combat Mech in vanilla. There I saw no strength boost and no protection from cold.

From looking briefly at the code, the vanilla mech_str_bonus only improves carry weight and throw ability rather than add raw stat and I can verify that it still works.

@Drew4484
Copy link
Contributor Author

Drew4484 commented Nov 28, 2022

The majority of the features seem to be working now. I ran out of time to finish testing tonight but tomorrow I can test the rest and see if I can identify the issues with the non-functional ones.

Tested successfully:

  • Frame powers on.
  • Pilot can see and receives strength bonus while frame is active.
  • Underlayer provides insulation (when worn, will remove underlayer slot from frame).
  • Power supply unit powers frame.
  • Jetpack allows movement laterally, horizontally, and in combination.
  • Structural imager provides clairvoyance cone.
  • Oxygen supply provides air as necessary while submerged.

Tested but not functioning:

  • Climbing module (does not allow climbing a single wall tile without assistance from furniture).
  • Load support modules (large and small) do not provide weight bonus.
  • AR module (error with power).

Not yet tested:

  • ICE generator
  • Turbine generator
  • ASRG
  • Quickdraw holster/sheath
  • Forcefields
  • Cartridge charger
  • Medical injector

@andrei8l
Copy link
Contributor

andrei8l commented Nov 28, 2022

These all appear to be different and unrelated issues:

  • Load support modules (large and small) do not provide weight bonus.

"has": "WORN" fails here.

Quick and dirty patch; it would be prettier if relic code used item_location
diff --git a/src/character.h b/src/character.h
index f21a1a2189..a20c4c6759 100644
--- a/src/character.h
+++ b/src/character.h
@@ -1676,6 +1676,10 @@ class Character : public Creature, public visitable
             return worn.is_worn( thing );
         }
 
+        bool is_worn_module( const item &thing ) const {
+            return worn.is_worn_module( thing );
+        }
+
         /**
          * Asks how to use the item (if it has more than one use_method) and uses it.
          * Returns true if it destroys the item. Consumes charges from the item.
diff --git a/src/character_attire.cpp b/src/character_attire.cpp
index 6156574d35..5daef15bfc 100644
--- a/src/character_attire.cpp
+++ b/src/character_attire.cpp
@@ -869,6 +869,15 @@ bool outfit::is_worn( const itype_id &clothing ) const
     return false;
 }
 
+bool outfit::is_worn_module( const item &thing ) const
+{
+    return thing.has_flag( flag_CANT_WEAR ) &&
+    std::any_of( worn.cbegin(), worn.cend(), [&thing]( item const & elem ) {
+        return elem.contained_where( thing ) != nullptr;
+    } );
+}
+
+
 bool outfit::is_wearing_on_bp( const itype_id &clothing, const bodypart_id &bp ) const
 {
     for( const item &i : worn ) {
diff --git a/src/character_attire.h b/src/character_attire.h
index 995ac105fc..e4b6db3d00 100644
--- a/src/character_attire.h
+++ b/src/character_attire.h
@@ -66,6 +66,7 @@ class outfit
         explicit outfit( const std::list<item> &items ) : worn( items ) {}
         bool is_worn( const item &clothing ) const;
         bool is_worn( const itype_id &clothing ) const;
+        bool is_worn_module( const item &thing ) const;
         bool is_wearing_on_bp( const itype_id &clothing, const bodypart_id &bp ) const;
         bool covered_with_flag( const flag_id &f, const body_part_set &parts ) const;
         bool wearing_something_on( const bodypart_id &bp ) const;
diff --git a/src/magic_enchantment.cpp b/src/magic_enchantment.cpp
index 78de807b4a..1673c102a9 100644
--- a/src/magic_enchantment.cpp
+++ b/src/magic_enchantment.cpp
@@ -216,7 +216,8 @@ bool enchantment::is_active( const Character &guy, const item &parent ) const
 
     if( !( active_conditions.first == has::HELD ||
            ( active_conditions.first == has::WIELD && guy.is_wielding( parent ) ) ||
-           ( active_conditions.first == has::WORN && guy.is_worn( parent ) ) ) ) {
+           ( active_conditions.first == has::WORN &&
+             ( guy.is_worn( parent ) || guy.is_worn_module( parent ) ) ) ) ) {
         return false;
     }
 
  • Climbing module (does not allow climbing a single wall tile without assistance from furniture).
The mutation flag should be in uppercase
diff --git a/data/mods/Aftershock/items/armor/exosuit/exosuit_mutations.json b/data/mods/Aftershock/items/armor/exosuit/exosuit_mutations.json
index 57a7aae2f3..9fec47e813 100644
--- a/data/mods/Aftershock/items/armor/exosuit/exosuit_mutations.json
+++ b/data/mods/Aftershock/items/armor/exosuit/exosuit_mutations.json
@@ -8,6 +8,6 @@
     "valid": false,
     "purifiable": false,
     "types": [ "Equipment" ],
-    "flags": "wall_cling"
+    "flags": "WALL_CLING"
   }
 ]

But the activation conditions aren't loaded properly for some reason

  • AR module (error with power).
This lets it turn on (and it also needs the worn patch from above)
diff --git a/data/mods/Aftershock/items/armor/exosuit/exosuit_modules.json b/data/mods/Aftershock/items/armor/exosuit/exosuit_modules.json
index c89f0f55df..b64eda056c 100644
--- a/data/mods/Aftershock/items/armor/exosuit/exosuit_modules.json
+++ b/data/mods/Aftershock/items/armor/exosuit/exosuit_modules.json
@@ -665,7 +665,7 @@
     "material": [ "lvl4ballisticglass", "qt_steel" ],
     "symbol": "(",
     "color": "yellow",
-    "flags": [ "CANT_WEAR", "EXO_HELMET_GADGET" ],
+    "flags": [ "CANT_WEAR", "EXO_HELMET_GADGET", "USE_UPS" ],
     "relic_data": {
       "passive_effects": [ { "has": "WORN", "condition": "ACTIVE", "values": [ { "value": "LEARNING_FOCUS", "add": 15 } ] } ]
     },
  • ICE generator
  • Turbine generator
  • ASRG
  • Medical injector

These work fine. Not sure how to test the other ones.

@Drew4484
Copy link
Contributor Author

These all appear to be different and unrelated issues:

  • Load support modules (large and small) do not provide weight bonus.

"has": "WORN" fails here.

Quick and dirty patch; it would be prettier if relic code used item_location
diff --git a/src/character.h b/src/character.h
index f21a1a2189..a20c4c6759 100644
--- a/src/character.h
+++ b/src/character.h
@@ -1676,6 +1676,10 @@ class Character : public Creature, public visitable
             return worn.is_worn( thing );
         }
 
+        bool is_worn_module( const item &thing ) const {
+            return worn.is_worn_module( thing );
+        }
+
         /**
          * Asks how to use the item (if it has more than one use_method) and uses it.
          * Returns true if it destroys the item. Consumes charges from the item.
diff --git a/src/character_attire.cpp b/src/character_attire.cpp
index 6156574d35..5daef15bfc 100644
--- a/src/character_attire.cpp
+++ b/src/character_attire.cpp
@@ -869,6 +869,15 @@ bool outfit::is_worn( const itype_id &clothing ) const
     return false;
 }
 
+bool outfit::is_worn_module( const item &thing ) const
+{
+    return thing.has_flag( flag_CANT_WEAR ) &&
+    std::any_of( worn.cbegin(), worn.cend(), [&thing]( item const & elem ) {
+        return elem.contained_where( thing ) != nullptr;
+    } );
+}
+
+
 bool outfit::is_wearing_on_bp( const itype_id &clothing, const bodypart_id &bp ) const
 {
     for( const item &i : worn ) {
diff --git a/src/character_attire.h b/src/character_attire.h
index 995ac105fc..e4b6db3d00 100644
--- a/src/character_attire.h
+++ b/src/character_attire.h
@@ -66,6 +66,7 @@ class outfit
         explicit outfit( const std::list<item> &items ) : worn( items ) {}
         bool is_worn( const item &clothing ) const;
         bool is_worn( const itype_id &clothing ) const;
+        bool is_worn_module( const item &thing ) const;
         bool is_wearing_on_bp( const itype_id &clothing, const bodypart_id &bp ) const;
         bool covered_with_flag( const flag_id &f, const body_part_set &parts ) const;
         bool wearing_something_on( const bodypart_id &bp ) const;
diff --git a/src/magic_enchantment.cpp b/src/magic_enchantment.cpp
index 78de807b4a..1673c102a9 100644
--- a/src/magic_enchantment.cpp
+++ b/src/magic_enchantment.cpp
@@ -216,7 +216,8 @@ bool enchantment::is_active( const Character &guy, const item &parent ) const
 
     if( !( active_conditions.first == has::HELD ||
            ( active_conditions.first == has::WIELD && guy.is_wielding( parent ) ) ||
-           ( active_conditions.first == has::WORN && guy.is_worn( parent ) ) ) ) {
+           ( active_conditions.first == has::WORN &&
+             ( guy.is_worn( parent ) || guy.is_worn_module( parent ) ) ) ) ) {
         return false;
     }
 
  • Climbing module (does not allow climbing a single wall tile without assistance from furniture).
The mutation flag should be in uppercase
diff --git a/data/mods/Aftershock/items/armor/exosuit/exosuit_mutations.json b/data/mods/Aftershock/items/armor/exosuit/exosuit_mutations.json
index 57a7aae2f3..9fec47e813 100644
--- a/data/mods/Aftershock/items/armor/exosuit/exosuit_mutations.json
+++ b/data/mods/Aftershock/items/armor/exosuit/exosuit_mutations.json
@@ -8,6 +8,6 @@
     "valid": false,
     "purifiable": false,
     "types": [ "Equipment" ],
-    "flags": "wall_cling"
+    "flags": "WALL_CLING"
   }
 ]

But the activation conditions aren't loaded properly for some reason

  • AR module (error with power).
This lets it turn on (and it also needs the worn patch from above)
diff --git a/data/mods/Aftershock/items/armor/exosuit/exosuit_modules.json b/data/mods/Aftershock/items/armor/exosuit/exosuit_modules.json
index c89f0f55df..b64eda056c 100644
--- a/data/mods/Aftershock/items/armor/exosuit/exosuit_modules.json
+++ b/data/mods/Aftershock/items/armor/exosuit/exosuit_modules.json
@@ -665,7 +665,7 @@
     "material": [ "lvl4ballisticglass", "qt_steel" ],
     "symbol": "(",
     "color": "yellow",
-    "flags": [ "CANT_WEAR", "EXO_HELMET_GADGET" ],
+    "flags": [ "CANT_WEAR", "EXO_HELMET_GADGET", "USE_UPS" ],
     "relic_data": {
       "passive_effects": [ { "has": "WORN", "condition": "ACTIVE", "values": [ { "value": "LEARNING_FOCUS", "add": 15 } ] } ]
     },
  • ICE generator
  • Turbine generator
  • ASRG
  • Medical injector

These work fine. Not sure how to test the other ones.

This is what I expected, I think the core issue can be closed at this point. Thanks for taking a look.

@Drew4484
Copy link
Contributor Author

Issue appears to be resolved, remaining exosuit modules to test or debug appear to be item based, not an issue with the core mechanic of worn items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Monsters Monsters both friendly and unfriendly. (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

No branches or pull requests

7 participants