Scrap Mechanic

Scrap Mechanic

Not enough ratings
ScrapComputers Extended
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
322.252 KB
18 Mar @ 10:10am
20 Jul @ 12:27pm
20 Change Notes ( view )

Subscribe to download
ScrapComputers Extended

Description
This addon adds new functions to the Computer API and modifies some components.

=================== Computer API ====================

global / sc
  • debugf( format, ... ) – Logs messages in the console with different severity levels ('error', 'info', 'warning').

os
  • os.date( format, timestamp ) – Returns formatted date/time based on the given format and timestamp.

math
  • math.sign( x ) – Returns 1 if positive, -1 if negative, or 0.
  • math.round( number, digits ) – Rounds a number to the given number of decimal places.
  • math.isnan( x ) – Checks if the value x is nan (Not a Number).

================ Component Changes =================

GravityController
  • GravityController.applyImpulse( impulse, worldSpace, offset ) – Applies an impulse to the object.
  • GravityController.applyTorque( torque, worldSpace ) – Applies torque to the object.
  • GravityController.getWorldGravity() – Returns the current world gravity.
  • GravityController.getCenterOfMass( wholeCreation ) – Returns the center of mass of the object. If wholeCreation is true, returns the average center of mass for all connected bodies.

Motor
  • Motor.getCurrentLength() – Returns the current piston length (only one piston can be connected).
  • Motor.getBearingsData() – Returns bearings data (angle, angularVelocity, appliedImpulse, isReversed).
  • Motor.getPistonsData() – Returns pistons data (length).

Feel free to share your ideas and suggestions in the comments!
1 Comments
_/Mahorin/_ 31 May @ 3:37am 
very noice, i was thinking of making an addon for ScrapComputer to have the access to applyImpulse and applyTorque so happy to see that you had the same idea and did it !