Disable monster patrol movement
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
"MOD.Core.SpriteRendererComponent",
|
||||
"MOD.Core.RigidbodyComponent",
|
||||
"MOD.Core.MovementComponent",
|
||||
"MOD.Core.AIChaseComponent",
|
||||
"MOD.Core.StateComponent",
|
||||
"MOD.Core.HitComponent",
|
||||
"MOD.Core.DamageSkinSpawnerComponent",
|
||||
@@ -150,4 +149,4 @@
|
||||
"Children": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
"MOD.Core.SpriteRendererComponent",
|
||||
"MOD.Core.RigidbodyComponent",
|
||||
"MOD.Core.MovementComponent",
|
||||
"MOD.Core.AIWanderComponent",
|
||||
"MOD.Core.StateComponent",
|
||||
"MOD.Core.HitComponent",
|
||||
"MOD.Core.DamageSkinSpawnerComponent",
|
||||
@@ -141,4 +140,4 @@
|
||||
"Children": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
"MOD.Core.SpriteRendererComponent",
|
||||
"MOD.Core.RigidbodyComponent",
|
||||
"MOD.Core.MovementComponent",
|
||||
"MOD.Core.AIWanderComponent",
|
||||
"MOD.Core.StateComponent",
|
||||
"MOD.Core.HitComponent",
|
||||
"MOD.Core.DamageSkinSpawnerComponent",
|
||||
@@ -57,10 +56,10 @@
|
||||
},
|
||||
"Value": {
|
||||
"$type": "MOD.Core.MODQuaternion, MOD.Core",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 1.0
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -186,8 +185,8 @@
|
||||
},
|
||||
"Value": {
|
||||
"$type": "MOD.Core.MODVector2, MOD.Core",
|
||||
"x": 0.0,
|
||||
"y": 0.0
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -199,8 +198,8 @@
|
||||
},
|
||||
"Value": {
|
||||
"$type": "MOD.Core.MODVector2, MOD.Core",
|
||||
"x": 0.0,
|
||||
"y": 0.0
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -219,7 +218,7 @@
|
||||
"$type": "MODNativeType",
|
||||
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
},
|
||||
"Value": 1.0
|
||||
"Value": 0
|
||||
},
|
||||
{
|
||||
"TargetType": "MOD.Core.MovementComponent",
|
||||
@@ -228,7 +227,7 @@
|
||||
"$type": "MODNativeType",
|
||||
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
},
|
||||
"Value": 0.0
|
||||
"Value": 0
|
||||
},
|
||||
{
|
||||
"TargetType": "MOD.Core.MovementComponent",
|
||||
@@ -239,24 +238,6 @@
|
||||
},
|
||||
"Value": true
|
||||
},
|
||||
{
|
||||
"TargetType": "MOD.Core.AIWanderComponent",
|
||||
"Name": "IsLegacy",
|
||||
"ValueType": {
|
||||
"$type": "MODNativeType",
|
||||
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
},
|
||||
"Value": false
|
||||
},
|
||||
{
|
||||
"TargetType": "MOD.Core.AIWanderComponent",
|
||||
"Name": "Enable",
|
||||
"ValueType": {
|
||||
"$type": "MODNativeType",
|
||||
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||
},
|
||||
"Value": true
|
||||
},
|
||||
{
|
||||
"TargetType": "MOD.Core.StateComponent",
|
||||
"Name": "IsLegacy",
|
||||
@@ -376,8 +357,8 @@
|
||||
},
|
||||
"Value": {
|
||||
"$type": "MOD.Core.MODVector2, MOD.Core",
|
||||
"x": 0.0,
|
||||
"y": 0.0
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -389,8 +370,8 @@
|
||||
},
|
||||
"Value": {
|
||||
"$type": "MOD.Core.MODVector2, MOD.Core",
|
||||
"x": 0.0,
|
||||
"y": 0.0
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -402,8 +383,8 @@
|
||||
},
|
||||
"Value": {
|
||||
"$type": "MOD.Core.MODVector2, MOD.Core",
|
||||
"x": 0.0,
|
||||
"y": 0.0
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -424,8 +405,8 @@
|
||||
},
|
||||
"Value": {
|
||||
"$type": "MOD.Core.MODVector2, MOD.Core",
|
||||
"x": 0.0,
|
||||
"y": 0.0
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -460,4 +441,4 @@
|
||||
"Children": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
620
map/map01.map
620
map/map01.map
File diff suppressed because it is too large
Load Diff
@@ -6392,7 +6392,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6479,7 +6479,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6539,7 +6540,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6626,7 +6627,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6651,4 +6653,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6392,7 +6392,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6479,7 +6479,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6539,7 +6540,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6626,7 +6627,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6651,4 +6653,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6392,7 +6392,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6479,7 +6479,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6539,7 +6540,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6626,7 +6627,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6651,4 +6653,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6392,7 +6392,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6479,7 +6479,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6539,7 +6540,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6626,7 +6627,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6651,4 +6653,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6392,7 +6392,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6479,7 +6479,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6539,7 +6540,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6626,7 +6627,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6651,4 +6653,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6392,7 +6392,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6479,7 +6479,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6539,7 +6540,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6626,7 +6627,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6651,4 +6653,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6392,7 +6392,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6479,7 +6479,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6539,7 +6540,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6626,7 +6627,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6651,4 +6653,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6392,7 +6392,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6479,7 +6479,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6539,7 +6540,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6626,7 +6627,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6651,4 +6653,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6392,7 +6392,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6479,7 +6479,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6539,7 +6540,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6626,7 +6627,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6651,4 +6653,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6392,7 +6392,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6479,7 +6479,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6539,7 +6540,7 @@
|
||||
"w": 1
|
||||
},
|
||||
"Scale": {
|
||||
"x": 1,
|
||||
"x": -1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
@@ -6626,7 +6627,8 @@
|
||||
},
|
||||
{
|
||||
"@type": "MOD.Core.MovementComponent",
|
||||
"Enable": true
|
||||
"Enable": false,
|
||||
"InputSpeed": 0
|
||||
},
|
||||
{
|
||||
"@type": "script.Monster",
|
||||
@@ -6651,4 +6653,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
83
tools/freeze-turn-monsters.mjs
Normal file
83
tools/freeze-turn-monsters.mjs
Normal file
@@ -0,0 +1,83 @@
|
||||
import { readFileSync, writeFileSync } from 'node:fs';
|
||||
|
||||
const AI_COMPONENTS = new Set([
|
||||
'MOD.Core.AIWanderComponent',
|
||||
'MOD.Core.AIChaseComponent',
|
||||
]);
|
||||
|
||||
const mapFiles = Array.from({ length: 11 }, (_, i) => `map/map${String(i + 1).padStart(2, '0')}.map`);
|
||||
const modelFiles = [
|
||||
'Global/MoveMonster.model',
|
||||
'Global/ChaseMonster.model',
|
||||
'RootDesk/MyDesk/Model_monster-43.model',
|
||||
];
|
||||
|
||||
function isMonster(entity) {
|
||||
return (entity.componentNames || '').includes('script.Monster');
|
||||
}
|
||||
|
||||
function component(entity, type) {
|
||||
return entity.jsonString['@components'].find((c) => c['@type'] === type);
|
||||
}
|
||||
|
||||
function patchMonsterEntity(entity) {
|
||||
const components = entity.jsonString['@components'];
|
||||
entity.jsonString['@components'] = components.filter((c) => !AI_COMPONENTS.has(c['@type']));
|
||||
entity.componentNames = entity.jsonString['@components'].map((c) => c['@type']).join(',');
|
||||
|
||||
const movement = component(entity, 'MOD.Core.MovementComponent');
|
||||
if (movement) {
|
||||
movement.Enable = false;
|
||||
movement.InputSpeed = 0;
|
||||
}
|
||||
|
||||
const rigidbody = component(entity, 'MOD.Core.RigidbodyComponent');
|
||||
if (rigidbody) {
|
||||
rigidbody.MoveVelocity = { x: 0, y: 0 };
|
||||
rigidbody.RealMoveVelocity = { x: 0, y: 0 };
|
||||
}
|
||||
|
||||
const transform = component(entity, 'MOD.Core.TransformComponent');
|
||||
if (transform?.Scale) {
|
||||
transform.Scale.x = -Math.abs(transform.Scale.x || 1);
|
||||
transform.Scale.y = Math.abs(transform.Scale.y || 1);
|
||||
}
|
||||
|
||||
const stateAnimation = component(entity, 'MOD.Core.StateAnimationComponent');
|
||||
const renderer = component(entity, 'MOD.Core.SpriteRendererComponent');
|
||||
const stand = stateAnimation?.ActionSheet?.stand;
|
||||
if (renderer && stand) {
|
||||
renderer.SpriteRUID = stand;
|
||||
}
|
||||
}
|
||||
|
||||
function patchMap(file) {
|
||||
const data = JSON.parse(readFileSync(file, 'utf8'));
|
||||
for (const entity of data.ContentProto.Entities.filter(isMonster)) {
|
||||
patchMonsterEntity(entity);
|
||||
}
|
||||
writeFileSync(file, `${JSON.stringify(data, null, 2)}\n`, 'utf8');
|
||||
}
|
||||
|
||||
function patchModel(file) {
|
||||
const data = JSON.parse(readFileSync(file, 'utf8'));
|
||||
const json = data.ContentProto.Json;
|
||||
json.Components = (json.Components || []).filter((name) => !AI_COMPONENTS.has(name));
|
||||
json.Values = (json.Values || []).filter((value) => !AI_COMPONENTS.has(value.TargetType));
|
||||
for (const value of json.Values) {
|
||||
if (value.TargetType === 'MOD.Core.MovementComponent' && value.Name === 'InputSpeed') {
|
||||
value.Value = 0;
|
||||
}
|
||||
}
|
||||
writeFileSync(file, `${JSON.stringify(data, null, 2)}\n`, 'utf8');
|
||||
}
|
||||
|
||||
for (const file of mapFiles) {
|
||||
patchMap(file);
|
||||
}
|
||||
|
||||
for (const file of modelFiles) {
|
||||
patchModel(file);
|
||||
}
|
||||
|
||||
console.log('Turn-combat monster movement disabled.');
|
||||
Reference in New Issue
Block a user