From ca26ad91ee329c9ad467698d136e5caceb8beedd Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Sat, 29 Oct 2011 16:55:23 +0300 Subject: [PATCH] Get and persist bone names properly. Objects attached to other object's bones will be now stored and loaded properly, for both clipboard and database. --- qcsrc/server/mutators/sandbox.qc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index f67886652..9047f6684 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -167,14 +167,22 @@ string sandbox_ObjectPort_Save(entity e, float database) for(head = world; (head = find(head, classname, "object")); ) { - // the main object needs to be first in the array [0], with attached objects following + // the main object needs to be first in the array [0] with attached objects following float slot; - if(head == e) // this is the main object, make it first + string tagindex; + if(head == e) // this is the main object, place it first + { slot = 0; + tagindex = string_null; + } else if(head.owner == e) // child object, list them in order { i += 1; // children start from 1 slot = i; + + // get the name of the tag our object is attached to + gettaginfo(head.owner, head.tag_index); + tagindex = gettaginfo_name; } else continue; @@ -189,7 +197,7 @@ string sandbox_ObjectPort_Save(entity e, float database) port_string[slot] = strcat(port_string[slot], ftos(head.movetype), " "); port_string[slot] = strcat(port_string[slot], ftos(head.damageforcescale), " "); if(head.material) port_string[slot] = strcat(port_string[slot], "\"", head.material, "\" "); else port_string[slot] = strcat(port_string[slot], "- "); // none - gettaginfo(head, 0); if(gettaginfo_name) port_string[slot] = strcat(port_string[slot], "\"", gettaginfo_name, "\" "); else port_string[slot] = strcat(port_string[slot], "- "); // none + if(tagindex) port_string[slot] = strcat(port_string[slot], "\"", tagindex, "\" "); else port_string[slot] = strcat(port_string[slot], "- "); // none if(database) { if(head.crypto_idfp) port_string[slot] = strcat(port_string[slot], "\"", head.crypto_idfp, "\" "); else port_string[slot] = strcat(port_string[slot], "- "); // none -- 2.39.2