Fix turn combat facing and player movement

This commit is contained in:
maple
2026-06-08 00:01:46 +09:00
parent 1299d718e2
commit 27818e92c7
16 changed files with 116 additions and 41 deletions

View File

@@ -30,7 +30,7 @@
"$type": "MODNativeType",
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
},
"Value": 1.0
"Value": 0
},
{
"TargetType": null,
@@ -39,7 +39,7 @@
"$type": "MODNativeType",
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
},
"Value": 1.0
"Value": 0
},
{
"TargetType": null,
@@ -48,7 +48,7 @@
"$type": "MODNativeType",
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
},
"Value": 1.0
"Value": 0
},
{
"TargetType": null,
@@ -57,7 +57,7 @@
"$type": "MODNativeType",
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
},
"Value": 1.0
"Value": 1
},
{
"TargetType": null,
@@ -118,7 +118,7 @@
"$type": "MODNativeType",
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
},
"Value": 0.0
"Value": 0
},
{
"TargetType": null,
@@ -129,8 +129,8 @@
},
"Value": {
"$type": "MOD.Core.MODVector2, MOD.Core",
"x": 0.0,
"y": 0.0
"x": 0,
"y": 0
}
},
{
@@ -185,7 +185,7 @@
},
"Value": {
"$type": "MOD.Core.MODVector2, MOD.Core",
"x": 0.0,
"x": 0,
"y": 0.35
}
},
@@ -198,7 +198,7 @@
},
"Value": {
"$type": "MOD.Core.MODVector2, MOD.Core",
"x": 0.0,
"x": 0,
"y": 0.35
}
},
@@ -218,7 +218,7 @@
"$type": "MODNativeType",
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
},
"Value": 500.0
"Value": 500
},
{
"TargetType": "script.PlayerHit",
@@ -254,7 +254,7 @@
},
"Value": {
"$type": "MOD.Core.MODVector2, MOD.Core",
"x": 0.0,
"x": 0,
"y": 0.35
}
},
@@ -265,7 +265,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",
@@ -274,7 +274,7 @@
"$type": "MODNativeType",
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
},
"Value": 1.0
"Value": 0
},
{
"TargetType": "MOD.Core.PlayerComponent",
@@ -302,4 +302,4 @@
"Children": []
}
}
}
}

View File

