From: Mircea Kitsune Date: Sat, 29 Oct 2011 13:55:23 +0000 (+0300) Subject: Get and persist bone names properly. Objects attached to other object's bones will... X-Git-Tag: xonotic-v0.6.0~35^2~18^2~47 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ca26ad91ee329c9ad467698d136e5caceb8beedd;p=xonotic%2Fxonotic-data.pk3dir.git 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. --- 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