Jump to content

MadAlchemist

Vintarian
  • Posts

    26
  • Joined

  • Last visited

Posts posted by MadAlchemist

  1. Well, this post is really old, but just yesterday I got exactly the same bug after dragging UI sections around the screen. It can be fixed by deleting %APPDATA%\VintagestoryData\clientsettings.json and (optionally) it's backup file. After that, you will have to login to your Vintage Story account again, and all client settings will be reset to default (GUI layout, keyboard layout). No risk of damaging world. Google keeps this post at top when searching for this problem, so I hope this will be useful for someone who will have the same problem.

    • Like 2
    • Thanks 1
  2. On 1/20/2022 at 5:29 AM, Allan Bittorf said:

    How do you disable the step up feature??

    In newer version (1.1.0), open %AppData%\VintageStoryData\ModConfig\tinytweaks.json (on Windows, not sure where it is on Linux), and set everything you don't want to false. Stick crafting cannot be disabled, this option is reserved for future versions! You must have the same config on both server and client, or it may have strange behavior (will try to make it auto-sync in next versions).

  3. This is my first Vintage Story mod that is fully working. It still lacks some features which I will add later, like config to disable what you don't need or already have.
     

    • Are you tired of being eaten by wolf just because game is blocky? Ok, now you will auto-jump to 1 block high obstacles when sprinting;
    • Do you just like me think that sticks must be craftable? Ok, now you can turn a piece of firewood into stick using a knife;
    • Do you think that seraphs breathing underwater are cheaty? Ok, now they can't. Once your head is underwater, your air bar starts to deplete, and you take damage when it is empty;
    • Isn't it terrible to lose all your precious stuff because you can't find a place where you died? Ok, now deaths are marked on maps;

     

    Mod is for 1.16.0 and may not work with any older version! Sources will be available, too, once I will upload them on github.

    tinytweaks_v1.0.0.zip

    • Like 1
  4. I really cannot understand why is my mountable entity crashing. I have copied most of code from bed block entity, the difference is that my entity is EntityAgent and not BlockEntity, and that it does not have any sleep-related code. Just trying to make player mount an entity, no other functionality at this moment.

    Main class:

    Spoiler
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Vintagestory.API.Common;
    using Vintagestory.API.Client;
    using Vintagestory.API.Server;
    using Vintagestory.GameContent;
    using ProtoBuf;
    using Vintagestory.API.Datastructures;
    using Vintagestory.API.MathTools;
    
    namespace aeronautics.src
    {
    
        [ProtoContract(ImplicitFields = ImplicitFields.AllPublic)]
        public class ControlMessage
        {
            public string message;
        }
    
        public class Main : ModSystem
        {
            #region Client
            public static void BalloonControl(IClientPlayer player, ICoreClientAPI api, IClientNetworkChannel ch)
            {
                /* PgUp is hardcoded to switch burner on. */
                if (api.Input.KeyboardKeyStateRaw[((int)GlKeys.PageUp)])
                {
                    if (player.Entity.MountedOn != null && player.Entity.MountedOn.GetType() == typeof(HotAirBalloon))
                    {
                        /* Turning on balloon burner on server */
                        ch.SendPacket(new ControlMessage()
                        {
                            message = "ON"
                        });
                    }
                }
    
                /* PgDown is hardcoded to switch burner off.*/
                if (api.Input.KeyboardKeyStateRaw[((int)GlKeys.PageDown)])
                {
                    if (player.Entity.MountedOn != null && player.Entity.MountedOn.GetType() == typeof(HotAirBalloon))
                    {
                        /* Turning on balloon burner on server */
                        ch.SendPacket(new ControlMessage()
                        {
                            message = "OFF"
                        });
                    }
                }
    
                /* Insert is hardcoded to refuel.*/
                if (api.Input.KeyboardKeyStateRaw[((int)GlKeys.Insert)])
                {
                    if (player.Entity.MountedOn != null && player.Entity.MountedOn.GetType() == typeof(HotAirBalloon))
                    {
                        /* Trying to refuel balloon */
                        ch.SendPacket(new ControlMessage()
                        {
                            message = "REFUEL"
                        });
                    }
                }
            }
            #endregion
    
            public override void Start(ICoreAPI api)
            {
                base.Start(api);
                api.RegisterMountable("HotAirBalloon", HotAirBalloon.GetMountable);
                api.RegisterEntity("HotAirBalloon", typeof(HotAirBalloon));
    
            }
    
            public override bool ShouldLoad(EnumAppSide side) => true;
    
    
            #region Client
            IClientNetworkChannel clientChannel;
            ICoreClientAPI clientApi;
            public override void StartClientSide(ICoreClientAPI api)
            {
                clientApi = api;
    
                clientChannel =
                    api.Network.RegisterChannel("aeronautics")
                    .RegisterMessageType(typeof(ControlMessage));
    
                base.StartClientSide(api);
            }
            #endregion
    
    
    
            #region Server
            IServerNetworkChannel serverChannel;
            ICoreServerAPI serverApi;
            public override void StartServerSide(ICoreServerAPI api)
            {
                serverApi = api;
                serverChannel =
                api.Network.RegisterChannel("aeronautics")
                    .RegisterMessageType(typeof(ControlMessage))
                    .SetMessageHandler<ControlMessage>(OnControlMessage)
                ;
    
                base.StartServerSide(api);
            }
    
            /* Control message handler */
            private void OnControlMessage(IServerPlayer player, ControlMessage msg)
            {
     
            }        
            #endregion
        }
    }
    

     

    Entity class:

    Spoiler
    namespace aeronautics.src
    {
        using Vintagestory.API.Common;
        using Vintagestory.API.Datastructures;
        using Vintagestory.API.MathTools;
    
        public class HotAirBalloon : EntityAgent, IMountable
        {
            public HotAirBalloon()
            {
                base.AllowDespawn = false;
            }
    
            public EntityAgent MountedBy;
    
            public Vec3d MountPosition
            {
                get
                {
                    return (base.SidedPos.XYZ);
                }
            }
            public string SuggestedAnimation
            {
                get { return "sitflooridle"; }
            }
    
            public void MountableToTreeAttributes(TreeAttribute tree)
            {
                tree.SetString("className", "HotAirBalloon");
                tree.SetInt("posx", ((int)this.ServerPos.X));
                tree.SetInt("posy", ((int)this.ServerPos.Y));
                tree.SetInt("posz", ((int)this.ServerPos.Z));
            }
    
            public void DidUnmount(EntityAgent entityAgent)
            {
                MountedBy = null;
                entityAgent.TeleportTo(this.ServerPos.XYZ.Add(1.0, 1.0, 1.0));
            }
    
            public void DidMount(EntityAgent entityAgent)
            {
                if (MountedBy != null)
                {
                    entityAgent.TryUnmount();
                    return;
                }
                MountedBy = entityAgent;
            }
    
            public float? MountYaw
            {
                get
                {
                    return this.BodyYaw;
                }
            }
    
            public static IMountable GetMountable(IWorldAccessor world, TreeAttribute tree)
            {
                Vec3d position = new Vec3d(tree.GetInt("posx", 0) + 0.25, tree.GetInt("posy", 0) + 0.25, tree.GetInt("posz", 0) + 0.25);
                return (world.GetNearestEntity(position, 0.1f, 0.1f, null) as HotAirBalloon);
            }
    
            public override void OnInteract(EntityAgent byEntity, ItemSlot slot, Vec3d hitPosition, EnumInteractMode mode)
            {
                if ((mode != EnumInteractMode.Interact) || !(byEntity is EntityPlayer))
                {
                    base.OnInteract(byEntity, slot, hitPosition, mode);
                }
    
                if (byEntity != null && byEntity is EntityPlayer)
                {
    
                    if(this.MountedBy != null)
                    {
                        this.TryUnmount();
                    }
                    byEntity.TryMount(this);
                }
            }
        }
    }

    Crash log:

    Spoiler

     

    Spoiler
    System.ArgumentNullException
      HResult=0x80004003
      Сообщение = Значение не может быть неопределенным.
    Имя параметра: key
      Источник = mscorlib
      Трассировка стека:
       в System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
       в System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
       в System.Collections.Generic.Dictionary`2.get_Item(TKey key)
       в Vintagestory.Common.ClassRegistry.CreateMountable(IWorldAccessor world, TreeAttribute tree)
       в Vintagestory.API.Common.EntityAgent.<Initialize>b__30_0()
       в Vintagestory.API.Datastructures.SyncedTreeAttribute.MarkPathDirty(String path)
       в Vintagestory.API.Common.EntityAgent.TryMount(IMountable onmount)
       в aeronautics.src.HotAirBalloon.OnInteract(EntityAgent byEntity, ItemSlot slot, Vec3d hitPosition, EnumInteractMode mode) в Z:\Dev\VintageStory\Mods\mods\aeronautics\src\HotAirBalloon.cs:строка 80
       в Vintagestory.Client.NoObf.SystemMouseInWorldInteractions.HandleMouseInteractionsNoBlockSelected(Single dt)
       в Vintagestory.Client.NoObf.SystemMouseInWorldInteractions.OnFinalizeFrame(Single dt)
       в Vintagestory.Client.NoObf.ClientEventManager.TriggerRenderStage(EnumRenderStage stage, Single dt)
       в Vintagestory.Client.NoObf.ClientMain.TriggerRenderStage(EnumRenderStage stage, Single dt)
       в Vintagestory.Client.NoObf.ClientMain.RenderToDefaultFramebuffer(Single dt)
       в _RpDe0Jt5dbuWGpUxAyvHOIbDBGg._tu5y7iPBPWTBAhlukeXpnCcwz6W(Single )
       в _NLF4wmb6UPVLzv4DtU2r1ijDMNo._g5gGlJCvd5tg8L2OIzh5Cqwv60N(Single )
       в _NLF4wmb6UPVLzv4DtU2r1ijDMNo._0gqbRXtZfqKlQCIZaKgLGM2FkhV(Single )
       в Vintagestory.Client.NoObf.ClientPlatformWindows.window_RenderFrame(Object sender, FrameEventArgs e)
       в System.EventHandler`1.Invoke(Object sender, TEventArgs e)
       в OpenTK.GameWindow.RaiseRenderFrame(Double elapsed, Double& timestamp)
       в OpenTK.GameWindow.DispatchRenderFrame()
       в OpenTK.GameWindow.Run(Double updates_per_second, Double frames_per_second)
       в _nFNsDM20as86sGo44HbF6xxAkUD._UjMaM1bzP5Ozg5ilu06DMFIxPyO(_uhgd4BSf8z6N7PAibzFcq8c5IRD , String[] )
       в _Y4Bk3tLdFsgoJryQq19g4IoitkE._UjMaM1bzP5Ozg5ilu06DMFIxPyO(ThreadStart )
       в _nFNsDM20as86sGo44HbF6xxAkUD._uGIMddfWgVMG3Q8EvXiBxar6tZB(String[] )
    

     

     

    Entity JSON:

    Spoiler

     

    {
      "code": "HotAirBalloon",
      "class": "HotAirBalloon",
      "entityClass": "HotAirBalloon",
      "canClimbAnywhere": true,
      //"habitat": "Air",
      "hitboxSize": {
        "x": 2,
        "y": 2
      },
      "deadHitboxSize": {
        "x": 2,
        "y": 2
      },
      "eyeHeight": 1.0,
      "drops": [],
      "sounds": {
        "hurt": "crack",
        "death": "crack_loud"
      },
      "client": {
        "renderer": "Shape",
        "shape": { "base": "entity/air/hot_air_balloon" },
        "textures": {
          "ceramic": { "base": "aeronautics:entity/air/balloon/ceramic" },
          "basket": { "base": "aeronautics:entity/air/balloon/basket" },
          "normal1": { "base": "aeronautics:entity/air/balloon/normal1" },
          "rope_hi_res": { "base": "aeronautics:entity/air/balloon/rope_hi_res" },
          "leather": { "base": "aeronautics:entity/air/balloon/leather" }
        },
        "behaviors": [
          { "code": "repulseagents" },
          {
            "code": "controlledphysics",
            "stepHeight": 1.1
          },
          { "code": "interpolateposition" }
        ],
        "animations": []
      },
      "server": {
        "behaviors": [
          { "code": "repulseagents" },
          {
            "code": "controlledphysics",
            "stepHeight": 1.1
          },
          {
            "code": "health",
            "currenthealth": 40,
            "maxhealth": 40
          }
        ]
      }
    }
  5. I have some questions about how weather is working in VS.

    1) Wind direction. I know wind is only decorative, but does it change direction? Are there some way to make entity pushable by wind like particles?

    1.1) If I have to implement real wind myself, how do I make "decorative" wind push particles in same direction?
    2) Absolute minimum and maximum for temperatures, in coldest region during harsh winter and in hottest region during hot summer?

    3) Maximum possible height (not a build limit, but absolute maximum where player can fly). And, what happens if it's exceeded - player dies or just can't fly higher?

  6. 27 minutes ago, Spear and Fang said:

    Blockbed.cs, sleeping.cs, bebed.cs, + dnSpy or similar to go deeper.
    https://github.com/search?q=org%3Aanegostudios+bed&type=code

    You've got your work cut out for you though because iMountable is not fully fleshed out (although I understand that Tyron made some improvements to it after watching Vies streaming some of his Viescraft modding on Twitch).  https://www.twitch.tv/vies

    Yes, I have found that GitHub page, and, with source code of survival mode available, it works (partially):
    2021-12-25_18-01-22.thumb.png.d0e55adb0605a532acdc436ae2cc6574.png

    Not controllable yet, but I have attached drifter's wander AI to it, and it does carry player when moves!

    • Like 1
  7. 2 hours ago, Spear and Fang said:

    The only rideable entity that I'm aware of (aside from the vanilla bed) is Viescraft.
    https://mods.vintagestory.at/show/mod/791

    Yes, there's no source available for it so your only options are to (1) reach out to Vies, (2) Use dnSpy or similar, (3) Build it from scratch based on the bed (like Vies did).

    The bed really may be what I need. Never thought about it, because it's not moving entity but a block. 

  8. 11 minutes ago, Spear and Fang said:

    I didn't get that far, although I had a design document of sorts.  I ended up dropping that mod and my halloween mod, and merged my other two into Primitive Survival.  That's the only mod I'm working on these days.

    Vintage Story due to it's world size definitely needs some transport, and air balloons are perfect because:

    1) They are very lore-friendly due to low tech requirements (even if filled with hydrogen instead of hot air);

    2) They are not affected by forests, mountains and lakes;

    3) They don't need any animations except movement ov whole balloon.

    So I decided to create some aeronautics mod. Realistic mechanics are my top priority, I don't want to make lot of different aircrafts, just two air balloon types: hot air and hydrogen. Some planned features:

    1) Balloons depend on wind direction. No motors, just liftoff when wind is right and land when not;

    2) Balloon efficiency depends on temperature. If air outside is too warm, balloon needs more fuel to keep flying (probably not affects hydrogen balloons as warm hydrogen expands too);

    3) Air dangers: hostile birds (if i will be able to make it look normal), hydrogen explosiveness, temporal storms affecting balloons;

    4) Maybe, propellers - allows to control flight direction. Requires motor which requires lost tech stuff like rusty gears and temporal gears, and some exotic fuel.

    5) When everything functional is ready - maybe more aircraft designs...

    • Cookie time 3
  9. Is there any way to use different texture file for each part of entity, just like for block faces? I am making air balloon mod, and want to use different texture files for basket, balloon and burner. It's really difficult to make all these textures as single file. And entity tutorial describes only how to specify one texture file (or it's variants, but not parts).

  10. Hello! I am trying to create my first VintageStory mod, but constantly getting an error, something like "ingredient pattern size wrong" or "no ingredient pattern" (it disappearss too quickly to write down, and not appears in logs). Recipe is not loaded, of course. Here is my recipe JSON:
     

    {
      ingredientPattern: "K F",
      width: 1,
      height: 2,
      ingredients: {
        "K": {
          type: "item",
          code: "game:knife-*",
          isTool: true
        },
        "F": {
          type: "item",
          code: "game:firewood"
        }
      },
      output: {
        type: "item",
        code: "game:stick",
        quantity: 2
      }
    }
    

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.