8000 LoopGearNetworkTestが通るように修正 by KurisuJuha · Pull Request #340 · moorestech/moorestech · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

LoopGearNetworkTestが通るように修正 #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
May 23, 2024

Conversation

KurisuJuha
Copy link
Collaborator

No description provided.

@KurisuJuha KurisuJuha requested a review from sakastudio May 22, 2024 05:56
public const float DefaultBeltConveyorHeight = 0.3f;
private readonly BlockConnectorComponent<IBlockInventory> _blockConnectorComponent;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

オートフォーマッタでprivateとpublicの順番ゴチャゴチャになってる?

public → private readonly → private の順番にしたい

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このprで修正します?
riderのオートフォーマッタがやったので今後弄ったときのためにも修正するならeditorconfigごと修正しないといけないと思ってます

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このPRでの修正は不要です(私が過去やってしまったやつものこっているので

@@ -135,6 +107,41 @@ public void SetItem(int slot, IItemStack itemStack)
_inventoryItems[slot] = new BeltConveyorInventoryItem(itemStack.Id, TimeOfItemEnterToExit, itemStack.ItemInstanceId);
}

public void Destroy()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここの順番入れ替えもオートフォーマッタ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

です

@@ -22,7 +23,7 @@ public ConnectingInventoryListPriorityInsertItemService(BlockConnectorComponent<

public IItemStack InsertItem(IItemStack itemStack)
{
IReadOnlyList<IBlockInventory> inventories = _blockConnectorComponent.ConnectTargets;
IReadOnlyList<IBlockInventory> inventories = _blockConnectorComponent.ConnectTargets.Keys.ToArray();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to de 8000 scribe this comment to others. Learn more.

色んなところでやっちゃってますけど、ToArrayとかはどこかで一掃したいですよね〜〜

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

僕は必要であれば気にしないタイプですが、確かに見る側からしたら鬱陶しいですよねー

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コード的な理由というよりは、GCが増えるので気になりポイントですね
そのうちパフォーマンスが重要になりそうなので、どこかのタイミングで一掃したいなぁ見たいな感じです

{
public static readonly GearConnectOptionLoader Loader = new();

public IConnectOption Load(dynamic connectorOption)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GearConnectOptionLoader と GearConnectOption を同じファイルに書いておきたい感ありますが、アセンブリ的に厳しいやつですかね

IConnectOptionLoaderをBlock.Interfaceに置けば解決する説

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

かもしれないです
やってみます

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DONE


var option = connector.option;
if (option != null && loader != null)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

option != nullはいらないです
option == null なのにローダー指定してるのはどっちかが間違っているので、明確に誤りな部分はちゃんとエラーをすろーするようにしておきたいですね

//TODO エラーログ出力する みたいなの付けておいてください

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しましたー

var gearConnectSettings = BlockConfigJsonLoad.GetConnectSettings(blockParam, "gearConnects");


var gearConnectSettings = BlockConfigJsonLoad.GetConnectSettings(blockParam, "gearConnects", GearConnectOptionLoader.Loader);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gearConnects、どこかにpublic const stringとして置いておきたいです

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"gearConnects"はもとからあったもので追加したわけじゃないので、Issue作って別PRでやりませんか?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OKです

var gearPositionC = new Vector3Int(0, 0, 1);
var gearPositionD = new Vector3Int(1, 0, 1);
var gearPositionC = new Vector3Int(0, 1, 0);
var gearPositionD = new Vector3Int(1, 1, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このパラメーター変更はまずいかも
今回の変更のテストをきちんと行えていないのでは

いままでこういう形の歯車NWだったのが
image

こうなってしまっている
image

今まではシャフト + 歯の接続のループだったのが、いまは歯での接続のループなので、今回変更した回転反転のフラグの検証ができていない

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しましたー


// smallGearDの回転方向とRPMのテスト
Assert.AreEqual(rpm, smallGearD.CurrentRpm);
Assert.AreEqual(false, smallGearD.IsCurrentClockwise);
Assert.AreEqual(true, smallGearD.IsCurrentClockwise);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これも戻す必要ありそう

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しましたー

@KurisuJuha KurisuJuha requested a review from sakastudio May 23, 2024 05:48
Copy link
Member
@sakastudio sakastudio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@sakastudio sakastudio merged commit a4761ce into feature/gear-system May 23, 2024
@sakastudio sakastudio deleted the fix/loop-gear-network-test branch May 23, 2024 07:04
sakastudio added a commit that referenced this pull request Jun 5, 2024
"gearConnects"という文字列を直置きしている問題を修正
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0