Can I Begin Opening Up FPSWeapon & WeaponManager

Discuss coding questions, pull requests, and implementation details.
Post Reply
l3lessed
Posts: 1400
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Can I Begin Opening Up FPSWeapon & WeaponManager

Post by l3lessed »

So, I'm finally at a point, I can start moving coding out of the main build and into mods.

However, I can't do that, until there is some changes made the the script objects and vars so they can be publicly manipulated.

As an example, it is currently nigh impossible to offset the original weapon sprites and images without completely removing the old sprite through hard coding, completely rebuild the sprite and rect, and then resetup the whole animation system. I'm not going to do that, when, all that needs done is some of the rect and animation vars and objects can be made public in future builds to give the same access.

I wanted to check before I started a new fork for this work. Are we interested in this, and if I begin it, will it be accepted into the main branch, as long as it meets standards.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Can I Begin Opening Up FPSWeapon & WeaponManager

Post by TheLacus »

FPSWeapon is specifically designed to implement classic Daggerfall animated weapons. I think the best way to open it for mod customization is with an interface or abstract class (see MobilePersonAsset as an example). This would allow mods to provide their own implementations and inherith from FPSWeapon class if necessary. I think this is a better solution in the long term rather than setting several private fields as public.

What kind of changes would you like to make? Can you make a summary of what your mod would require to be accessible?

l3lessed
Posts: 1400
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Can I Begin Opening Up FPSWeapon & WeaponManager

Post by l3lessed »

rgr, I agree, that is the more logical and safe coding approach. If I can't get the base scripts to work how I need, I can begin working on accessing the fpsweapon and weaponmanager that way.

Let me try a few things to see if I can get access to what I need from the base script files. As of now, I'm wanting to try and move my lerp offset routines out of FPSWeapon script and into a mod script. As an example of one thing I ran into, when I add a second weapon/shield on screen, I need to ensure the offset between the two is tied directly together, but since I can't directly access or easily offset the original rect in the fpsweapon script (since it isn't public for good reason), I can't, and it creates funky, unnatural weapon bob with two showing on screen.

Also, the base script file, again for good reason, doesn't have any way to easily manipulate the sprite position rect values. There is an offset stored in the weaponbasics, which is loaded into the weapon rect object, but this is only accessible directly from the fpsweapon script, since all of it is not public.

One thing I began doing, I resetup the weapon animation record in the mod file, and I was about to reload the texture to grab the rect size information, and resetup the rect in the mod file to manipulate it from the mod file itself. That is when I decided I might be going down a rabbit hole/time sink I didn't need to or want to in the long run.

Can I make the whole script file an object, and then use the object to offset? Will this transfer to the rect object within the script file too?

Also, if I begin setting up abstract classes for the fpsweapon and weaponmanager, will that work for the main branch?
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

agamer
Posts: 8
Joined: Sat Jul 06, 2019 2:29 am

Re: Can I Begin Opening Up FPSWeapon & WeaponManager

Post by agamer »

I'm working on something that uses hands/weapons/spellcasting frames/rects/animations. It seems like whatever solution found for FPSWeapon/WeaponManger might extend to FPSSpellCasting class? I'm extracting the rect values for the hands/weapons animations out of FPSWeapon to make sets of "offset numbers" currently by hand. Did you solve this yet? If so, was the solution something that may make that process easier?

Post Reply