Do want. Do very much want! Especially since I've been having to deal with radiation damage so frequently as of late. T'would be handy to have, but is it possible via FLHook?
I'll have to look into this. I know repairing a ship hull is definitely possible (without much difficulty).
Although querying for each piece of equipment attached, and checking the HP for whatever equipped object compared to its maximum is something I'm less sure of. (I assuming the repair cost value is a simple algebra equation.)
There's probably some method. When I get back from campus I'll look through the FLHook SDK and see what's there to work with.
Alright. So I've done some experimentation with the subject.
The problem with this feature, is that FLHook needs to repair the ship while it's in space. Not when it docks on a station. When a vessel docks, the ship object disappears, meaning that the values cannot be manipulated. I've tried to put the repair (and credit deduction) logic as early as I could under the BaseEnter hook, although the hook doesn't fire soon enough, as the ship is already docked at that point. (Meaning you're kicked from the server instead, since the server doesn't know what to do)
The only solution which I can think of currently, is to hook into when users press the dock button in order to land on a base. If it detects that you're within a certain range of the base you're landing on, it can perform the operations while you're in space, before running a Force-Dock function, landing you on the base shortly after the autorepair does it's work.
The downside to this, the Force-Dock skips the docking animation. I'm not sure how the developers would feel about that.
If the plugin didn't force a user to dock, people could abuse the autorepair, by asking to dock from a close range to the station, and quickly go back to free-flight after being repaired. (Meaning they wouldn't actually dock) - So a no bueno there.
Uhm...
My only thought is...That i remember this function briefly from a HHC server...i might remember wrong of course, but i'm pretty sure they had that implemented to FLHook somehow.
Maybe nosing around the HHC plugins could help us find the answer?
But yeah tbh, that's not that important of a plugin anyway, it was more like a flash of a thought, that what if we could save 10 seconds of our lives with each dock that needed repairs
If you could point me to some references, I'd be more than happy to look into what sort of operations they did to accomplish the task. (If it is the same task) - I'm afraid I don't really know where I'd look for what you're talking about myself.
There are a few approaches to this feature request, but none of them that I'm seeing, is as seamless as it probably should be.
Posts: 3,702
Threads: 144
Joined: Aug 2009
Staff roles: Server Manager Coding Dev Moderator
If I recall correctly, Eagle Utopia had this when they were running, but they had FLAC instead of FLHook. I thought it happened just after you dock. I never managed to figure out how to do it. Maybe some client-side hooking wizard can figure it out.
Posts: 3,702
Threads: 144
Joined: Aug 2009
Staff roles: Server Manager Coding Dev Moderator
I have reason to believe that the ReqEquipment/ReqHullStatus hooks may be called when people attempt to repair their ships manually. Maybe we can use that along with BaseData::get_ship_repair_cost
(03-31-2018, 03:06 PM)Alex. Wrote: I have reason to believe that the ReqEquipment/ReqHullStatus hooks may be called when people attempt to repair their ships manually. Maybe we can use that along with BaseData::get_ship_repair_cost
I definitely think that's a safe assumption, given I dunno how else the system would figure out how to calculate repair costs. (Unless it uses an unhooked function, which I doubt) - ill experiment with that later. Let's assume you're right, that ReqEquipment functions solve the issue of getting the cost for the equipment mounted on your vessel. (And a function to set its health). Maybe the repair operation can be done as @SnakThree suggested, on undock? Perhaps just a Boolean flag set on dock, which is checked once the player launches to space again?
The idea is that players don't have to do anything manually.
I discarded the idea at first, because it wouldn't hide the repair operation on the base, but on second thought, it's not that bad of an option, as it'll do it for you, if the user doesn't.
Ps. What kind of garbage values does GetRelativeHealth give you. Those numbers are far too large to match the current or max HP, nor does it seem to be a percentage.