CombatExtended-Continued / CombatExtended

Combat Extended mod for RimWorld
379 stars 254 forks source link

[Discussion]: Power Cells, Fuel Tanks and other multi-shot ammo #376

Closed sumghai closed 3 years ago

sumghai commented 3 years ago

The following is a revival/continuation of an existing discussion that took place on the old CE repository.

CE ammo currently comes in the form of discrete cartridges, shells or rockets, which typically used by various historical and modern firearms used in the game. These items individually have fixed mass and bulk, which are decremented from a pawn's inventory as ammunition is consumed.

However, many sci-fi and exotic weapons should more appropriately use ammo items that hold multiple shots:

Ideally, CE should implement power cells and fuel tanks as individual ammo items that contain multiple shots/fuel/power, while still being backwards compatible with the existing ammo system.

Features

Prior Attempts

Implementation

Existing and new statBases for CombatExtended.AmmoDef to support multi-shot ammo items:

Parameter Existing/New Description Allowed Values Default (if unspecified)
Mass Existing Nominal mass of a fully-loaded cell/tank Float: 0-? 1
Bulk Existing Nominal bulk of a fully-loaded cell/tank Float: 0-? 1
Capacity New Total capacity of a fully-loaded cell/tank Integer: 0-? ?
MassLostPerShot/
MassLostPerUnitConsumed
New How much mass the cell/tank decreases per shot Float: 0-? 0
BulkLostPerShot/
BulkLostPerUnitConsumed
New How much bulk the cell/tank decreases per shot Float: 0-? 0
DisplayAsPercentage New Whether to show remaining charge as a percentage Boolean:
true (shows %)
false (shows xxx/Capacity)
false
Rechargeable New Whether the cell/tank can be recharged once empty Boolean:
true (leaves behind empty cell/tank)
false (disappears from inventory)
false
Fuel New What item/resource to recharge empty cells/tanks of this type with ThingDefs (e.g. Chemfuel)
Non-tangible resources (Electricity, Plasma)
?

AmmoUser would also need to be modified to detect if the weapon's current ammo is of the cell/tank type, and consume it in the appropriate manner, while also displaying the capacity remaining in the pawn gizmo.

perkinslr commented 3 years ago

Partially depleted tanks and shells should probably not stack, but there should be a way (probably with a bench for cells) to combine partials.

The sale price of cells should scale with their remaining charge. The explosion size of cells should scale with their remaining charge.

One neat side-effect of this would be the future possibility of weapon magazines for conventional weapons too. Would help with the enormous bulk (but not mass) of PKM ammunition and similar.

Also, for energy cells, being able to recharge them is probably a good idea. They probably should degrade with recharging, with their capacity shrinking so they must eventually be replaced.

sumghai commented 3 years ago

Partially depleted tanks and shells should probably not stack

Perhaps this could be implemented by dynamically-changing a cell/tank's thingDef?:

but there should be a way (probably with a bench for cells) to combine partials.

The easiest way would probably be two bills - one to fully empty partials, and another to recharge/refill empty ones.

The sale price of cells should scale with their remaining charge.

I'm not sure about this one - I guess it depends on how easy/hard it is to refill/recharge the cells/tanks.

The explosion size of cells should scale with their remaining charge.

Agreed!

One neat side-effect of this would be the future possibility of weapon magazines for conventional weapons too.

This would be applicable with special calibers with fixed magazine size (e.g. PKM mags, M74 rockets in their customary 4-pack)

Also, for energy cells, being able to recharge them is probably a good idea.

Definitely!

They probably should degrade with recharging, with their capacity shrinking so they must eventually be replaced.

This will require a rethink of my current proposal, most likely requiring a standalone, explicit capacity parameter rather than inferring capacity from remaining mass/bulk (with the advantage that this is more transparent and user-intuitive to modders)

N7Huntsman commented 3 years ago

They probably should degrade with recharging, with their capacity shrinking so they must eventually be replaced.

That strikes me as more hassle than it's probably worth, honestly--for instance, there's nothing with conventional weapons that impacts the effectiveness of the ammo based upon its condition.

N7Huntsman commented 3 years ago

One neat side-effect of this would be the future possibility of weapon magazines for conventional weapons too. Would help with the enormous bulk (but not mass) of PKM ammunition and similar.

While it would certainly enable that, I definitely question the utility of going that direction. I don't see much benefit in having to manage magazines in addition to ammo--repacking magazines is really a level of detail we don't really need, I think.

sumghai commented 3 years ago

@N7Huntsman @perkinslr - I've just rewritten the OP, please let me know if I'm missing anything.

One neat side-effect of this would be the future possibility of weapon magazines for conventional weapons too. Would help with the enormous bulk (but not mass) of PKM ammunition and similar.

While it would certainly enable that, I definitely question the utility of going that direction. I don't see much benefit in having to manage magazines in addition to ammo--repacking magazines is really a level of detail we don't really need, I think.

I'm now sort of leaning towards Huntsman's thoughts on this - many weapons that share the same caliber often have different magazine sizes, so managing different magazines on top of the wide range of calibers probably makes for too much micromanagement.