Let bullets set cars on fire

A bullet that hit a script model raised "damage" with the hit bone as the
tagName argument and an empty partName. The destructible script reads a
non-empty tagName as the tag of an attached model and matches it against
its part list. The body bone of a destructible car (the Suburban on Estate)
matches no part, so the damage was dropped and bullets never set a car on
fire. Windows, wheels and lights still broke, because their bones are part
tags either way, and explosions, which carry no bone, worked.

The bone now goes in partName with an empty tagName, as the vehicle damage
notify already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
JohnM
2026-10-12 17:43:20 +08:00
parent f46d5aadcd
commit 6fffe52947
+3 -3
View File
@@ -229,7 +229,7 @@ pub(crate) fn damage_entity(world: &mut World, hit: &EntityHit) -> bool {
return false;
};
let frame = FrameWorld::from_world(world);
let tag = hit
let part = hit
.bone
.and_then(|bone| {
frame
@@ -248,7 +248,7 @@ pub(crate) fn damage_entity(world: &mut World, hit: &EntityHit) -> bool {
if world.resource::<RoundScript>().entities[&object].kind
== super::entities::EntityKind::Vehicle
{
super::vehicles::damage(world, object, hit, attacker, &weapon, &tag);
super::vehicles::damage(world, object, hit, attacker, &weapon, &part);
return true;
}
let mut runtime = world.resource_mut::<RoundScript>();
@@ -276,8 +276,8 @@ pub(crate) fn damage_entity(world: &mut World, hit: &EntityHit) -> bool {
Value::Vector(hit.point),
Value::string(hit.means),
Value::String(model),
Value::String(tag.as_str().into()),
Value::string(""),
Value::String(part.as_str().into()),
Value::Int(hit.flags),
Value::String(weapon.into()),
],