Jump to content

2 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

Hi, I'm trying to call some things whenever a road gets built, I tried doing this but whenever I build a road the startNodeID.m_position.y is something like 260

Array16<NetSegment> lastRememberedNodes;
void Update(){
  for (int i = 0; i < Singleton<NetManager>.instance.m_segments.m_buffer.Length; i++)
                {
                    NetSegment item = Singleton<NetManager>.instance.m_segments.m_buffer[i];

                    if (item.m_flags != lastRememberedNodes.m_buffer[i].m_flags)
                    {

                        NetNode startNodeID = NetManager.instance.m_nodes.m_buffer[item.m_startNode];
                        NetNode endNodeID = NetManager.instance.m_nodes.m_buffer[item.m_endNode];
                        lastRememberedNodes.m_buffer[i].m_flags = item.m_flags;
                        Send("ROADBUILT|" + startNodeID.m_position.x + "|" + startNodeID.m_position.y + "|" + startNodeID.m_position.z + "|" + startNodeID.m_infoIndex + "|" + startNodeID.m_buildIndex + "|" + endNodeID.m_position.x + "|" + endNodeID.m_position.y + "|" + endNodeID.m_position.z + "|" + endNodeID.m_infoIndex +"|" + endNodeID.m_buildIndex + "|" + Singleton<NetManager>.instance.m_segments.m_buffer[i].m_infoIndex + "|" + Singleton<NetManager>.instance.m_segments.m_buffer[i].m_buildIndex + "|" + Singleton<NetManager>.instance.m_segments.m_buffer[i].m_modifiedIndex);
                        DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, "IM  A GIRAFFE " + startNodeID.m_position.y);
                        break;
                    }
                }
}

And when I initialize it here:

 DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, "building a road");
                        ColossalFramework.Math.Randomizer ra = new ColossalFramework.Math.Randomizer();
                        uint startNodeBuildIndex = uint.Parse(aData[4]);
                        NetInfo startNodeInfo = PrefabCollection<NetInfo>.GetLoaded(startNodeBuildIndex);
                        ushort startNodeID;
                        NetManager.instance.CreateNode(out startNodeID, ref ra, startNodeInfo, new Vector3(float.Parse(aData[1]), float.Parse(aData[2]), float.Parse(aData[3])), uint.Parse(aData[5]));
                        DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, "building a road 1");
                        uint endNodeBuildIndex = uint.Parse(aData[9]);
                        NetInfo endtNodeInfo = PrefabCollection<NetInfo>.GetLoaded(endNodeBuildIndex);
                        ushort endNodeID;
                        NetManager.instance.CreateNode(out endNodeID, ref ra, endtNodeInfo, new Vector3(float.Parse(aData[5]), float.Parse(aData[6]), float.Parse(aData[7])), uint.Parse(aData[10]));
                        DebugOutputPanel.AddMessage(PluginManager.MessageType.Message, "building a road 2");
                        ushort segmentID;
                        NetInfo segmentInfo = PrefabCollection<NetInfo>.GetLoaded(uint.Parse(aData[11]));
                        NetManager.instance.CreateSegment(out segmentID, ref ra, segmentInfo, startNodeID, endNodeID, new Vector3(float.Parse(aData[1]), float.Parse(aData[2]), float.Parse(aData[3])), new Vector3(float.Parse(aData[5]), float.Parse(aData[6]), float.Parse(aData[7])), uint.Parse(aData[12]), uint.Parse(aData[13]), false);
                        lastRememberedNodes = NetManager.instance.m_segments;

It just creates a floation road in the middle of nowhere.

Help please :?

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

I would need to look at the entire mod to be able to help, do you have a github repo, or can you send me the source code?

Share this post


Link to post
Share on other sites

Sign In or register to comment...

To comment in reply, you must be a community member

Sign In  

Already have an account? Sign in here.

Sign In Now

Create an Account  

Sign up to join our friendly community. It's easy!  

Register a New Account


×

Thank You for the Continued Support!

Simtropolis depends on donations to fund site maintenance costs.
Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

Make a Donation, Get a Gift!

Expand your city with the best from the Simtropolis Exchange.
Make a Donation and get one or all three discs today!

STEX Collections

By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

Each donation helps keep Simtropolis online, open and free!

Thank you for reading and enjoy the site!

More About STEX Collections