Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Lua library for arcs

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua library for arcs Page: [1]
Login
Message << Older Topic   Newer Topic >>
Lua library for arcs - 2/25/2017 6:39:34 AM   
No New Messages
ckfinite
Matrix Veteran


 

Posts: 377
Joined: 7/20/2013
Status: offline
I'm working on a scenario, and wrote this little library for making and modifying arcs in a more convenient way than manually writing tables, and thought that it could be useful to other people here. The library can be found here, to add, just copy and paste into an event that runs whenever the scene is loaded, and it should be available.

Usage:

Arcs created by the library can be used immediately by Command with no modifications.

Example:
quote:


ScenEdit_UpdateUnit({guid='2c246071-b2a3-4603-a8a5-6d2033ff4a73', mode="add_sensor", dbid=3352, arc_detect=Arc():forward()})


Constructors:

This library adds a single function, Arc(), which provides several constructor methods for arcs:

Arc():from(from_angle):to(to_angle)

This will create a new arc which extends from from_angle, in degrees off of the front of the unit, to to_angle, in the same frame. Notably, the system sweeps clockwise, so, for example, Arc():from(0):to(0) will include all angles.

Examples:

quote:


Arc():from(0):to(90) -- front right quadrant
Arc():from(180):to(0) -- port side



Arc():new(arc)

The "new" method makes a library-usable arc from a default arc. This is used when adding arcs manually is desirable. Names are as in the default system, see here for them

Examples:

quote:


Arc():new({"SB1"}) -- adds the "SB1" arc.


Arc():all(), Arc():forward(), Arc():backward(), Arc():port(), Arc():starboard()

As the name implies, these return a pre-defined arc over the named area.

Examples:

quote:


Arc():all() -- an arc over all aspects
Arc():forward() -- an arc over the forward aspect


Arc Utilities:

Arcs created by the library can be added, using the + operator. For example, Arc():forward() + Arc():backward() is equivalent to Arc():all(). These arcs can then be added themselves, ad infinitum.

Arcs created by Arc() can be converted to string for printing and debug with the built-in tostring method, which prints out the names of the aspects included in the arc.

< Message edited by ckfinite -- 2/25/2017 6:40:23 AM >
Post #: 1
RE: Lua library for arcs - 2/25/2017 10:26:22 AM   
No New Messages
michaelm75au
Matrix Legion of Merit



Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
Thank you

_____________________________

Michael

(in reply to ckfinite)
Post #: 2
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua library for arcs Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

2.688