]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Attempt to persist attached objects in storage and clipboard, part 1: Store child...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 28 Oct 2011 19:49:02 +0000 (22:49 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 28 Oct 2011 19:49:02 +0000 (22:49 +0300)
qcsrc/server/mutators/sandbox.qc

index 2495fdb9849ea619fc6458220e09edd0a937c701..a776613ef227eadf77a1f9395128213d152d9ee6 100644 (file)
@@ -150,12 +150,10 @@ void sandbox_ObjectRemove(entity e)
        object_count -= 1;
 }
 
-string sandbox_ObjectPort_Save(entity e, float database)
+string sandbox_ObjectPort_Save_string(entity e, float database)
 {
-       // save object properties
        string s;
-
-       s = strcat(e.model, " ");
+       s = strcat(s, e.model, " ");
        s = strcat(s, ftos(e.skin), " ");
        s = strcat(s, ftos(e.alpha), " ");
        s = strcat(s, sprintf("\"%.9v\"", e.colormod), " ");
@@ -171,6 +169,22 @@ string sandbox_ObjectPort_Save(entity e, float database)
                s = strcat(s, sprintf("\"%.9v\"", e.origin), " ");
                s = strcat(s, sprintf("\"%.9v\"", e.angles), " ");
        }
+       s = strcat(s, "; ");
+       return s;
+}
+string sandbox_ObjectPort_Save(entity e, float database)
+{
+       // save object properties
+       string s;
+       entity head;
+
+       // first set the properties of the main object, then those of each child
+       s = sandbox_ObjectPort_Save_string(e, database);
+       for(head = world; (head = find(head, classname, "object")); )
+       {
+               if(head.owner == e)
+                       s = strcat(s, sandbox_ObjectPort_Save_string(head, database));
+       }
 
        return s;
 }