@@ -148,7 +148,7 @@
"Name": null
},
"Arguments": [],
"Code": "self:SetEntityEnabled(\"/ui/DefaultGroup/MainMenu\", false)\nself:SetEntityEnabled(\"/ui/DefaultGroup/CardHand\", true)\nself:SetEntityEnabled(\"/ui/DefaultGroup/DeckHud\", true)\nself:ConfigureTurnBasedMonsters()\nself:StartCombat()",
"Code": "self:SetEntityEnabled(\"/ui/DefaultGroup/MainMenu\", false)\nself:SetEntityEnabled(\"/ui/DefaultGroup/CardHand\", true)\nself:SetEntityEnabled(\"/ui/DefaultGroup/DeckHud\", true)\nself:ConfigureTurnBasedMonsters()\nself:ConfigureTurnBasedPlayer()\nself:StartCombat()",
"Scope": 2,
"ExecSpace": 6,
"Attributes": [],
@@ -201,12 +201,27 @@
"Name": "monster"
}
],
"Code": "if monster == nil then\n\treturn\nend\nif monster.AIWanderComponent ~= nil then\n\tmonster.AIWanderComponent.Enable = false\nend\nif monster.AIChaseComponent ~= nil then\n\tmonster.AIChaseComponent.Enable = false\nend\nif monster.MovementComponent ~= nil then\n\tmonster.MovementComponent.Enable = false\nend\nif monster.RigidbodyComponent ~= nil then\n\tmonster.RigidbodyComponent.MoveVelocity = Vector2.zero\n\tmonster.RigidbodyComponent.RealMoveVelocity = Vector2.zero\nend\nif monster.TransformComponent ~= nil then\n\tlocal scale = monster.TransformComponent.Scale\n\tmonster.TransformComponent.Scale = Vector3(-math.abs(scale.x), math.abs(scale.y), scale.z)\nend\nif monster.StateAnimationComponent ~= nil and monster.SpriteRendererComponent ~= nil then\n\tlocal stand = monster.StateAnimationComponent.ActionSheet[\"stand\"]\n\tif stand ~= nil and stand ~= \"\" then\n\t\tmonster.SpriteRendererComponent.SpriteRUID = stand\n\tend\nend",
"Code": "if monster == nil then\n\treturn\nend\nif monster.AIWanderComponent ~= nil then\n\tmonster.AIWanderComponent.Enable = false\nend\nif monster.AIChaseComponent ~= nil then\n\tmonster.AIChaseComponent.Enable = false\nend\nif monster.MovementComponent ~= nil then\n\tmonster.MovementComponent.Enable = false\nend\nif monster.RigidbodyComponent ~= nil then\n\tmonster.RigidbodyComponent.MoveVelocity = Vector2.zero\n\tmonster.RigidbodyComponent.RealMoveVelocity = Vector2.zero\nend\nif monster.TransformComponent ~= nil then\n\tlocal scale = monster.TransformComponent.Scale\n\tmonster.TransformComponent.Scale = Vector3(math.abs(scale.x), math.abs(scale.y), scale.z)\nend\nif monster.StateAnimationComponent ~= nil and monster.SpriteRendererComponent ~= nil then\n\tlocal stand = monster.StateAnimationComponent.ActionSheet[\"stand\"]\n\tif stand ~= nil and stand ~= \"\" then\n\t\tmonster.SpriteRendererComponent.SpriteRUID = stand\n\tend\nend",
"Scope": 2,
"ExecSpace": 6,
"Attributes": [],
"Name": "ConfigureMonsterForTurnCombat"
},
{
"Return": {
"Type": "void",
"DefaultValue": null,
"SyncDirection": 0,
"Attributes": [],
"Name": null
},
"Arguments": [],
"Code": "local player = nil\npcall(function()\n\tif _UserService ~= nil and _UserService.LocalPlayer ~= nil then\n\t\tplayer = _UserService.LocalPlayer\n\tend\nend)\npcall(function()\n\tif player == nil and _UserService ~= nil and _UserService.LocalPlayerEntity ~= nil then\n\t\tplayer = _UserService.LocalPlayerEntity\n\tend\nend)\npcall(function()\n\tif player == nil and _UserService ~= nil and _UserService.GetLocalPlayer ~= nil then\n\t\tplayer = _UserService:GetLocalPlayer()\n\tend\nend)\nif player ~= nil and player.Entity ~= nil then\n\tplayer = player.Entity\nend\nif player == nil then\n\treturn\nend\nif player.PlayerControllerComponent ~= nil then\n\tplayer.PlayerControllerComponent.Enable = false\n\tpcall(function() player.PlayerControllerComponent.LookDirectionX = 1 end)\nend\nif player.MovementComponent ~= nil then\n\tplayer.MovementComponent.Enable = false\n\tpcall(function() player.MovementComponent.InputSpeed = 0 end)\n\tpcall(function() player.MovementComponent.JumpForce = 0 end)\nend\nif player.RigidbodyComponent ~= nil then\n\tplayer.RigidbodyComponent.MoveVelocity = Vector2.zero\n\tplayer.RigidbodyComponent.RealMoveVelocity = Vector2.zero\nend\nif player.TransformComponent ~= nil then\n\tlocal scale = player.TransformComponent.Scale\n\tplayer.TransformComponent.Scale = Vector3(math.abs(scale.x), math.abs(scale.y), scale.z)\nend",
"Scope": 2,
"ExecSpace": 6,
"Attributes": [],
"Name": "ConfigureTurnBasedPlayer"
},
{
"Return": {
"Type": "void",

View File

@@ -6392,7 +6392,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},
@@ -6540,7 +6540,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},
@@ -6691,7 +6691,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},

View File

@@ -6392,7 +6392,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},
@@ -6540,7 +6540,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},

View File

@@ -6392,7 +6392,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},
@@ -6540,7 +6540,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},

View File

@@ -6392,7 +6392,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},
@@ -6540,7 +6540,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},

View File

@@ -6392,7 +6392,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},
@@ -6540,7 +6540,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},

View File

@@ -6392,7 +6392,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},
@@ -6540,7 +6540,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},

View File

@@ -6392,7 +6392,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},
@@ -6540,7 +6540,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},

View File

@@ -6392,7 +6392,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},
@@ -6540,7 +6540,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},

View File

@@ -6392,7 +6392,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},
@@ -6540,7 +6540,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},

View File

@@ -6392,7 +6392,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},
@@ -6540,7 +6540,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},

View File

@@ -6392,7 +6392,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},
@@ -6540,7 +6540,7 @@
"w": 1
},
"Scale": {
"x": -1,
"x": 1,
"y": 1,
"z": 1
},

View File

@@ -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);
}

View 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.');

View File

@@ -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