mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 11:52:40 +01:00
Delete traffic when creating new entities from 0x00a5, 0x009a
This commit is contained in:
parent
3fee2ba5c4
commit
7af0e8d7cb
@ -217,6 +217,23 @@ inline BlipData createObjectBlipSprite(const ScriptArguments& args,
|
||||
|
||||
ScriptModel getModel(const ScriptArguments& args, ScriptModel model);
|
||||
|
||||
inline void clearSpaceForObject(const ScriptArguments& args,
|
||||
GameObject* object) {
|
||||
RW_ASSERT(object->getModel());
|
||||
|
||||
auto radius = object->getModel()->getBoundingRadius();
|
||||
|
||||
const auto& overlapping = args.getWorld()->findOverlappingObjects(
|
||||
object->getPosition(), radius);
|
||||
|
||||
for (const auto& found : overlapping) {
|
||||
if (found->canBeRemoved())
|
||||
args.getWorld()->destroyObjectQueued(found);
|
||||
|
||||
// @todo check collision meshes for real intersection
|
||||
}
|
||||
}
|
||||
|
||||
inline void addObjectToMissionCleanup(const ScriptArguments& args,
|
||||
GameObject* object) {
|
||||
if (args.getThread()->isMission) {
|
||||
|
@ -1797,11 +1797,11 @@ void opcode_009a(const ScriptArguments& args, const ScriptPedType pedType, const
|
||||
character->applyOffset();
|
||||
character->setLifetime(GameObject::MissionLifetime);
|
||||
|
||||
script::clearSpaceForObject(args, character);
|
||||
|
||||
if (args.getThread()->isMission) {
|
||||
script::addObjectToMissionCleanup(args, character);
|
||||
}
|
||||
|
||||
/// @todo track object mission status
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1947,6 +1947,8 @@ void opcode_00a5(const ScriptArguments& args, const ScriptModelID model, ScriptV
|
||||
vehicle->applyOffset();
|
||||
vehicle->setLifetime(GameObject::MissionLifetime);
|
||||
|
||||
script::clearSpaceForObject(args, vehicle);
|
||||
|
||||
if (args.getThread()->isMission) {
|
||||
script::addObjectToMissionCleanup(args, vehicle);
|
||||
}
|
||||
@ -5035,7 +5037,6 @@ void opcode_01c4(const ScriptArguments& args, const ScriptObject object) {
|
||||
@arg character Character/ped
|
||||
*/
|
||||
void opcode_01c5(const ScriptArguments& args, const ScriptCharacter character) {
|
||||
RW_UNUSED(args);
|
||||
script::removeObjectFromMissionCleanup(args, character);
|
||||
}
|
||||
|
||||
@ -5046,7 +5047,6 @@ void opcode_01c5(const ScriptArguments& args, const ScriptCharacter character) {
|
||||
@arg vehicle Car/vehicle
|
||||
*/
|
||||
void opcode_01c6(const ScriptArguments& args, const ScriptVehicle vehicle) {
|
||||
RW_UNUSED(args);
|
||||
script::removeObjectFromMissionCleanup(args, vehicle);
|
||||
}
|
||||
|
||||
@ -5057,7 +5057,6 @@ void opcode_01c6(const ScriptArguments& args, const ScriptVehicle vehicle) {
|
||||
@arg object Object
|
||||
*/
|
||||
void opcode_01c7(const ScriptArguments& args, const ScriptObject object) {
|
||||
RW_UNUSED(args);
|
||||
script::removeObjectFromMissionCleanup(args, object);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user