aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/world
diff options
context:
space:
mode:
authorMW2007-03-08 18:07:53 +0000
committerMW2007-03-08 18:07:53 +0000
commitaa120266d79b87b39bf80f3f7aaca8970447bde1 (patch)
treececae22f2d8b2fc7541a011d2db86f819901c51f /src/world
parentChanged water height to default of 20 (diff)
downloadopensim-SC_OLD-aa120266d79b87b39bf80f3f7aaca8970447bde1.zip
opensim-SC_OLD-aa120266d79b87b39bf80f3f7aaca8970447bde1.tar.gz
opensim-SC_OLD-aa120266d79b87b39bf80f3f7aaca8970447bde1.tar.bz2
opensim-SC_OLD-aa120266d79b87b39bf80f3f7aaca8970447bde1.tar.xz
Primitive's shape and scale are now saved into database and reloaded.
New ServerConsole command: regenerate - will regenerate the terrain of the whole sim.
Diffstat (limited to 'src/world')
-rw-r--r--src/world/Primitive.cs101
-rw-r--r--src/world/World.cs15
2 files changed, 104 insertions, 12 deletions
diff --git a/src/world/Primitive.cs b/src/world/Primitive.cs
index 6029f76..0d7d951 100644
--- a/src/world/Primitive.cs
+++ b/src/world/Primitive.cs
@@ -15,6 +15,7 @@ namespace OpenSim.world
15 protected PrimData primData; 15 protected PrimData primData;
16 protected bool newPrimFlag; 16 protected bool newPrimFlag;
17 protected bool updateFlag; 17 protected bool updateFlag;
18 protected bool dirtyFlag;
18 protected ObjectUpdatePacket OurPacket; 19 protected ObjectUpdatePacket OurPacket;
19 20
20 public bool UpdateFlag 21 public bool UpdateFlag
@@ -28,7 +29,18 @@ namespace OpenSim.world
28 updateFlag = value; 29 updateFlag = value;
29 } 30 }
30 } 31 }
31 32 public LLVector3 Scale
33 {
34 set
35 {
36 this.primData.Scale = value;
37 this.dirtyFlag = true;
38 }
39 get
40 {
41 return this.primData.Scale;
42 }
43 }
32 public Primitive() 44 public Primitive()
33 { 45 {
34 mesh_cutbegin = 0.0f; 46 mesh_cutbegin = 0.0f;
@@ -70,6 +82,13 @@ namespace OpenSim.world
70 } 82 }
71 this.updateFlag = false; 83 this.updateFlag = false;
72 } 84 }
85 else if(this.dirtyFlag)
86 {
87 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
88 UpdateClient(client);
89 }
90 this.dirtyFlag = false;
91 }
73 92
74 } 93 }
75 94
@@ -77,9 +96,58 @@ namespace OpenSim.world
77 { 96 {
78 byte[] pb = this.position.GetBytes(); 97 byte[] pb = this.position.GetBytes();
79 Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length); 98 Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length);
99 OurPacket.ObjectData[0].OwnerID = this.primData.OwnerID;
100 OurPacket.ObjectData[0].PCode = this.primData.PCode;
101 OurPacket.ObjectData[0].PathBegin = this.primData.PathBegin;
102 OurPacket.ObjectData[0].PathEnd = this.primData.PathEnd;
103 OurPacket.ObjectData[0].PathScaleX = this.primData.PathScaleX;
104 OurPacket.ObjectData[0].PathScaleY = this.primData.PathScaleY;
105 OurPacket.ObjectData[0].PathShearX = this.primData.PathShearX;
106 OurPacket.ObjectData[0].PathShearY = this.primData.PathShearY;
107 OurPacket.ObjectData[0].PathSkew = this.primData.PathSkew;
108 OurPacket.ObjectData[0].ProfileBegin = this.primData.ProfileBegin;
109 OurPacket.ObjectData[0].ProfileEnd = this.primData.ProfileEnd;
110 OurPacket.ObjectData[0].Scale = this.primData.Scale;
111 OurPacket.ObjectData[0].PathCurve = this.primData.PathCurve;
112 OurPacket.ObjectData[0].ProfileCurve = this.primData.ProfileCurve;
113 OurPacket.ObjectData[0].ParentID = 0;
114 OurPacket.ObjectData[0].ProfileHollow = this.primData.ProfileHollow;
115 //finish off copying rest of shape data
116 OurPacket.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset;
117 OurPacket.ObjectData[0].PathRevolutions = this.primData.PathRevolutions;
118 OurPacket.ObjectData[0].PathTaperX = this.primData.PathTaperX;
119 OurPacket.ObjectData[0].PathTaperY = this.primData.PathTaperY;
120 OurPacket.ObjectData[0].PathTwist = this.primData.PathTwist;
121 OurPacket.ObjectData[0].PathTwistBegin= this.primData.PathTwistBegin;
122
80 RemoteClient.OutPacket(OurPacket); 123 RemoteClient.OutPacket(OurPacket);
81 } 124 }
82 125
126 public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket)
127 {
128 this.primData.PathBegin = addPacket.PathBegin;
129 this.primData.PathEnd = addPacket.PathEnd;
130 this.primData.PathScaleX = addPacket.PathScaleX;
131 this.primData.PathScaleY = addPacket.PathScaleY;
132 this.primData.PathShearX = addPacket.PathShearX;
133 this.primData.PathShearY = addPacket.PathShearY;
134 this.primData.PathSkew = addPacket.PathSkew;
135 this.primData.ProfileBegin = addPacket.ProfileBegin;
136 this.primData.ProfileEnd = addPacket.ProfileEnd;
137 this.primData.PathCurve = addPacket.PathCurve;
138 this.primData.ProfileCurve = addPacket.ProfileCurve;
139 this.primData.ProfileHollow = addPacket.ProfileHollow;
140
141 this.primData.PathRadiusOffset = addPacket.PathRadiusOffset;
142 this.primData.PathRevolutions = addPacket.PathRevolutions;
143 this.primData.PathTaperX = addPacket.PathTaperX;
144 this.primData.PathTaperY = addPacket.PathTaperY;
145 this.primData.PathTwist = addPacket.PathTwist;
146 this.primData.PathTwistBegin =addPacket.PathTwistBegin;
147 this.dirtyFlag = true;
148
149 }
150
83 public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID) 151 public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID)
84 { 152 {
85 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 153 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
@@ -124,6 +192,13 @@ namespace OpenSim.world
124 PData.ParentID = objupdate.ObjectData[0].ParentID = 0; 192 PData.ParentID = objupdate.ObjectData[0].ParentID = 0;
125 PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow; 193 PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow;
126 194
195 PData.PathRadiusOffset = objupdate.ObjectData[0].PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
196 PData.PathRevolutions = objupdate.ObjectData[0].PathRevolutions = addPacket.ObjectData.PathRevolutions;
197 PData.PathTaperX = objupdate.ObjectData[0].PathTaperX = addPacket.ObjectData.PathTaperX;
198 PData.PathTaperY = objupdate.ObjectData[0].PathTaperY = addPacket.ObjectData.PathTaperY;
199 PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist;
200 PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
201
127 //finish off copying rest of shape data 202 //finish off copying rest of shape data
128 203
129 objupdate.ObjectData[0].ID = (uint)(localID); 204 objupdate.ObjectData[0].ID = (uint)(localID);
@@ -143,7 +218,7 @@ namespace OpenSim.world
143 this.OurPacket = objupdate; 218 this.OurPacket = objupdate;
144 } 219 }
145 220
146 public void CreateFromStorage(PrimStorage store) 221 public void CreateFromStorage(PrimData store)
147 { 222 {
148 //need to clean this up as it shares a lot of code with CreateFromPacket() 223 //need to clean this up as it shares a lot of code with CreateFromPacket()
149 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 224 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
@@ -151,7 +226,7 @@ namespace OpenSim.world
151 objupdate.RegionData.TimeDilation = 64096; 226 objupdate.RegionData.TimeDilation = 64096;
152 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; 227 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
153 228
154 this.primData = store.Data; 229 this.primData = store;
155 objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); 230 objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
156 objupdate.ObjectData[0].PSBlock = new byte[0]; 231 objupdate.ObjectData[0].PSBlock = new byte[0];
157 objupdate.ObjectData[0].ExtraParams = new byte[1]; 232 objupdate.ObjectData[0].ExtraParams = new byte[1];
@@ -187,6 +262,12 @@ namespace OpenSim.world
187 objupdate.ObjectData[0].ParentID = 0; 262 objupdate.ObjectData[0].ParentID = 0;
188 objupdate.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; 263 objupdate.ObjectData[0].ProfileHollow = this.primData.ProfileHollow;
189 //finish off copying rest of shape data 264 //finish off copying rest of shape data
265 objupdate.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset;
266 objupdate.ObjectData[0].PathRevolutions = this.primData.PathRevolutions;
267 objupdate.ObjectData[0].PathTaperX = this.primData.PathTaperX;
268 objupdate.ObjectData[0].PathTaperY = this.primData.PathTaperY;
269 objupdate.ObjectData[0].PathTwist = this.primData.PathTwist;
270 objupdate.ObjectData[0].PathTwistBegin= this.primData.PathTwistBegin;
190 271
191 objupdate.ObjectData[0].ID = (uint)store.LocalID; 272 objupdate.ObjectData[0].ID = (uint)store.LocalID;
192 objupdate.ObjectData[0].FullID = store.FullID; 273 objupdate.ObjectData[0].FullID = store.FullID;
@@ -203,6 +284,7 @@ namespace OpenSim.world
203 this.localid = objupdate.ObjectData[0].ID; 284 this.localid = objupdate.ObjectData[0].ID;
204 this.position = pos1; 285 this.position = pos1;
205 this.OurPacket = objupdate; 286 this.OurPacket = objupdate;
287
206 } 288 }
207 public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() 289 public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock()
208 { 290 {
@@ -272,13 +354,12 @@ namespace OpenSim.world
272 354
273 public override void BackUp() 355 public override void BackUp()
274 { 356 {
275 PrimStorage pStore = new PrimStorage(); 357
276 pStore.Data = this.primData; 358 this.primData.FullID = this.uuid;
277 pStore.FullID = this.uuid; 359 this.primData.LocalID = this.localid;
278 pStore.LocalID = this.localid; 360 this.primData.Position = this.position;
279 pStore.Position = this.position; 361 this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z , this.rotation.w);
280 pStore.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z , this.rotation.w); 362 OpenSim_Main.local_world.localStorage.StorePrim(this.primData);
281 OpenSim_Main.local_world.localStorage.StorePrim(pStore);
282 } 363 }
283 } 364 }
284 365
diff --git a/src/world/World.cs b/src/world/World.cs
index 6be9dd2..fb78819 100644
--- a/src/world/World.cs
+++ b/src/world/World.cs
@@ -71,7 +71,7 @@ namespace OpenSim.world
71 71
72 //backup world data 72 //backup world data
73 this.storageCount++; 73 this.storageCount++;
74 if(storageCount> 1200) //set to how often you want to backup (currently set for about every 2 minutes) 74 if(storageCount> 300) //set to how often you want to backup
75 { 75 {
76 this.Backup(); 76 this.Backup();
77 storageCount =0; 77 storageCount =0;
@@ -107,13 +107,24 @@ namespace OpenSim.world
107 return(store == null); 107 return(store == null);
108 } 108 }
109 109
110 public void RegenerateTerrain()
111 {
112 HeightmapGenHills hills = new HeightmapGenHills();
113 this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
114 this.phyScene.SetTerrain(this.LandMap);
115 OpenSim_Main.cfg.SaveMap();
116
117 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
118 this.SendLayerData(client);
119 }
120 }
110 public void LoadPrimsFromStorage() 121 public void LoadPrimsFromStorage()
111 { 122 {
112 ServerConsole.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives"); 123 ServerConsole.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives");
113 this.localStorage.LoadPrimitives(this); 124 this.localStorage.LoadPrimitives(this);
114 } 125 }
115 126
116 public void PrimFromStorage(PrimStorage prim) 127 public void PrimFromStorage(PrimData prim)
117 { 128 {
118 if(prim.LocalID >= this._primCount) 129 if(prim.LocalID >= this._primCount)
119 { 130 {