Ga naar de inhoud
Rel-bits

Rel-bits

  • Thuis
  • Nieuws
  • Gidsen
  • Videogidsen
  • Patch-opmerkingen
  • Misbruik melden
  • Toggle zoekformulier
De Planeetmaker

The Planet Crafter Inventory and Other Modding (dnSpy)

Geplaatst op 03/25/2022 Deur akarnokd Geen reacties op The Planet Crafter Inventory and Other Modding (dnSpy)
  • Titel: De Planeetmaker
  • Releasedatum:
  • Ontwikkelaar: Miju Games
  • Uitgever: Miju Games
Information about The Planet Crafter is still incomplete. Help ons alstublieft de details van het spel hiermee in te vullen contactformulier.

In deze gids, I’ll describe a few modifications I patched in to adjust a few UI behaviors and to cheat a bit after I completed the game.

The game is written in Unity and C# which makes it relatively easy to explore via the dnSpy tool.

Note though that these modifications aren’t real mods but temporary patches because the moment the game is updated by the developers, the local changes are overwritten. There exist modding frameworks, such as BepInEx for other games but I have not looked into those.

Voorbereidingen

  • Download the latest available dnSpy.
  • Extract it to a suitable location and run dnSpy.exe
  • In File > Open, Zoek de Assemblage-csharp.dll in de
    %{steam dir}\common\The Planet Crafter Prologue\Planet Crafter_Data\Managed

    directory.

I recommend using “Edit Method” in plaats van “Edit Class” to avoid drastic recompilation of unrelated code parts that may break something else. Ook, dnSpy has bugs so no need to tempt it.

Modify Sorting

The game sorts items by their name by default but I like air and food in the front of the list. The sorting is handled in the SpaceCraft.Inventory::AutoSort() methode. The method currently has a LINQ expression for sorting that we will replace with a direct call to List::Sort().

this.worldObjectsInInventory.Sort(delegate(WorldObject a, WorldObject b)
{
    string id = a.GetGroup().GetId();
    string id2 = b.GetGroup().GetId();
    if (id.StartsWith("OxygenCapsule") && !id2.StartsWith("OxygenCapsule"))
    {
        return -1;
    }
    if (!id.StartsWith("OxygenCapsule") && id2.StartsWith("OxygenCapsule"))
    {
        return 1;
    }
    if (id.StartsWith("WaterBottle") && !id2.StartsWith("WaterBottle"))
    {
        return -1;
    }
    if (!id.StartsWith("WaterBottle") && id2.StartsWith("WaterBottle"))
    {
        return 1;
    }
    return id.CompareTo(id2);
});

I don’t know all the IDs of the items but could be dumped into a file from this method via StreamWriter.

Move Items of the Same Type to/from Inventory

Standaard, one can move items one by one, which can be tedious. Clicking on an inventory image is handled by SpaceCraft.InventoryDisplayer::OnImageClicked() methode. Standaard, it has action for the left and right mouse clicks. Since I couldn’t find a way to check for modifiers such as shift or ctrl keys, I decided to use the middle mouse button.

When the user clicks the middle mouse button, we have to find the objects in the current inventory having the same item id, then get the other inventory entity. Then try adding it to the other inventory and if successful, remove it from the current inventory, thus handling the full case.

if (_eventTriggerCallbackData.pointerEventData.button == PointerEventData.InputButton.Middle)
{
    DataConfig.UiType openedUi = MijuTools.Managers.GetManager().GetOpenedUi();
    if (openedUi == DataConfig.UiType.Container)
    {
        Inventory otherInventory = ((UiWindowContainer)MijuTools.Managers.GetManager().GetWindowViaUiId(openedUi)).GetOtherInventory(this.inventory);
        if (this.inventory != null && otherInventory != null)
        {
            string id = _eventTriggerCallbackData.worldObject.GetGroup().GetId();
            List list = new List();
            foreach (WorldObject worldObject2 in this.inventory.GetInsideWorldObjects())
            {
                if (worldObject2.GetGroup().GetId() == id)
                {
                    list.Add(worldObject2);
                }
            }
            foreach (WorldObject worldObject3 in list)
            {
                if (otherInventory.AddItem(worldObject3))
                {
                    this.inventory.RemoveItem(worldObject3, vals);
                }
            }
        }
    }
}

