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

Item name is not inherited with copy-from #78654

Open
Uwuewsky opened this issue Dec 19, 2024 · 1 comment
Open

Item name is not inherited with copy-from #78654

Uwuewsky opened this issue Dec 19, 2024 · 1 comment
Labels
<Suggestion / Discussion> Talk it out before implementing

Comments

@Uwuewsky
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Item names are not inherited, requiring this field to be copied manually. This can cause problems if the original name has changed.

For example, this one won't work:

{
"id": "shotgun_410",
"type": "GUN",
"copy-from": "shotgun_410",
"name": { "str": "Winchester M37 .410" },
"extend": { "flags": [ "OLD_GUN" ] }
},

  {
    "id": "shotgun_410",
    "type": "GUN",
    "copy-from": "shotgun_410",
-   "name": { "str": "Winchester M37 .410" },
    "extend": { "flags": [ "OLD_GUN" ] }
  },
 DEBUG    : Error: Json error: data/mods/BombasticPerks/perkdata/old_guns.json:239:5: <color_white><color_cyan>name unspecified for item type</color>
 FUNCTION : bool main_menu::new_character_tab()
 FILE     : src/main_menu.cpp
 LINE     : 1153
 VERSION  : cdda-experimental-2024-12-18-0250 c085521

Solution you would like.

Make it so that the name is also copied from the parent definition.

Describe alternatives you have considered.

No response

Additional context

Right now, for monsters, both name and description can be inherited:

{
"type": "MONSTER",
"id": "mon_tindalos",
"copy-from": "mon_tindalos",
"extend": { "flags": [ "STABILIZED_TIMELINE" ] }
},

For items only descriptions is inherited. I don't know if there is any reason for this restriction.
def.name = translation( translation::plural_tag() );
if( !jo.read( "name", def.name ) ) {
jo.throw_error( "name unspecified for item type" );
}
if( jo.has_member( "description" ) ) {
jo.read( "description", def.description );
}

@Uwuewsky Uwuewsky added the <Suggestion / Discussion> Talk it out before implementing label Dec 19, 2024
@Karol1223
Copy link
Contributor

Relevant: #71199 and #71195

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Suggestion / Discussion> Talk it out before implementing
Projects
None yet
Development

No branches or pull requests

2 participants