Fix turn combat facing and player movement
This commit is contained in:
@@ -39,7 +39,7 @@ function patchMonsterEntity(entity) {
|
||||
|
||||
const transform = component(entity, 'MOD.Core.TransformComponent');
|
||||
if (transform?.Scale) {
|
||||
transform.Scale.x = -Math.abs(transform.Scale.x || 1);
|
||||
transform.Scale.x = Math.abs(transform.Scale.x || 1);
|
||||
transform.Scale.y = Math.abs(transform.Scale.y || 1);
|
||||
}
|
||||
|
||||
|
||||
20
tools/freeze-turn-player.mjs
Normal file
20
tools/freeze-turn-player.mjs
Normal file
@@ -0,0 +1,20 @@
|
||||
import { readFileSync, writeFileSync } from 'node:fs';
|
||||
|
||||
const file = 'Global/DefaultPlayer.model';
|
||||
const data = JSON.parse(readFileSync(file, 'utf8'));
|
||||
const values = data.ContentProto.Json.Values || [];
|
||||
|
||||
for (const value of values) {
|
||||
if (value.TargetType === null && ['speed', 'jumpForce', 'walkAcceleration'].includes(value.Name)) {
|
||||
value.Value = 0;
|
||||
}
|
||||
if (value.TargetType === 'MOD.Core.MovementComponent' && ['InputSpeed', 'JumpForce'].includes(value.Name)) {
|
||||
value.Value = 0;
|
||||
}
|
||||
if (value.TargetType === 'MOD.Core.RigidbodyComponent' && ['MoveVelocity', 'RealMoveVelocity'].includes(value.Name)) {
|
||||
value.Value = { x: 0, y: 0 };
|
||||
}
|
||||
}
|
||||
|
||||
writeFileSync(file, `${JSON.stringify(data, null, 2)}\n`, 'utf8');
|
||||
console.log('Turn-combat player movement disabled.');
|
||||
@@ -468,6 +468,7 @@ self.NewGameHandler = buttonEntity:ConnectEvent(ButtonClickEvent, self.StartNewG
|
||||
self:SetEntityEnabled("/ui/DefaultGroup/CardHand", true)
|
||||
self:SetEntityEnabled("/ui/DefaultGroup/DeckHud", true)
|
||||
self:ConfigureTurnBasedMonsters()
|
||||
self:ConfigureTurnBasedPlayer()
|
||||
self:StartCombat()`),
|
||||
method('StartCombat', `self.MaxEnergy = 3
|
||||
self.Turn = 0
|
||||
@@ -505,7 +506,7 @@ if monster.RigidbodyComponent ~= nil then
|
||||
end
|
||||
if monster.TransformComponent ~= nil then
|
||||
\tlocal scale = monster.TransformComponent.Scale
|
||||
\tmonster.TransformComponent.Scale = Vector3(-math.abs(scale.x), math.abs(scale.y), scale.z)
|
||||
\tmonster.TransformComponent.Scale = Vector3(math.abs(scale.x), math.abs(scale.y), scale.z)
|
||||
end
|
||||
if monster.StateAnimationComponent ~= nil and monster.SpriteRendererComponent ~= nil then
|
||||
\tlocal stand = monster.StateAnimationComponent.ActionSheet["stand"]
|
||||
@@ -513,6 +514,45 @@ if monster.StateAnimationComponent ~= nil and monster.SpriteRendererComponent ~=
|
||||
\t\tmonster.SpriteRendererComponent.SpriteRUID = stand
|
||||
\tend
|
||||
end`, [{ Type: 'Entity', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: 'monster' }]),
|
||||
method('ConfigureTurnBasedPlayer', `local player = nil
|
||||
pcall(function()
|
||||
\tif _UserService ~= nil and _UserService.LocalPlayer ~= nil then
|
||||
\t\tplayer = _UserService.LocalPlayer
|
||||
\tend
|
||||
end)
|
||||
pcall(function()
|
||||
\tif player == nil and _UserService ~= nil and _UserService.LocalPlayerEntity ~= nil then
|
||||
\t\tplayer = _UserService.LocalPlayerEntity
|
||||
\tend
|
||||
end)
|
||||
pcall(function()
|
||||
\tif player == nil and _UserService ~= nil and _UserService.GetLocalPlayer ~= nil then
|
||||
\t\tplayer = _UserService:GetLocalPlayer()
|
||||
\tend
|
||||
end)
|
||||
if player ~= nil and player.Entity ~= nil then
|
||||
\tplayer = player.Entity
|
||||
end
|
||||
if player == nil then
|
||||
\treturn
|
||||
end
|
||||
if player.PlayerControllerComponent ~= nil then
|
||||
\tplayer.PlayerControllerComponent.Enable = false
|
||||
\tpcall(function() player.PlayerControllerComponent.LookDirectionX = 1 end)
|
||||
end
|
||||
if player.MovementComponent ~= nil then
|
||||
\tplayer.MovementComponent.Enable = false
|
||||
\tpcall(function() player.MovementComponent.InputSpeed = 0 end)
|
||||
\tpcall(function() player.MovementComponent.JumpForce = 0 end)
|
||||
end
|
||||
if player.RigidbodyComponent ~= nil then
|
||||
\tplayer.RigidbodyComponent.MoveVelocity = Vector2.zero
|
||||
\tplayer.RigidbodyComponent.RealMoveVelocity = Vector2.zero
|
||||
end
|
||||
if player.TransformComponent ~= nil then
|
||||
\tlocal scale = player.TransformComponent.Scale
|
||||
\tplayer.TransformComponent.Scale = Vector3(math.abs(scale.x), math.abs(scale.y), scale.z)
|
||||
end`),
|
||||
method('Shuffle', `if list == nil then
|
||||
\treturn
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user