Browse Source

Adds default clothing changes broadcast to other clients

tickets/32/32/1
Edmond Mondor 2 years ago
parent
commit
587414dfa5
  1. 8
      Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
  2. 4
      Sources/Plasma/FeatureLib/pfPython/cyMisc.h
  3. 8
      Sources/Plasma/FeatureLib/pfPython/cyMiscGlue3.cpp
  4. 8
      Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp
  5. 14
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp
  6. 4
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.h

8
Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp

@ -2602,7 +2602,7 @@ void cyMisc::WearMaintainerSuit(pyKey& key, hsBool wear)
} }
void cyMisc::WearDefaultClothing(pyKey& key) void cyMisc::WearDefaultClothing(pyKey& key, hsBool broadcast)
{ {
if (key.getKey() != plNetClientMgr::GetInstance()->GetLocalPlayerKey()) if (key.getKey() != plNetClientMgr::GetInstance()->GetLocalPlayerKey())
return; return;
@ -2611,11 +2611,11 @@ void cyMisc::WearDefaultClothing(pyKey& key)
if (avMod) if (avMod)
{ {
avMod->GetClothingOutfit()->WearDefaultClothing(); avMod->GetClothingOutfit()->WearDefaultClothing(broadcast);
} }
} }
void cyMisc::WearDefaultClothingType(pyKey& key, UInt32 type) void cyMisc::WearDefaultClothingType(pyKey& key, UInt32 type, hsBool broadcast)
{ {
if (key.getKey() != plNetClientMgr::GetInstance()->GetLocalPlayerKey()) if (key.getKey() != plNetClientMgr::GetInstance()->GetLocalPlayerKey())
return; return;
@ -2624,7 +2624,7 @@ void cyMisc::WearDefaultClothingType(pyKey& key, UInt32 type)
if (avMod) if (avMod)
{ {
avMod->GetClothingOutfit()->WearDefaultClothingType(type); avMod->GetClothingOutfit()->WearDefaultClothingType(type, broadcast);
} }
} }

4
Sources/Plasma/FeatureLib/pfPython/cyMisc.h

@ -875,8 +875,8 @@ public:
// //
static void WearMaintainerSuit(pyKey& key, hsBool wear); static void WearMaintainerSuit(pyKey& key, hsBool wear);
static void WearDefaultClothing(pyKey& key); static void WearDefaultClothing(pyKey& key, hsBool broadcast = false);
static void WearDefaultClothingType(pyKey& key, UInt32 type); static void WearDefaultClothingType(pyKey& key, UInt32 type, hsBool broadcast = false);
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //

8
Sources/Plasma/FeatureLib/pfPython/cyMiscGlue3.cpp

@ -598,11 +598,13 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtFakeLinkAvatarToObject, args, "Params: avatar,
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
} }
PYTHON_GLOBAL_METHOD_DEFINITION(PtWearDefaultClothingType, args, "Params: key,type\nForces the avatar to wear the default clothing of the specified type") PYTHON_GLOBAL_METHOD_DEFINITION_WKEY(PtWearDefaultClothingType, args, kw, "Params: key,type,broadcast=false\nForces the avatar to wear the default clothing of the specified type")
{ {
char* kwlist[] = { "broadcast", NULL };
PyObject* keyObj = NULL; PyObject* keyObj = NULL;
unsigned long type; unsigned long type;
if (!PyArg_ParseTuple(args, "Ol", &keyObj, &type)) bool broadcast = false;
if (!PyArg_ParseTupleAndKeywords(args, kw, "Ol|b", kwlist, &keyObj, &type, &broadcast))
{ {
PyErr_SetString(PyExc_TypeError, "PtWearDefaultClothingType expects a ptKey and an unsigned long"); PyErr_SetString(PyExc_TypeError, "PtWearDefaultClothingType expects a ptKey and an unsigned long");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
@ -613,7 +615,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtWearDefaultClothingType, args, "Params: key,ty
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
pyKey* key = pyKey::ConvertFrom(keyObj); pyKey* key = pyKey::ConvertFrom(keyObj);
cyMisc::WearDefaultClothingType(*key, type); cyMisc::WearDefaultClothingType(*key, type, broadcast);
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
} }

8
Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp

@ -529,10 +529,12 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtWearMaintainerSuit, args, "Params: key,wearOrN
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
} }
PYTHON_GLOBAL_METHOD_DEFINITION(PtWearDefaultClothing, args, "Params: key\nForces the avatar to wear the default clothing set") PYTHON_GLOBAL_METHOD_DEFINITION_WKEY(PtWearDefaultClothing, args, kw, "Params: key, broadcast=false\nForces the avatar to wear the default clothing set")
{ {
char* kwlist[] = { "broadcast", NULL };
PyObject* keyObj = NULL; PyObject* keyObj = NULL;
if (!PyArg_ParseTuple(args, "O", &keyObj)) bool broadcast = false;
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|b", kwlist, &keyObj, &broadcast))
{ {
PyErr_SetString(PyExc_TypeError, "PtWearDefaultClothing expects a ptKey"); PyErr_SetString(PyExc_TypeError, "PtWearDefaultClothing expects a ptKey");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
@ -543,7 +545,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtWearDefaultClothing, args, "Params: key\nForce
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
pyKey* key = pyKey::ConvertFrom(keyObj); pyKey* key = pyKey::ConvertFrom(keyObj);
cyMisc::WearDefaultClothing(*key); cyMisc::WearDefaultClothing(*key, broadcast);
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
} }

14
Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp

@ -1003,7 +1003,7 @@ void plClothingOutfit::IUpdate()
} }
} }
void plClothingOutfit::WearDefaultClothing() void plClothingOutfit::WearDefaultClothing(hsBool broadcast)
{ {
StripAccessories(); StripAccessories();
@ -1041,9 +1041,14 @@ void plClothingOutfit::WearDefaultClothing()
} }
} }
} }
if (broadcast) {
fSynchClients = true;
ForceUpdate(true);
}
} }
void plClothingOutfit::WearDefaultClothingType(UInt32 clothingType) void plClothingOutfit::WearDefaultClothingType(UInt32 clothingType, hsBool broadcast)
{ {
plClothingMgr *cMgr = plClothingMgr::GetClothingMgr(); plClothingMgr *cMgr = plClothingMgr::GetClothingMgr();
hsTArray<plClothingItem *> items; hsTArray<plClothingItem *> items;
@ -1072,6 +1077,11 @@ void plClothingOutfit::WearDefaultClothingType(UInt32 clothingType)
break; break;
} }
} }
if (broadcast) {
fSynchClients = true;
ForceUpdate(true);
}
} }
void plClothingOutfit::WearMaintainerOutfit() void plClothingOutfit::WearMaintainerOutfit()

4
Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.h

@ -199,8 +199,8 @@ public:
hsBool DirtySynchState(const char* SDLStateName, UInt32 synchFlags); hsBool DirtySynchState(const char* SDLStateName, UInt32 synchFlags);
void StripAccessories(); void StripAccessories();
void WearDefaultClothing(); void WearDefaultClothing(hsBool broadcast = false);
void WearDefaultClothingType(UInt32 clothingType); void WearDefaultClothingType(UInt32 clothingType, hsBool broadcast = false);
void WearMaintainerOutfit(); void WearMaintainerOutfit();
void WearRandomOutfit(); void WearRandomOutfit();
void RemoveMaintainerOutfit(); void RemoveMaintainerOutfit();

Loading…
Cancel
Save