Skip to content

Commit

Permalink
Fix Ruined Courtyard Thermal Conduit exploit.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMiguel211 committed Jul 14, 2024
1 parent 1e32c4c commit beb106c
Showing 1 changed file with 20 additions and 32 deletions.
52 changes: 20 additions & 32 deletions src/patches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8017,51 +8017,39 @@ fn patch_ruined_courtyard_thermal_conduits(
area: &mut mlvl_wrapper::MlvlArea,
version: Version,
) -> Result<(), String> {
let scly = area.mrea().scly_section_mut();
let layer = &mut scly.layers.as_mut_vec()[0];
let thermal_conduit_damageable_trigger_obj_id = 0xF01C8;
let thermal_conduit_actor_obj_id = 0xF01C7;
let debris_generator_obj_id = 0xF01DD;
let thermal_conduit_cover_actor_obj_id = 0xF01D9;

layer
.objects
.as_mut_vec()
let layer = area
.mrea()
.scly_section_mut()
.layers
.iter_mut()
.find(|obj| obj.instance_id == thermal_conduit_damageable_trigger_obj_id)
.and_then(|obj| obj.property_data.as_damageable_trigger_mut())
.unwrap()
.active = 1;
.next()
.unwrap();

if version == Version::NtscU0_02 {
layer
.objects
.as_mut_vec()

let objects = layer.objects.as_mut_vec();
// Thermal Conduit Actor
objects
.iter_mut()
.find(|obj| obj.instance_id == thermal_conduit_actor_obj_id)
.find(|obj: &&mut structs::SclyObject| obj.instance_id & 0x00FFFFFF == 0xF01C7)
.and_then(|obj| obj.property_data.as_actor_mut())
.unwrap()
.active = 1;

// Damageable Trigger Activation Relay
objects
.iter_mut()
.find(|obj| obj.instance_id & 0x00FFFFFF == 0xF0312)
.and_then(|obj| obj.property_data.as_relay_mut())
.unwrap()
.active = 1;

} else if version == Version::NtscJ
|| version == Version::Pal
|| version == Version::NtscUTrilogy
|| version == Version::NtscJTrilogy
|| version == Version::PalTrilogy
{
layer
.objects
.as_mut_vec()
.iter_mut()
.find(|obj| obj.instance_id == debris_generator_obj_id)
.unwrap()
.connections
.as_mut_vec()
.push(structs::Connection {
state: structs::ConnectionState::ZERO,
message: structs::ConnectionMsg::DEACTIVATE,
target_object_id: thermal_conduit_cover_actor_obj_id,
});

let flags = &mut area.layer_flags.flags;
*flags |= 1 << 6; // Turn on "Thermal Target"
}
Expand Down

0 comments on commit beb106c

Please sign in to comment.