Reddo il y a 5 ans
Parent
commit
21b8a86208

+ 25 - 1
app/World/Classes/Things/Humanoid/Humanoid.ts

@@ -314,9 +314,20 @@ class Humanoid extends Person {
             }
         });
 
+        this.addGetAlterations((humanoid : Humanoid) => {
+            // Let's not do this for NPCs. It can break patches.
+            let allParts = this.getParts();
+            let changes = {};
+            for (let i = 0; i < allParts.length; i++) {
+                let part = <Bodypart> allParts[i];
+                changes[part.getName()] = part.getChanges();
+            }
+            return {bodyparts : changes};
+        });
+
         this.addSetAlterations((humanoid : Humanoid, changes) => {
             // Let's not do this for NPCs. It can break patches.
-            if (humanoid.isPlayer()) {
+            if (changes.HumanoidGender != undefined) {
                 humanoid.removeGenderedParts();
                 if (changes.HumanoidGender == Humanoid.SEX_MALE) {
                     humanoid.addMaleParts();
@@ -327,6 +338,19 @@ class Humanoid extends Person {
                     humanoid.addFemaleParts();
                 }
             }
+
+            this.addSetAlterations((humanoid : Humanoid, changes : any) => {
+                if (changes.bodyparts != undefined) {
+                    let bpChanges = <any>changes.bodyparts;
+                    let allParts = this.getParts();
+                    for (let i = 0; i < allParts.length; i++) {
+                        let part = <Bodypart>allParts[i];
+                        if (bpChanges[part.getName()] != undefined) {
+                            part.setChanges(bpChanges[part.getName()]);
+                        }
+                    }
+                }
+            });
         });
     }
 

+ 5 - 0
app/World/Classes/Things/Person.ts

@@ -36,6 +36,11 @@ class Person extends Thing implements AttributeBearer, SkillBearer {
             }
         });
 
+        // We *should* have the bodypart thing here, but there are issues with Humanoids and that...
+        // this.addGetAlterations((person : Person) => {
+        //
+        // });
+
         this.addSetAlterations((person : Person, changes) => {
             // Let's not do this for NPCs. It can break patches.
             if (person.isPlayer()) {