CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
9.74k stars 4.05k forks source link

Cutting up items produces weird results #7508

Closed Wuzzy2 closed 9 years ago

Wuzzy2 commented 10 years ago

This is more like a meta-bug report.

When you cut up some uncommon items for cutting up, you often get very weird results.

I guess currently cutting up simply works by taking the materials of an item into account. If the item has ANY of the materials plastic, fabric, kevlar or wood (possibly others?), it is possible to cut it up.

This produces some very unexpected and weird results: Shotguns can be cut up into skewers. If you cut up guns with mods, you lose all the mods. If you cut up a gun with ammo, you lose the ammo as well. I’d say just because a gun has SOME plastic does not mean it should be possible to cut it up at all.

Items which are made of two materials which would both be applicable for cutting up, you end up with only one kind of item, the other material is simply discarded. If, for example, an item is made of plastic and fabric, you’ll receive either rags or plastic chunks, but not both.

MBR vests are very messed up. I once managed to cut up a MBR vest (kevlar plates) into 20 kevlar plates! But only 8 kevlar plates fit into an empty MBR vest.

And here, the most hilarious message: “You cut the mininuke (active) into 3 plastic chunks.”

These are all just examples. I bet there are many other crazy cutting up results.

There are related issues, they are all part of the same problem:

All these examples show me that something is deeply flawed with the current design of cutting up and it needs to be rethought. Any ideas?

vache commented 10 years ago

Making the "cut" action perform more like destructive disassembly seems like the way to go with it.

kevingranade commented 10 years ago

For a quick fix to some of the cases, it could check if the item has a disassembly recipe and apply that, but of course not everything has one. Probably 'cut up' should only apply to items composed of one eligible material, or possibly to items with a primary eligible material, need to look at a list of those categories to see which one makes more sense. Should be pretty simple to generate a list of items in each of these buckets.

vache commented 10 years ago

Maybe we could implement a "size" value to cuttable items that determines how much of their materials get returned, and could further be used for fitting/making clothing mutant compatible. There would have to be some way to reconcile (automatically?) the required materials with the cutting materials for craftable items as well.

Rivet-the-Zombie commented 10 years ago

Maybe we could implement a "size" value to cuttable items that determines how much of their materials get returned

The current system uses the item's volume for this.

EkarusRyndren commented 10 years ago

the Kevlar MBR is made of Kevlar and has Kevlar "plates" in it. if I remember correctly the current system uses it's "size" volume to determine how much "stuff" you get.

jeremyosborne commented 9 years ago

I'm looking at this right now. There's code in a few different places right now that all do relatively the same thing, and also do some things differently. Probably won't be a quick or glamorous fix, but good for giving me some practice and I'm willing to give it a shot.

tl;dr First question: what are people's thoughts on streamlining the keystrokes of the current disassembly routines? It seems like it's starting to happen with the overloading of the butcher command that I've been noticing.

tl;

The hardest part of Cataclysm for me to figure out was the keystrokes needed to do what I saw people talk about on the forums and wiki in simple word phrases (cauterize, cut up, etc.). There are put-things-together mechanics in the game that I've grown to understand are separate: crafting items (item construction), car construction+destruction, and outpost construction+destruction. Those menus are fine.

What would people think about the disassembly code/action encompassing more?

A test I just did to make sure I wasn't remembering things wrong:

Here's my question: as far as I know most items can only be disassembled into one thing or one set of things. Is there any reason the veterans know that the above, which doesn't work through disassembly, couldn't/shouldn't be piped through the disassembly code vs. sending through iuse::cute, iuse::knife, etc?

KA101 commented 9 years ago

I think disassembly generally requires that you have a recipe to list the required outputs; BevapDin's done some work on that IIRC but we still need recipes for bots, etc.

jeremyosborne commented 9 years ago

@KA101 what I'm thinking of is moving the stuff that would cause a failure in the disassembly code in game.cpp that exists elsewhere (iuse:cut... this time I spelled it right, and iuse::knife for starters) to the disassembly fail positions. I'm thinking of

I'm trying to confine this to what is a disassemble vs. when tools are used to transform. The knife would/could still carve things, and would still offer the option to cut (at least for now), as well as cauterize (not sure where that could go other than where it's at).

KA101 commented 9 years ago

OK, I misread. Apologies. Not really sure about that aspect of things.

BevapDin commented 9 years ago

Disassembling uses the crafting recipes, cutting things into pieces uses iuse functions.

Regarding the cut logs into skewers: that is an iuse function and works like the cutting up plastic/cloth with a knife - if the item material is leather, you get leather patches, if it's wood, you get skewers. (There was the bug where you could cut up a rope into skewers as the rope had the material wood.) This is not disassembling. It uses a different system. It always results in items of one type (some leather patches or some skewers or some rags or ...), only different amount.

Disassembling uses a crafting recipe (one that has the reversible property and the result item type must match the item to be disassembled). One can get different items out of this and it can require different tools. See the go bag, it disassembles into a bunch of items, but you could also cut it up to get rags.

I think those two actions should be clearly separated. I don't want to accidentally cut my go bag into rags instead of disassembling it into all the useful items.

jeremyosborne commented 9 years ago

Thanks @BevapDin. I was trying to find an example that met the criteria for needing the two different functions, but didn't have one before the go-bag (and I'm sure there are others).

Let me see if we can prevent some of the weirdest behavior first with the iuse functions. Cutting a mininuke into plastic chunks (and eyebots and robocops into single plastic chunks) is what this issue was getting at.

kevingranade commented 9 years ago

I could definitely see merging the trigger for the two, but only falling back to cutting if there's no dissasembly recipe. In fact, I think ditching the knife iuse and turning it into a generic disassembly recipe would be an improvement. I'd be sympathetic to arguments that applying a cutting tool should still be possible though.

Zireael07 commented 9 years ago

I say yes to merging the keypress/trigger.

jeremyosborne commented 9 years ago

Would anyone object to me making the scissors act like a knife for all intents and purposes while I'm fixing this? (Slightly off topic, but since I'm cleaning up code, and the iuse::scissors is staring me in the face, and they share code, thought I'd ask.)

By the way, I'm still partial to logically merging the keypress/trigger, too, but this is going to be a [WIP] fix for few days at least.

kevingranade commented 9 years ago

The only thing that jumps out at me offhand is that iuse::knife probably allows inscription and iuse::scissors doesn't. Other than that the probably are the same.

bug-sniper commented 9 years ago

In the meanwhile, in case someone reading this hasn't realized it, accidental butchering or slicing is a perfect excuse to throw away the resulting chunks and wish for a replacement. Otherwise, it won't be fun to never see another hammer in your game.

kevingranade commented 9 years ago

Woo #7805!