Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Nuke on August 10, 2009, 01:09:25 am

Title: nukes lua.cpp dff
Post by: Nuke on August 10, 2009, 01:09:25 am
a few people have asked me for a diff to my lua.cpp file, here it is

--bugfixes
 camera:setFOV() --was crashing the game when called, now works fine
--new stuff
 weaponclass.LifeMax --maximum life expectancy of weapon
 object:getSignature --get any objects unique signature, useful for tagging unique metadata to objects with lua works with:
 mn.getObjectFromSignature() --gets an object handle from a signature for quickly getting the object that the metadata applies to
 ship.WeaponEnergyLeft/Max --get weapon energy level
 weapon.FlakDetonationRange --get and set the range at which flak goes boom
 io.updateTrackIR/getTrackIRPitch/getTrackIRYaw/getTrackIRRoll/getTrackIRX/getTrackIRY/getTrackIRZ --access to tracking data, for working with cameras,targeting,ect

*edit*
attachment removed, see below
Title: Re: nukes lua.cpp dff
Post by: Angelus on August 14, 2009, 02:49:21 pm
thx Nuke!
I'll see if i can catch ya in the irc chat the next days, i have a couple o questions.
Title: Re: nukes lua.cpp dff
Post by: Nuke on August 18, 2009, 09:52:35 am
ok i updated my diffs again, they are up to date with revision 5522

ive added a few bugfixes for submodel animation as well, its now possible for hitpoints disabled objects to animate.
ive added some new features too

weaponclass.Range --range of weapon
subsystem:hasFired() --returns true if the subsystem has fired, good for handling animation events
ship.primaryTriggerDown --bit value of whether ship has its weapon trigger down (gives no indication of anything firing)
-- these only apply to player input
control_info.ForwardCriuse --gets the forward criuse speed, takes into account speed matching, and throttle hot keys
control_info.PrimaryCount --gets the number of times the primary weapons were fired in the current frame
control_info.SecondaryCount --gets the number of times the secondary weapons were fired in the current frame
control_info.CountermeasureCount --gets the number of times the countermeasures that were fired in the current frame

[attachment deleted by Tolwyn]
Title: Re: nukes lua.cpp dff
Post by: Swifty on August 18, 2009, 06:22:45 pm
It would be useful if we had a trigger to disable TrackIR head tracking via some sort of Lua accessible switch while still being able to get the inputs from the TrackIR device so your viewpoint won't go all over the place when you're trying to use the TrackIR inputs for something else. I'll look into that while reviewing your patch.
Title: Re: nukes lua.cpp dff
Post by: Nuke on August 19, 2009, 01:22:47 am
ive mostly been able to get around that issue using cameras. when using cameras the trackir doesnt effect the cameras. i use the inputs to generate a position and orientation which i apply to the cameras. its now also possible to turn the hud on and off with cameras. so the trackir and hud both work and from any location or object i set the camera to. having an option to switch off the trackir would be nice, for example if you want to aim the turrets or guide a missile where youre looking.

the downside to this is that pretty much all of the ingame view commands are useless and new ones need to be scripted in their place. which leads to input issues. scripting does allow us to handle key presses mouse clicks and now joystick axes (though not quite in the same way), only thing we have no direct access to is joystick buttons. but it makes me question the effectiveness of direct access in the context of scripting. id perfer a system where i add controls to the control options screen and bind them just like any other axis or command in the game and then handle their input states from scripting. thats something to think about for when input in general gets an overhaul.