123new Уже сделал, но проверку обьектов под ногами
Стены проверять не вижу смысла
нам важно что бы не клалось друг на друга а кидалось рядом
modded class HandActionDrop extends HandActionBase
{
bool m_HandActionDropMyDebug = true;
override void Action (HandEventBase e)
{
Man player = e.m_Player;
EntityAI item = e.m_Entity;
vector dropPosition = player.GetPosition();
super.Action(e);
if (m_HandActionDropMyDebug)
{
PlayerIdentity player_Identity = player.GetIdentity();
string player_Name = player_Identity.GetName();
string player_UID = player_Identity.GetPlainId();
EntityAI itemInHands = NULL;
itemInHands = player.GetHumanInventory().GetEntityInHands();
Print("::: SERVER: [HandActionDrop DEBUG]: Action: input: HandEventBase e = " + e.ToString() + ": player = " + player_Name + ", player pos: " + dropPosition + " DROP: item = " + item.ToString() + " : item.GetPosition() = " + item.GetPosition() +", itemInHands = " + itemInHands.ToString());
Print("::: SERVER: [HandActionDrop DEBUG]: Current surface alt: " + GetGame().SurfaceY(dropPosition[0], dropPosition[2]));
Print("::: SERVER: [HandActionDrop DEBUG]: Current surface normal: " + GetGame().SurfaceGetNormal(dropPosition[0], dropPosition[2]).ToString());
string SurfaceType, SurfaceType3D;
GetGame().SurfaceGetType(dropPosition[0], dropPosition[2], SurfaceType);
GetGame().SurfaceGetType3D(dropPosition[0], dropPosition[1], dropPosition[2], SurfaceType3D);
Print("::: SERVER: [HandActionDrop DEBUG]: Current surface types: SurfaceType = " + SurfaceType + ", SurfaceType3D = " + SurfaceType3D);
}
if (item)
{
array<Object> nearest_objects = new array<Object>;
array<CargoBase> proxy_cargos = new array<CargoBase>;
GetGame().GetObjectsAtPosition(Vector(dropPosition[0],dropPosition[1] - 0.05,dropPosition[2]), 1.5, nearest_objects, proxy_cargos);
for ( int i = 0; i < nearest_objects.Count(); i++ )
{
Print("::: SERVER: [HandActionDrop DEBUG]: Found neared object: nearest_objects[i] " + nearest_objects[i].GetType() + ", nearest_objects[i].GetPosition() = " + nearest_objects[i].GetPosition());
if (dropPosition[1] > nearest_objects[i].GetPosition()[1]) dropPosition[1] = nearest_objects[i].GetPosition()[1];
}
dropPosition[0] = dropPosition[0] + Math.RandomFloatInclusive(-0.5, 0.5);
dropPosition[1] = dropPosition[1] + Math.RandomFloatInclusive(-0.02, 0.02);
dropPosition[2] = dropPosition[2] + Math.RandomFloatInclusive(-0.5, 0.5);
Print("::: SERVER: [HandActionDrop DEBUG]: new dropPosition = " + dropPosition.ToString());
item.SetPosition(dropPosition);
item.SetOrientation(item.GetOrientation());
}
}
}
логгирования напихал на первое время
пока импровизация
тк времени нет
но уже что-то
есть идея
ща передалаю