JakobTischler / MoreRealisticDLCs

A lua/xml project that adds MoreRealistic to the Farming Simulator DLCs
8 stars 0 forks source link

vehicle type #23

Closed quadural closed 10 years ago

quadural commented 10 years ago

I need the "3162" caseIH header vehicleType specilaization list. I know this is a "cutter_builtInCutterTrailer" vehicle. But I can't find a way to get the specializations name list. Do we have to guess the list or what ? ;)

JakobTischler commented 10 years ago
            <specialization name="attachable" />
            <specialization name="pdlc_titaniumAddon.wheelExtension" />
            <specialization name="pdlc_titaniumAddon.visualWheels" />
            <specialization name="animatedVehicle" />
            <specialization name="mouseControlsVehicle" />
            <specialization name="cylindered" />
            <specialization name="cutter" />
            <specialization name="mountable" />
            <specialization name="foldable" />
            <specialization name="pdlc_titaniumAddon.builtInCutterTrailer" />
            <specialization name="pdlc_titaniumAddon.cutterExtension" />
quadural commented 10 years ago

may I ask you where did you get that ? (or how ?)

JakobTischler commented 10 years ago

I printed the self.specializations table, using tableShow. You can see that function, e.g., in Courseplay's debug.lua. And from that print I simply took the spec names and added the DLC name if it wasn't a default spec.

quadural commented 10 years ago

ok, thanks. I was trying to get the list directly from the "SpecializationUtil" class and "VehicleTypeUtil". I completely forget to check the specializations list of an existing "object" (vehicle) in game... Stupid of me = how to lose time in not time ;)

EDIT : try it, and it was the same problem for me = I get a list of function without knowing what is the "specialization". So, I give a try to the CP tableShow, and it listed the file name for each function => and so, we get the "specialization" from that. Finally, what I was missing is the "debug.getinfo" (I didn't know this library and this particular function) Thanks for sharing this knowledge.

JakobTischler commented 10 years ago

Oh yeah, I find debug.getinfo so very, very, extremely useful. For example, I used it to write my own customized callstack print function (see Courseplay, helpers.lua, courseplay.utils:getFnCallPath()). Let alone using it for getting the current line of the print call (debug.getinfo(1).currentline).