Menu

#463 Custom equipments and ammos

undetermined
open
nobody
None
1
2019-08-21
2014-10-11
luiges90
No

Specify custom equipments and ammos using external XML files in data/equipments/weapons and data/equipments/ammo. Allow creation of custom equipments basing from existing ones.

However, MML does not recognise these custom weapon/ammo.

p.s. This patch was around in my PC for month, but since I found myself neglecting MM I decided to publicize this anyway.

1 Attachments

Discussion

  • luiges90

    luiges90 - 2014-10-11

    However, MML does not recognise these custom weapon/ammo. < That said, to use custom weapon users can manually edit MTF/BLK files.

    Just realized that there is a missing change:
    In WeaponLoader.java, change line 351 from

    if (child.getNodeName().equals("BaseType")) {

    to

    if (child.getNodeName().equalsIgnoreCase("BaseType")) {

    Thanks.

     

    Last edit: luiges90 2014-10-11
  • Sebastian Brocks

    Am I reading the patch correctly that there is no provisioning for specifying what WeaponHandler a custom weapon should use?

     
  • luiges90

    luiges90 - 2014-10-11

    A custom weapon, for example, basing off SRM 6 will use SRMHandler (which SRM6 uses) for standard ammo (and exotic handlers for exotic ammos). That said, a custom weapon can specify a WeaponHandler through an existing weapon using it.

    In addition, if XML does not specify a particular field, it will use the same value as its BaseType weapon.

     

    Last edit: luiges90 2014-10-11
  • luiges90

    luiges90 - 2014-10-11

    Updated docs files to clarify the feature and fix wrong parts, including the small fix in my first comment

     

    Last edit: luiges90 2014-10-11
  • Dylan Myers

    Dylan Myers - 2014-10-11

    I think Bee is on the right track though... rather than basing on an existing weapon, I think it should have them specify a weapon handler. This would allow for the addition of extra non-canon weapon handlers in the code and implement weapons via the custom weapons system. That way, with a very minimal amount of code, people can have truly custom weapon.

     
  • Dylan Myers

    Dylan Myers - 2014-10-11

    Hell, with a little work we could even move the handlers themselves to XML files!

     
  • Nicholas Walczak

    My past thoughts on the WeaponHandler issue is to add a new state variable to the Weapon class that stores the fully qualified name of the weapon handler to return, and then change the getHandler method to use that state variable to load a new instance of the weapon handler. Then, the custom weapon can specify its WeaponHandler directly.

     
  • luiges90

    luiges90 - 2014-10-12
    1. Add support for specifying WeaponHandler. It is implemented by having all weapons that specify WeaponHandler create an instance of CustomWeapon, which handles custom handler string correctly.
    2. Parse types using reflection instead of hard-coding all the flags/types/etc
      (note: this changes values that is accepted as flags/types/etc. The doc now hold correct accepted values)
     

    Last edit: luiges90 2014-10-12
  • luiges90

    luiges90 - 2014-11-15

    any updates on this?

     
    • Nicholas Walczak

      To be honest, I haven't looked at this because it's very tedious to get the patch applied. Could you submit the patch as an svn diff from the trunk of the repository? That or give directions on how to apply the patch without too much effort.

       
  • luiges90

    luiges90 - 2014-12-03

    OK, so here is updated patch, created from diffing with r11400.

     

    Last edit: luiges90 2014-12-03
  • Hammer

    Hammer - 2019-08-21

    Hi, I'm not sure if you're still around but we've always had intentions of wanting to do this. But the timing for this was bad with our move to Github. If you're still around and willing would you be able to do a PR from our Github Repo to update this.

    https://github.com/MegaMek

    We have a dev that is willing to look at it ASAP.