User mods, screenshots & videos > Vehicles

Small Truck

<< < (2/4) > >>

fly77:
yes I understand the problem...since the use of the gripping beam is not limited to physical objects
the mod needs to distinguish between objects that have parameter: physics and in this case apply create/delete methods to drop the object
and objects that do  not have parameter: "physics" and in this case use your method of just moving the object and not deleting/creating anything

"If you can think of a better solution then I would be very curious to know it."
yes there is:  it involves the use of the pkgview.h interface  and get_objdef  method...(i will post instructions here later) .. it allows reading the objdef file of an object and hence you can check the value of the "parameters" line
and take apropriate actions.

I'll report back later the detailed instructions  ;)

andfly:
Optimal !  :D :D

fly77:
here is how I identified objects that have "physics:{mass..." code line in the objdef file:

I used it in my Landrock upgrade to pick and drop any kind of objects.
the key is to use

virtual bool get_objdef_info( ifc_out ot::pkginfo::objdef& info ) const = 0;

So to test if a selected objects's objdef file contains a "physics:{mass..." code line I use


--- Code: ---let this.objDefInfo = this.seenObj.$ret.get_objdef_info().info;
let this.isPhysicalStatic =  ( /physics:{mass/.test(this.objDefInfo.params) ) ;
--- End code ---

you can also - if you wish - retrieve object category

this.seenObjCat=this.seenObj.$ret.get_objdef_info().objcat;
etc..

the documentation as usual is on github:

see here:
https://github.com/Outerra/anteworld/blob/master/include/ot/object_cfg.h

and here:
https://github.com/Outerra/anteworld/blob/master/include/ot/object.h ---> use this method

pkgview.h in fact is not needed..its also a very interesting interface. In case documentation is here now:
https://github.com/Outerra/anteworld/blob/master/include/ot/pkgview.h

it allows to "scan" throuh user directories to list all installed mods, search them , filter them according to type, category, parameters, tags inside objdef files..etc..

to use it :
$pkgView = this.$query_interface('ot::js::pkgview.create');

andfly:

--- Quote from: fly77 on July 13, 2023, 09:33:52 am ---here is how I identified objects that have "physics:{mass..." code line in the objdef file:
... ... ...

--- End quote ---

I applied your recommendations and added code that tests for mass parameters to static objects.
These objects are transformed into dynamic ones and are subject to gravity.
The only drawback is that, being objects created "after" the spawn of the small truck, except for the first move, they are not displayed during transport but only at its conclusion.
As already noted, this is only an aesthetic inconvenience.
The shift is equally performed optimally.

To use the updated mod: re-download.

P.S.
I've also improved turret mobility which is now smoother, faster, and more accurate.

KW71:
and-fly-77 The dynamic duo!  Kudos!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version