ContainerStack
(Created page with " == Container Stack == Category:ACTS") |
|||
(11 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | == Container | + | ==Container stack objects== |
+ | |||
+ | ===Description=== | ||
+ | A stack may be reachable by more than one crane. It knows the asset specified maximum count of stackable containers and the stackable container types. Additionally it knows the next stackable container types and at which attachment points. | ||
+ | |||
+ | The maximum count of stackable containers has a special meaning for stack kinds that may stack multiple container types. Here the sense is the count of container layers. | ||
+ | |||
+ | There are different stack types: 10ftsc, 10fthc, 10ftschc, 20ftsc, 20fthc, 20ftschc, 40ftsc, 40fthc, 40ftschc, 45ftsc, 45fthc, 45ftschc,, 53ftsc, 53fthc and 53ftschc. These stacks have all a defined length for stackable containers. | ||
+ | |||
+ | Some more complex mixed stacks may be later implemented, such as stacks with mixed containers in multiple layer lines. | ||
+ | |||
+ | A stack is able to report its parameter soups including a list of the current stacked containers, the possibly next stackable container types as well as if it is full stacked. | ||
+ | |||
+ | '''TBD: The maximal count of stackable containers. Depends on maximum stackable containers from all reachable cranes and the z height of the stack in relation to the z height of the crane.''' | ||
+ | |||
+ | '''TBD: Container cars were considered as temporary stacks. The locations and rotations have to be calculated and the attachment points for container products has to be investigated and some were listed per asset within the aCTS global values or in an extensions sub-soup.''' | ||
+ | |||
+ | ==Asset files pre version 0.1== | ||
+ | The files compile errorless and the messaging runs well. No more functionality implemented and tested in this pre version. | ||
+ | |||
+ | ===config.txt=== | ||
+ | XY is the KUID part, LL the length and HH or hh the height for the container type. | ||
+ | X 1 for 10ft, 2 for 20ft, 3 for 40ft, 4 for 45ft and 5 for 53ft | ||
+ | Y 1 for standard height, 2 for heigh cube height and without Y for mixed heig cube and standard cube containers. | ||
+ | LL the fitting length as 10, 20, 40, 45, 53 | ||
+ | hh the fitting height as sc, hc, schc | ||
+ | HH the fitting height as SC, HC, SCHC | ||
+ | <CODE> | ||
+ | |||
+ | kuid <kuid2:215489:11003<span style="background:#FF0000">XY</span>:1> | ||
+ | username "aCTS CONTSTACK <span style="background:#FF0000">LL</span>ft <span style="background:#FF0000">HH</span> Scenery Utility V0.1" | ||
+ | kind "Scenery" | ||
+ | category-class "BU" | ||
+ | description "aCTS CONTSTACK <span style="background:#FF0000">LL</span>ft <span style="background:#FF0000">HH</span> Scenery Utility V0.1" | ||
+ | |||
+ | trainz-build 4.6 | ||
+ | |||
+ | surveyor-only 0 | ||
+ | |||
+ | script "acts_contstack.gs" | ||
+ | class "acts_contstack" | ||
+ | |||
+ | kuid-table { | ||
+ | scriptinclude <kuid2:215489:110000:1> | ||
+ | } | ||
+ | |||
+ | script-include-table { | ||
+ | scriptinclude <kuid2:215489:110000:1> | ||
+ | } | ||
+ | |||
+ | mesh-table-lod-transition-distances 1000 | ||
+ | mesh-detail-level-count 1 | ||
+ | |||
+ | mesh-table | ||
+ | { | ||
+ | contstack<span style="background:#FF0000">LL</span>ft<span style="background:#FF0000">hh</span>-lod0 | ||
+ | { | ||
+ | mesh "acts_stack_<span style="background:#FF0000">LL</span>ft<span style="background:#FF0000">hh</span>.trainzmesh" | ||
+ | auto-create 1 | ||
+ | lod-level 0 | ||
+ | effects { | ||
+ | name { | ||
+ | kind "name" | ||
+ | name "GOID" | ||
+ | att "a.name" | ||
+ | font "swiss" | ||
+ | fontsize 0.3 | ||
+ | fontcolor 1.0,1.0,1.0 | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | thumbnails | ||
+ | { | ||
+ | 0 | ||
+ | { | ||
+ | image "acts_contstack_<span style="background:#FF0000">LL</span>ft<span style="background:#FF0000">hh</span>_thumb.jpg" | ||
+ | width 240 | ||
+ | height 180 | ||
+ | } | ||
+ | } | ||
+ | </CODE> | ||
+ | |||
+ | '''TBD: (???) For single length stacks there is no need to diferentiate the mesh container name, the mesh file name and the thumb file name in different heights, because there are no attachmentpoints used. (???)''' | ||
+ | |||
+ | ===acts_contstack.gs=== | ||
+ | <CODE> | ||
+ | include "acts_contstack_script.gs" | ||
+ | |||
+ | //----------------------------------------------------------------------------- | ||
+ | // aCTS Contstack V0.1 Central Script - acts_contstack.gs | ||
+ | //----------------------------------------------------------------------------- | ||
+ | // X acts_contstack <-- acts_contstack_script | ||
+ | // acts_contstack_script <-- acts_contstack_register | ||
+ | // acts_contstack_register <-- acts_contstack_globals | ||
+ | // acts_contstack_globals <-- MapObject | ||
+ | //----------------------------------------------------------------------------- | ||
+ | |||
+ | class acts_contstack isclass acts_contstack_script | ||
+ | { | ||
+ | // -------------------------------------------------------------------------- | ||
+ | // Mandatory INIT method | ||
+ | // -------------------------------------------------------------------------- | ||
+ | public void Init(Asset asset) | ||
+ | { | ||
+ | inherited(asset); | ||
+ | //------------------------------------------------------------------------- | ||
+ | // Make shure that the right module is set for World.GetCurrentModle() | ||
+ | // (see world.gs lines 939ff.) to start driver related initiations and | ||
+ | // tell me, if my Init and SetProperties methods are finished. | ||
+ | // Add handler for my tasks as dispatcher. | ||
+ | //------------------------------------------------------------------------- | ||
+ | AddHandler(me, "World", "ModuleInit", "WorldInitHandler"); | ||
+ | AddHandler(me, "OBJECTINIT", "", "ObjectInitHandler"); | ||
+ | AddHandler(me, "DISPATCHER", "", "DispatcherHanlder"); | ||
+ | //------------------------------------------------------------------------- | ||
+ | // It's nessecary to initalise the lib to force subscript preparing | ||
+ | //------------------------------------------------------------------------- | ||
+ | dispobj = World.GetLibrary(GetAsset().LookupKUIDTable("scriptlib")); | ||
+ | //------------------------------------------------------------------------- | ||
+ | // Set asset special initial values | ||
+ | //------------------------------------------------------------------------- | ||
+ | dispgoid = dispobj.GetGameObjectID(); | ||
+ | objecttype = "CONTSTACK_SC"; | ||
+ | stacklength = "10ft"; | ||
+ | //------------------------------------------------------------------------- | ||
+ | isInitMethodFinnished = true; | ||
+ | PostMessage(me,"OBJECTINIT","INIT_FINNISHED",0); // Init method finnished | ||
+ | return; | ||
+ | } | ||
+ | //--------------------------------------------------------------------------- | ||
+ | }; | ||
+ | </CODE> | ||
+ | |||
+ | ===acts_contstack_script.gs=== | ||
+ | <CODE> | ||
+ | include "acts_contstack_globals.gs" | ||
+ | include "acts_tools_script.gs" | ||
+ | |||
+ | //----------------------------------------------------------------------------- | ||
+ | // aCTS Contstack V0.1 Central Script - acts_contstack_script.gs | ||
+ | //----------------------------------------------------------------------------- | ||
+ | // acts_contstack <-- acts_contstack_script | ||
+ | // X acts_contstack_script <-- acts_contstack_register | ||
+ | // X acts_contstack_register <-- acts_contstack_globals | ||
+ | // acts_contstack_globals <-- acts_global_values | ||
+ | // acts_global_values <-- MapObject | ||
+ | //----------------------------------------------------------------------------- | ||
+ | |||
+ | class acts_contstack_register isclass acts_contstack_globals | ||
+ | { | ||
+ | //--------------------------------------------------------------------------- | ||
+ | // TBD: Outsource from acts_container_script | ||
+ | //--------------------------------------------------------------------------- | ||
+ | }; | ||
+ | |||
+ | class acts_contstack_script isclass acts_contstack_register | ||
+ | { | ||
+ | //--------------------------------------------------------------------------- | ||
+ | public void SetProperties(Soup soup) // Callback method after Init method | ||
+ | { | ||
+ | inherited(soup); | ||
+ | //------------------------------------------------------------------------- | ||
+ | ObjectDataSoup.Copy(soup.GetNamedSoup("ObjectData")); | ||
+ | LocationSoup.Copy(soup.GetNamedSoup("Location")); | ||
+ | OrientationSoup.Copy(soup.GetNamedSoup("Orientation")); | ||
+ | /*/------------------------------------------------------------------------- | ||
+ | if (acts_debug) Interface.Log(Interface.GetTimeStamp() | ||
+ | + " [" + objectgoid.SerialiseToString() + "]" | ||
+ | + " CONTSTACK SETPROPERTIES SOUPS"); | ||
+ | if (acts_debug) actsTools.ShowSoup(ObjectDataSoup,"ObjDS=>"); | ||
+ | if (acts_debug) actsTools.ShowSoup(LocationSoup,"LocDS=>"); | ||
+ | if (acts_debug) actsTools.ShowSoup(OrientationSoup,"OriDS=>"); | ||
+ | //-------------------------------------------------------------------------*/ | ||
+ | isSetPropertiesMethodFinnished = true; | ||
+ | PostMessage(me,"OBJECTINIT","SETPROPS_FINNISHED",0.0); | ||
+ | return; | ||
+ | } | ||
+ | //--------------------------------------------------------------------------- | ||
+ | public Soup GetProperties(void) // Callback method before closing session | ||
+ | { | ||
+ | Soup soup = inherited(); | ||
+ | //------------------------------------------------------------------------- | ||
+ | soup.SetNamedSoup("ObjectData",ObjectDataSoup); | ||
+ | soup.SetNamedSoup("Location",LocationSoup); | ||
+ | soup.SetNamedSoup("Orientation",OrientationSoup); | ||
+ | //------------------------------------------------------------------------- | ||
+ | if (acts_debug) Interface.Log(Interface.GetTimeStamp() | ||
+ | + " [" + objectgoid.SerialiseToString() + "]" | ||
+ | + " CONTSTACK GETPROPERTIES SOUPS"); | ||
+ | if (acts_debug) actsTools.ShowSoup(ObjectDataSoup,"ObjDS=>"); | ||
+ | if (acts_debug) actsTools.ShowSoup(LocationSoup,"LocDS=>"); | ||
+ | if (acts_debug) actsTools.ShowSoup(OrientationSoup,"OriDS=>"); | ||
+ | //-------------------------------------------------------------------------*/ | ||
+ | return soup; | ||
+ | } | ||
+ | //--------------------------------------------------------------------------- | ||
+ | public void WorldInitHandler(Message msg) | ||
+ | { | ||
+ | //------------------------------------------------------------------------- | ||
+ | if (acts_debug)Interface.Log(Interface.GetTimeStamp() | ||
+ | + " [" + objectgoid.SerialiseToString() + "]" | ||
+ | + " CONTSTACK GOT WORLDINIT MESSAGE [" | ||
+ | + msg.major+"] ["+msg.minor+"]"); | ||
+ | //-------------------------------------------------------------------------*/ | ||
+ | // If one of the two methods (Init or SetProperties) isn't finished yet, | ||
+ | // post "World","ModuleInit" message a little bit later again. | ||
+ | // So it is guaranteed that the Init and SetProperties methods are finished | ||
+ | // as well as the "World","ModuleInit" message tells to be save using the | ||
+ | // World.GetCurrentModule method. | ||
+ | //------------------------------------------------------------------------- | ||
+ | if (!(isSetPropertiesMethodFinnished and isInitMethodFinnished)) | ||
+ | { | ||
+ | PostMessage(me, "World", "ModuleInit", 0.1); | ||
+ | } | ||
+ | //------------------------------------------------------------------------- | ||
+ | isWorldInitFinnished = true; | ||
+ | PostMessage(me, "OBJECTINIT", "WORLD_INIT_FINNISHED", 0.0); | ||
+ | //------------------------------------------------------------------------- | ||
+ | return; | ||
+ | } | ||
+ | //--------------------------------------------------------------------------- | ||
+ | public void ObjectInitHandler(Message msg) | ||
+ | { | ||
+ | //------------------------------------------------------------------------- | ||
+ | // Until the Trainz core send the "World","ModuleInit" was send it is not | ||
+ | // guarented to decide with the World.GetCurrentModule method to be in the | ||
+ | // returned module! | ||
+ | //------------------------------------------------------------------------- | ||
+ | if (acts_debug)Interface.Log(Interface.GetTimeStamp() | ||
+ | + " [" + objectgoid.SerialiseToString() + "]" | ||
+ | + " CONTSTACK GOT MESSAGE ["+msg.major+"] ["+msg.minor+"]"); | ||
+ | //-------------------------------------------------------------------------*/ | ||
+ | if (msg.dst==me and msg.major=="OBJECTINIT") | ||
+ | { | ||
+ | if (msg.minor=="INIT_FINNISHED") | ||
+ | { | ||
+ | //--------------------------------------------------------------------- | ||
+ | // Show the goid on both sides of me (for debugging purpose) | ||
+ | //--------------------------------------------------------------------- | ||
+ | SetFXNameText("GOID","["+objectgoid.SerialiseToString()+"]"); | ||
+ | //--------------------------------------------------------------------- | ||
+ | } | ||
+ | //----------------------------------------------------------------------- | ||
+ | if (msg.minor=="SETPROPS_FINNISHED") | ||
+ | { | ||
+ | if (ObjectDataSoup.CountTags()==0) | ||
+ | { | ||
+ | //------------------------------------------------------------------- | ||
+ | // LoadRegisterDataInfos(RegisterDataSoup); | ||
+ | //------------------------------------------------------------------- | ||
+ | ObjectDataSoup.SetNamedTag("goid",objectgoid); | ||
+ | ObjectDataSoup.SetNamedTag("type","CONTSTACK"); | ||
+ | ObjectDataSoup.SetNamedTag("length",stacklength); | ||
+ | ObjectDataSoup.SetNamedTag("height",stackheight); | ||
+ | ObjectDataSoup.SetNamedTag("regID",-1); | ||
+ | ObjectDataSoup.SetNamedTag("active",false); // False: Not reachable | ||
+ | ObjectDataSoup.SetNamedTag("requested",false); | ||
+ | ObjectDataSoup.SetNamedTag("blocked",false); | ||
+ | } | ||
+ | //--------------------------------------------------------------------- | ||
+ | if (acts_debug)Interface.Log(Interface.GetTimeStamp() | ||
+ | + " =>SOUP 'ObjectDataSoup'"); | ||
+ | if (acts_debug)actsTools.ShowSoup(ObjectDataSoup,"=>"); | ||
+ | //---------------------------------------------------------------------*/ | ||
+ | if (LocationSoup.CountTags()==0) | ||
+ | { | ||
+ | //------------------------------------------------------------------- | ||
+ | // LoadLocationDataInfos(LocationDataSoup); | ||
+ | //------------------------------------------------------------------- | ||
+ | WorldCoordinate WC = me.GetMapObjectPosition(); | ||
+ | LocationSoup.SetNamedTag("bbx",WC.baseboardX); | ||
+ | LocationSoup.SetNamedTag("bby",WC.baseboardY); | ||
+ | LocationSoup.SetNamedTag("px",WC.x); | ||
+ | LocationSoup.SetNamedTag("py",WC.y); | ||
+ | LocationSoup.SetNamedTag("pz",WC.z); | ||
+ | } | ||
+ | //--------------------------------------------------------------------- | ||
+ | if (OrientationSoup.CountTags()==0) | ||
+ | { | ||
+ | //------------------------------------------------------------------- | ||
+ | // LoadOrientationDataInfos(OrientationDataSoup); | ||
+ | //------------------------------------------------------------------- | ||
+ | Orientation OR = me.GetMapObjectOrientation(); | ||
+ | LocationSoup.SetNamedTag("rx",OR.rx); | ||
+ | LocationSoup.SetNamedTag("ry",OR.ry); | ||
+ | LocationSoup.SetNamedTag("rz",OR.rz); | ||
+ | LocationSoup.SetNamedTag("gx",OR.rx*180.0/Math.PI); | ||
+ | LocationSoup.SetNamedTag("gy",OR.ry*180.0/Math.PI); | ||
+ | LocationSoup.SetNamedTag("gz",OR.rz*180.0/Math.PI); | ||
+ | } | ||
+ | //--------------------------------------------------------------------- | ||
+ | // TBD: Adjust position and rotation to rounded values and handle | ||
+ | // the different pssibilities. | ||
+ | // (some methods see acts_tools_script.gs) | ||
+ | //--------------------------------------------------------------------- | ||
+ | // Soup sp = actsTools.AutoAdjustMapObject(me); | ||
+ | // LocationSoup = sp.GetNamedSoup("AdjustedLocationSoup"); | ||
+ | // OrientationSoup = sp.GetNamedSoup("AdjustedOrientationSoup"); | ||
+ | //--------------------------------------------------------------------- | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | //--------------------------------------------------------------------------- | ||
+ | public void DispatcherHandler(Message msg) | ||
+ | { | ||
+ | if (msg.dst==me and msg.major=="DISPATCHER") | ||
+ | { | ||
+ | //----------------------------------------------------------------------- | ||
+ | if (acts_debug)Interface.Log(Interface.GetTimeStamp() | ||
+ | + " ["+objectgoid.SerialiseToString()+"]" | ||
+ | + " CONTSTACK GOT MESSAGE FROM DISPATCHER" | ||
+ | + (cast<GameObject>msg.src).GetGameObjectID().SerialiseToString() | ||
+ | + "] ["+msg.major+"] ["+msg.minor+"]"); | ||
+ | //-----------------------------------------------------------------------*/ | ||
+ | if (msg.minor=="OBJECTSOUP_UPDATED") | ||
+ | { | ||
+ | //--------------------------------------------------------------------- | ||
+ | // Update the own ObjectDataSoup | ||
+ | //--------------------------------------------------------------------- | ||
+ | ObjectDataSoup.Copy(cast<Soup>msg.paramSoup); | ||
+ | //---------------------------------------------------------------------*/ | ||
+ | } | ||
+ | if (msg.minor=="OBJECTSOUP_INSERTED") | ||
+ | { | ||
+ | //--------------------------------------------------------------------- | ||
+ | // Update the own ObjectDataSoup | ||
+ | //--------------------------------------------------------------------- | ||
+ | ObjectDataSoup.Copy(cast<Soup>msg.paramSoup); | ||
+ | //---------------------------------------------------------------------*/ | ||
+ | } | ||
+ | if (msg.minor=="OBJECTSOUP_APPENDED") | ||
+ | { | ||
+ | //--------------------------------------------------------------------- | ||
+ | // Update the own ObjectDataSoup | ||
+ | //--------------------------------------------------------------------- | ||
+ | ObjectDataSoup.Copy(cast<Soup>msg.paramSoup); | ||
+ | //---------------------------------------------------------------------*/ | ||
+ | } | ||
+ | } | ||
+ | //------------------------------------------------------------------------- | ||
+ | return; | ||
+ | } | ||
+ | }; | ||
+ | </CODE> | ||
+ | File is located in dispatcher library. | ||
+ | |||
+ | ===acts_contstack_globals.gs=== | ||
+ | <CODE> | ||
+ | include "acts_global_values.gs" | ||
+ | |||
+ | //----------------------------------------------------------------------------- | ||
+ | // aCTS Contstack V0.1 Central Script - acts_contstack_script.gs | ||
+ | //----------------------------------------------------------------------------- | ||
+ | // acts_contstack <-- acts_contstack_script | ||
+ | // acts_contstack_script <-- acts_contstack_register | ||
+ | // acts_contstack_register <-- acts_contstack_globals | ||
+ | // X acts_contstack_globals <-- acts_global_values | ||
+ | // acts_global_values <-- MapObject | ||
+ | //----------------------------------------------------------------------------- | ||
+ | |||
+ | class acts_contstack_globals isclass acts_global_values | ||
+ | { | ||
+ | //--------------------------------------------------------------------------- | ||
+ | // AssetInstanceSoup { | ||
+ | // X ObjectDataSoup { ... }, Only container, contstack, contcrane | ||
+ | // X LocationSoup { ... }, Only container, contstack, contcrane | ||
+ | // X OrientationSoup { ... }, Only container, contstack, contcrane | ||
+ | // SkinDataSoup { ... }, Only container | ||
+ | // ContentDataSoup { ... }, Only container | ||
+ | // DispatcherDataSoup { ... } Only dispatcher | ||
+ | // ContainerSoups { ... } Only dispatcher | ||
+ | // ContstackSoups { ... } Only dispatcher | ||
+ | // ContcraneSoups { ... } Only dispatcher | ||
+ | // } | ||
+ | //--------------------------------------------------------------------------- | ||
+ | // ObjectDataSoup { goid GameObjectID, type string, | ||
+ | // length string, height string, | ||
+ | // stack goid, place int, Only container | ||
+ | // active bool, action string }, | ||
+ | // activ: true means the object sended a register message while session run | ||
+ | // All objects were set false while initialising dispatcher and if | ||
+ | // they stay false their entries will be deleted next initialising. | ||
+ | // actions: ["APPENDED", "INSERTED", "UPDATED"]; | ||
+ | //--------------------------------------------------------------------------- | ||
+ | // Container stack types: | ||
+ | // stackheight "sc","hc" pur height stack (standard or heigh cube) | ||
+ | // "schc" mixed height | ||
+ | // stacklength "10ft","20ft","40ft","45ft","53ft" pur length stack | ||
+ | // TBD: Mixed length stacks, possibly with mixed height. | ||
+ | // No deeper thoughts about this yet. | ||
+ | //--------------------------------------------------------------------------- | ||
+ | Soup ObjectDataSoup = Constructors.NewSoup(); | ||
+ | //------------------------------------------------------------------------- | ||
+ | // LocationSoup { bbx int, bby int, // WorlCoordinate parameter | ||
+ | // px float, py float, pz float } | ||
+ | //--------------------------------------------------------------------------- | ||
+ | Soup LocationSoup = Constructors.NewSoup(); | ||
+ | //--------------------------------------------------------------------------- | ||
+ | // OrientationSoup { rx float, ry float, rz float, // in rad | ||
+ | // gx float, gy float, gz float } // in 1/10° | ||
+ | //--------------------------------------------------------------------------- | ||
+ | Soup OrientationSoup = Constructors.NewSoup(); | ||
+ | //--------------------------------------------------------------------------- | ||
+ | GameObjectID objectgoid = me.GetGameObjectID(); | ||
+ | string objecttype = "CONTSTACK"; | ||
+ | string stacklength; | ||
+ | string stackheight; // Used for stack types | ||
+ | Library dispobj; | ||
+ | GameObjectID dispgoid; | ||
+ | //--------------------------------------------------------------------------- | ||
+ | }; | ||
+ | </CODE> | ||
+ | File is located in dispatcher library. | ||
+ | |||
[[Category:ACTS]] | [[Category:ACTS]] |
Latest revision as of 00:27, 25 April 2024
Contents |
[edit] Container stack objects
[edit] Description
A stack may be reachable by more than one crane. It knows the asset specified maximum count of stackable containers and the stackable container types. Additionally it knows the next stackable container types and at which attachment points.
The maximum count of stackable containers has a special meaning for stack kinds that may stack multiple container types. Here the sense is the count of container layers.
There are different stack types: 10ftsc, 10fthc, 10ftschc, 20ftsc, 20fthc, 20ftschc, 40ftsc, 40fthc, 40ftschc, 45ftsc, 45fthc, 45ftschc,, 53ftsc, 53fthc and 53ftschc. These stacks have all a defined length for stackable containers.
Some more complex mixed stacks may be later implemented, such as stacks with mixed containers in multiple layer lines.
A stack is able to report its parameter soups including a list of the current stacked containers, the possibly next stackable container types as well as if it is full stacked.
TBD: The maximal count of stackable containers. Depends on maximum stackable containers from all reachable cranes and the z height of the stack in relation to the z height of the crane.
TBD: Container cars were considered as temporary stacks. The locations and rotations have to be calculated and the attachment points for container products has to be investigated and some were listed per asset within the aCTS global values or in an extensions sub-soup.
[edit] Asset files pre version 0.1
The files compile errorless and the messaging runs well. No more functionality implemented and tested in this pre version.
[edit] config.txt
XY is the KUID part, LL the length and HH or hh the height for the container type.
X 1 for 10ft, 2 for 20ft, 3 for 40ft, 4 for 45ft and 5 for 53ft Y 1 for standard height, 2 for heigh cube height and without Y for mixed heig cube and standard cube containers. LL the fitting length as 10, 20, 40, 45, 53 hh the fitting height as sc, hc, schc HH the fitting height as SC, HC, SCHC
kuid <kuid2:215489:11003XY:1> username "aCTS CONTSTACK LLft HH Scenery Utility V0.1" kind "Scenery" category-class "BU" description "aCTS CONTSTACK LLft HH Scenery Utility V0.1" trainz-build 4.6 surveyor-only 0 script "acts_contstack.gs" class "acts_contstack" kuid-table { scriptinclude <kuid2:215489:110000:1> } script-include-table { scriptinclude <kuid2:215489:110000:1> } mesh-table-lod-transition-distances 1000 mesh-detail-level-count 1 mesh-table { contstackLLfthh-lod0 { mesh "acts_stack_LLfthh.trainzmesh" auto-create 1 lod-level 0 effects { name { kind "name" name "GOID" att "a.name" font "swiss" fontsize 0.3 fontcolor 1.0,1.0,1.0 } } } } thumbnails { 0 { image "acts_contstack_LLfthh_thumb.jpg" width 240 height 180 } }
TBD: (???) For single length stacks there is no need to diferentiate the mesh container name, the mesh file name and the thumb file name in different heights, because there are no attachmentpoints used. (???)
[edit] acts_contstack.gs
include "acts_contstack_script.gs" //----------------------------------------------------------------------------- // aCTS Contstack V0.1 Central Script - acts_contstack.gs //----------------------------------------------------------------------------- // X acts_contstack <-- acts_contstack_script // acts_contstack_script <-- acts_contstack_register // acts_contstack_register <-- acts_contstack_globals // acts_contstack_globals <-- MapObject //----------------------------------------------------------------------------- class acts_contstack isclass acts_contstack_script { // -------------------------------------------------------------------------- // Mandatory INIT method // -------------------------------------------------------------------------- public void Init(Asset asset) { inherited(asset); //------------------------------------------------------------------------- // Make shure that the right module is set for World.GetCurrentModle() // (see world.gs lines 939ff.) to start driver related initiations and // tell me, if my Init and SetProperties methods are finished. // Add handler for my tasks as dispatcher. //------------------------------------------------------------------------- AddHandler(me, "World", "ModuleInit", "WorldInitHandler"); AddHandler(me, "OBJECTINIT", "", "ObjectInitHandler"); AddHandler(me, "DISPATCHER", "", "DispatcherHanlder"); //------------------------------------------------------------------------- // It's nessecary to initalise the lib to force subscript preparing //------------------------------------------------------------------------- dispobj = World.GetLibrary(GetAsset().LookupKUIDTable("scriptlib")); //------------------------------------------------------------------------- // Set asset special initial values //------------------------------------------------------------------------- dispgoid = dispobj.GetGameObjectID(); objecttype = "CONTSTACK_SC"; stacklength = "10ft"; //------------------------------------------------------------------------- isInitMethodFinnished = true; PostMessage(me,"OBJECTINIT","INIT_FINNISHED",0); // Init method finnished return; } //--------------------------------------------------------------------------- };
[edit] acts_contstack_script.gs
include "acts_contstack_globals.gs" include "acts_tools_script.gs" //----------------------------------------------------------------------------- // aCTS Contstack V0.1 Central Script - acts_contstack_script.gs //----------------------------------------------------------------------------- // acts_contstack <-- acts_contstack_script // X acts_contstack_script <-- acts_contstack_register // X acts_contstack_register <-- acts_contstack_globals // acts_contstack_globals <-- acts_global_values // acts_global_values <-- MapObject //----------------------------------------------------------------------------- class acts_contstack_register isclass acts_contstack_globals { //--------------------------------------------------------------------------- // TBD: Outsource from acts_container_script //--------------------------------------------------------------------------- }; class acts_contstack_script isclass acts_contstack_register { //--------------------------------------------------------------------------- public void SetProperties(Soup soup) // Callback method after Init method { inherited(soup); //------------------------------------------------------------------------- ObjectDataSoup.Copy(soup.GetNamedSoup("ObjectData")); LocationSoup.Copy(soup.GetNamedSoup("Location")); OrientationSoup.Copy(soup.GetNamedSoup("Orientation")); /*/------------------------------------------------------------------------- if (acts_debug) Interface.Log(Interface.GetTimeStamp() + " [" + objectgoid.SerialiseToString() + "]" + " CONTSTACK SETPROPERTIES SOUPS"); if (acts_debug) actsTools.ShowSoup(ObjectDataSoup,"ObjDS=>"); if (acts_debug) actsTools.ShowSoup(LocationSoup,"LocDS=>"); if (acts_debug) actsTools.ShowSoup(OrientationSoup,"OriDS=>"); //-------------------------------------------------------------------------*/ isSetPropertiesMethodFinnished = true; PostMessage(me,"OBJECTINIT","SETPROPS_FINNISHED",0.0); return; } //--------------------------------------------------------------------------- public Soup GetProperties(void) // Callback method before closing session { Soup soup = inherited(); //------------------------------------------------------------------------- soup.SetNamedSoup("ObjectData",ObjectDataSoup); soup.SetNamedSoup("Location",LocationSoup); soup.SetNamedSoup("Orientation",OrientationSoup); //------------------------------------------------------------------------- if (acts_debug) Interface.Log(Interface.GetTimeStamp() + " [" + objectgoid.SerialiseToString() + "]" + " CONTSTACK GETPROPERTIES SOUPS"); if (acts_debug) actsTools.ShowSoup(ObjectDataSoup,"ObjDS=>"); if (acts_debug) actsTools.ShowSoup(LocationSoup,"LocDS=>"); if (acts_debug) actsTools.ShowSoup(OrientationSoup,"OriDS=>"); //-------------------------------------------------------------------------*/ return soup; } //--------------------------------------------------------------------------- public void WorldInitHandler(Message msg) { //------------------------------------------------------------------------- if (acts_debug)Interface.Log(Interface.GetTimeStamp() + " [" + objectgoid.SerialiseToString() + "]" + " CONTSTACK GOT WORLDINIT MESSAGE [" + msg.major+"] ["+msg.minor+"]"); //-------------------------------------------------------------------------*/ // If one of the two methods (Init or SetProperties) isn't finished yet, // post "World","ModuleInit" message a little bit later again. // So it is guaranteed that the Init and SetProperties methods are finished // as well as the "World","ModuleInit" message tells to be save using the // World.GetCurrentModule method. //------------------------------------------------------------------------- if (!(isSetPropertiesMethodFinnished and isInitMethodFinnished)) { PostMessage(me, "World", "ModuleInit", 0.1); } //------------------------------------------------------------------------- isWorldInitFinnished = true; PostMessage(me, "OBJECTINIT", "WORLD_INIT_FINNISHED", 0.0); //------------------------------------------------------------------------- return; } //--------------------------------------------------------------------------- public void ObjectInitHandler(Message msg) { //------------------------------------------------------------------------- // Until the Trainz core send the "World","ModuleInit" was send it is not // guarented to decide with the World.GetCurrentModule method to be in the // returned module! //------------------------------------------------------------------------- if (acts_debug)Interface.Log(Interface.GetTimeStamp() + " [" + objectgoid.SerialiseToString() + "]" + " CONTSTACK GOT MESSAGE ["+msg.major+"] ["+msg.minor+"]"); //-------------------------------------------------------------------------*/ if (msg.dst==me and msg.major=="OBJECTINIT") { if (msg.minor=="INIT_FINNISHED") { //--------------------------------------------------------------------- // Show the goid on both sides of me (for debugging purpose) //--------------------------------------------------------------------- SetFXNameText("GOID","["+objectgoid.SerialiseToString()+"]"); //--------------------------------------------------------------------- } //----------------------------------------------------------------------- if (msg.minor=="SETPROPS_FINNISHED") { if (ObjectDataSoup.CountTags()==0) { //------------------------------------------------------------------- // LoadRegisterDataInfos(RegisterDataSoup); //------------------------------------------------------------------- ObjectDataSoup.SetNamedTag("goid",objectgoid); ObjectDataSoup.SetNamedTag("type","CONTSTACK"); ObjectDataSoup.SetNamedTag("length",stacklength); ObjectDataSoup.SetNamedTag("height",stackheight); ObjectDataSoup.SetNamedTag("regID",-1); ObjectDataSoup.SetNamedTag("active",false); // False: Not reachable ObjectDataSoup.SetNamedTag("requested",false); ObjectDataSoup.SetNamedTag("blocked",false); } //--------------------------------------------------------------------- if (acts_debug)Interface.Log(Interface.GetTimeStamp() + " =>SOUP 'ObjectDataSoup'"); if (acts_debug)actsTools.ShowSoup(ObjectDataSoup,"=>"); //---------------------------------------------------------------------*/ if (LocationSoup.CountTags()==0) { //------------------------------------------------------------------- // LoadLocationDataInfos(LocationDataSoup); //------------------------------------------------------------------- WorldCoordinate WC = me.GetMapObjectPosition(); LocationSoup.SetNamedTag("bbx",WC.baseboardX); LocationSoup.SetNamedTag("bby",WC.baseboardY); LocationSoup.SetNamedTag("px",WC.x); LocationSoup.SetNamedTag("py",WC.y); LocationSoup.SetNamedTag("pz",WC.z); } //--------------------------------------------------------------------- if (OrientationSoup.CountTags()==0) { //------------------------------------------------------------------- // LoadOrientationDataInfos(OrientationDataSoup); //------------------------------------------------------------------- Orientation OR = me.GetMapObjectOrientation(); LocationSoup.SetNamedTag("rx",OR.rx); LocationSoup.SetNamedTag("ry",OR.ry); LocationSoup.SetNamedTag("rz",OR.rz); LocationSoup.SetNamedTag("gx",OR.rx*180.0/Math.PI); LocationSoup.SetNamedTag("gy",OR.ry*180.0/Math.PI); LocationSoup.SetNamedTag("gz",OR.rz*180.0/Math.PI); } //--------------------------------------------------------------------- // TBD: Adjust position and rotation to rounded values and handle // the different pssibilities. // (some methods see acts_tools_script.gs) //--------------------------------------------------------------------- // Soup sp = actsTools.AutoAdjustMapObject(me); // LocationSoup = sp.GetNamedSoup("AdjustedLocationSoup"); // OrientationSoup = sp.GetNamedSoup("AdjustedOrientationSoup"); //--------------------------------------------------------------------- } } } //--------------------------------------------------------------------------- public void DispatcherHandler(Message msg) { if (msg.dst==me and msg.major=="DISPATCHER") { //----------------------------------------------------------------------- if (acts_debug)Interface.Log(Interface.GetTimeStamp() + " ["+objectgoid.SerialiseToString()+"]" + " CONTSTACK GOT MESSAGE FROM DISPATCHER" + (cast<GameObject>msg.src).GetGameObjectID().SerialiseToString() + "] ["+msg.major+"] ["+msg.minor+"]"); //-----------------------------------------------------------------------*/ if (msg.minor=="OBJECTSOUP_UPDATED") { //--------------------------------------------------------------------- // Update the own ObjectDataSoup //--------------------------------------------------------------------- ObjectDataSoup.Copy(cast<Soup>msg.paramSoup); //---------------------------------------------------------------------*/ } if (msg.minor=="OBJECTSOUP_INSERTED") { //--------------------------------------------------------------------- // Update the own ObjectDataSoup //--------------------------------------------------------------------- ObjectDataSoup.Copy(cast<Soup>msg.paramSoup); //---------------------------------------------------------------------*/ } if (msg.minor=="OBJECTSOUP_APPENDED") { //--------------------------------------------------------------------- // Update the own ObjectDataSoup //--------------------------------------------------------------------- ObjectDataSoup.Copy(cast<Soup>msg.paramSoup); //---------------------------------------------------------------------*/ } } //------------------------------------------------------------------------- return; } };
File is located in dispatcher library.
[edit] acts_contstack_globals.gs
include "acts_global_values.gs" //----------------------------------------------------------------------------- // aCTS Contstack V0.1 Central Script - acts_contstack_script.gs //----------------------------------------------------------------------------- // acts_contstack <-- acts_contstack_script // acts_contstack_script <-- acts_contstack_register // acts_contstack_register <-- acts_contstack_globals // X acts_contstack_globals <-- acts_global_values // acts_global_values <-- MapObject //----------------------------------------------------------------------------- class acts_contstack_globals isclass acts_global_values { //--------------------------------------------------------------------------- // AssetInstanceSoup { // X ObjectDataSoup { ... }, Only container, contstack, contcrane // X LocationSoup { ... }, Only container, contstack, contcrane // X OrientationSoup { ... }, Only container, contstack, contcrane // SkinDataSoup { ... }, Only container // ContentDataSoup { ... }, Only container // DispatcherDataSoup { ... } Only dispatcher // ContainerSoups { ... } Only dispatcher // ContstackSoups { ... } Only dispatcher // ContcraneSoups { ... } Only dispatcher // } //--------------------------------------------------------------------------- // ObjectDataSoup { goid GameObjectID, type string, // length string, height string, // stack goid, place int, Only container // active bool, action string }, // activ: true means the object sended a register message while session run // All objects were set false while initialising dispatcher and if // they stay false their entries will be deleted next initialising. // actions: ["APPENDED", "INSERTED", "UPDATED"]; //--------------------------------------------------------------------------- // Container stack types: // stackheight "sc","hc" pur height stack (standard or heigh cube) // "schc" mixed height // stacklength "10ft","20ft","40ft","45ft","53ft" pur length stack // TBD: Mixed length stacks, possibly with mixed height. // No deeper thoughts about this yet. //--------------------------------------------------------------------------- Soup ObjectDataSoup = Constructors.NewSoup(); //------------------------------------------------------------------------- // LocationSoup { bbx int, bby int, // WorlCoordinate parameter // px float, py float, pz float } //--------------------------------------------------------------------------- Soup LocationSoup = Constructors.NewSoup(); //--------------------------------------------------------------------------- // OrientationSoup { rx float, ry float, rz float, // in rad // gx float, gy float, gz float } // in 1/10° //--------------------------------------------------------------------------- Soup OrientationSoup = Constructors.NewSoup(); //--------------------------------------------------------------------------- GameObjectID objectgoid = me.GetGameObjectID(); string objecttype = "CONTSTACK"; string stacklength; string stackheight; // Used for stack types Library dispobj; GameObjectID dispgoid; //--------------------------------------------------------------------------- };
File is located in dispatcher library.