Inventory Capacity (Cheating)

Standaard, the inventory is quite small and I spent most of the time going back and forth between deposits, storage and build sites. I also like collecting all deposits which was becoming time and air consuming.

The inventory is managed by the aforementioned SpaceCraft.Inventory class and its capacity is handled in the inventorySize private field. Helaas, all I could do is overwrite this field in 3 locaties: the constructor, the getter and the setter to not break the assembly structure to much:

public Inventory(int _inventoryId, int _inventorySize, List _worldObjectsInInventory = null)
{
    this.inventoryId = _inventoryId;
    this.inventorySize = _inventorySize;
    this.inventorySize = 250; // <----------------------------------
    this.worldObjectsInInventory = ((_worldObjectsInInventory != null) ? _worldObjectsInInventory : new List());
    this.authorizedGroups = new List();
}
public int GetSize()
{
    this.inventorySize = 250; // <----------------------------------
    return this.inventorySize;
}


public void SetSize(int _inventorySize)
{
    if (_inventorySize == this.inventorySize)
    {
        return;
    }
    this.inventorySize = _inventorySize;
    this.inventorySize = 250; // <----------------------------------
    this.RefreshDisplayerContent();
}

Echter, this has some UI consequences:

  • The inventory screen for the player will exceed the screen and you won’t be able to interact with anything beyond it.
  • It affects the equipment “inventaris”
  • It affects all containers, including the core miner.
  • Items picked up are added to the end of the inventory and may not be visible, including air, water and food items.
  • Too many clicking when depositing inventory into containers.
  • Screen lag when viewing and moving items around in containers.

Gelukkig, the latter to can be remedied by the sorter and group move mods above. Store items per type in separate containers.

Asteroid Location (Cheating)

Standaard, the game targets a relatively large radius around the player when asteroids (natural and resource called in via rockets) land. My base is at the lambda rock and the launch structure is also there. Vervolgens, many rocks end up in the lake of the starting area.

The asteroids are handled in the SpaceCraft.AsteroidHandler and the target selection is in the SpawnAsteroid() methode. Find the loop and in it, a vector calculated via an Unity random and radius. Change it to something like this:

Vector2 vector = UnityEngine.Random.insideUnitCircle * Math.Min((float)_asteroidEvent.distanceFromPlayer, 20F);

The reason I use Math.Min is to avoid unwanted reoptimization of the method when it gets recompiled. 20f is pretty tight so I recommend going out into an open field or elevated position. This concentration has the drawback that the player location is flooded with debris that may bury the player and those rocks stay for minutes before despawning.

Waarschuwing. In the Early Access versions, the asteroids can and do hurt the player so either give the mod a bigger radius or go indoors and wait for the debris to disappear.

Dat is alles wat we vandaag hiervoor delen De Planeetmaker gids. Deze handleiding is oorspronkelijk gemaakt en geschreven door akarnokd. Voor het geval we er niet in slagen deze handleiding bij te werken, U kunt de laatste update vinden door dit te volgen link.

Als u van mening bent dat de inhoud van deze site uw rechten schendt, inclusief uw intellectuele eigendomsrechten, neem dan direct contact met ons op via ons contactformulier.
Gidsen Labels:De Planeetmaker

Bericht navigatie

Vorig bericht: Lost Wish: In the Desperate World Achievements Guide
Volgende bericht: A Memoir Blue Achievement Walkthrough Guide

Geef een reactie Reactie annuleren

Je e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

  • Titel: De Planeetmaker
  • Releasedatum:
  • Ontwikkelaar: Miju Games
  • Uitgever: Miju Games
Information about The Planet Crafter is still incomplete. Help ons alstublieft de details van het spel hiermee in te vullen contactformulier.

Vrijwaring

Alle geciteerde inhoud is afgeleid van hun respectieve bronnen. Als u denkt dat wij uw inhoud zonder toestemming hebben gebruikt, Zorg ervoor dat u ons bereikt en wij zullen het serieus nemen.
  • Over ons
  • Neem contact met ons op
  • Privacybeleid
  • Servicevoorwaarden

Auteursrecht © 2025 Rel-bits.

Aangedreven door PersBoek Nieuws WordPress thema