Some very basic terraforming, can raise and lower the terrain, but currently only a very basic brush algorithm (and can't change the brushes size)

This commit is contained in:
MW
2007-03-30 16:50:19 +00:00
parent ef4cae5587
commit bcae0bce85
4 changed files with 286 additions and 213 deletions

View File

@@ -424,6 +424,38 @@ namespace OpenSim
//OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Received DeRezObject packet");
m_world.DeRezObject((DeRezObjectPacket)Pack, this);
break;
case PacketType.ModifyLand:
ModifyLandPacket modify = (ModifyLandPacket)Pack;
switch (modify.ModifyBlock.Action)
{
case 1:
if (modify.ParcelData.Length > 0)
{
int mody = (int) modify.ParcelData[0].North;
int modx = (int) modify.ParcelData[0].West;
this.m_world.LandMap[(mody * 256) + modx -1 ] += 0.1f;
this.m_world.LandMap[(mody * 256) + modx] += 0.2f;
this.m_world.LandMap[(mody * 256) + modx + 1] += 0.1f;
this.m_world.LandMap[((mody+1) * 256) + modx] += 0.1f;
this.m_world.LandMap[((mody -1) * 256) + modx] += 0.1f;
m_world.RegenerateTerrain(true, modx, mody);
}
break;
case 2:
if (modify.ParcelData.Length > 0)
{
int mody = (int)modify.ParcelData[0].North;
int modx = (int)modify.ParcelData[0].West;
this.m_world.LandMap[(mody * 256) + modx - 1] -= 0.1f;
this.m_world.LandMap[(mody * 256) + modx] -= 0.2f;
this.m_world.LandMap[(mody * 256) + modx + 1] -= 0.1f;
this.m_world.LandMap[((mody + 1) * 256) + modx] -= 0.1f;
this.m_world.LandMap[((mody - 1) * 256) + modx] -= 0.1f;
m_world.RegenerateTerrain(true, modx, mody);
}
break;
}
break;
}
}