API Bugs

Discussion in 'Empyrion API' started by Jascha, Mar 14, 2017.

  1. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    SpawnInfo.exportedEntityDat doesnt work anymore for area-filebased structure creating :-(

    public async Task CreateStructure(ShipInfo ship, PlayerInfo player)
    {
    var NewID = await Request_NewEntityId();
    var isEPBFile = string.Compare(Path.GetExtension(ship.StructureDirectoryOrEPBName), ".epb", StringComparison.InvariantCultureIgnoreCase) == 0;
    var SpawnInfo = new EntitySpawnInfo()
    {
    forceEntityId = NewID.id,
    playfield = ship.SpawnLocation.playfield,
    pos = ship.SpawnLocation.pos,
    rot = ship.SpawnLocation.rot,
    name = $"{ship.DisplayName} for {player.playerName}",
    type = (byte)ship.EntityType,
    entityTypeName = "", // 'Kommentare der Devs: ...or set this to f.e. 'ZiraxMale', 'AlienCivilian1Fat', etc
    factionGroup = 1,
    factionId = player.entityId,
    };
    if (isEPBFile)
    {
    SpawnInfo.prefabName = Path.GetFileNameWithoutExtension (ship.StructureDirectoryOrEPBName);
    SpawnInfo.prefabDir = Path.Combine(EmpyrionConfiguration.SaveGameModPath, "ShipsData");
    }
    else
    {
    var SourceDir = Path.Combine(EmpyrionConfiguration.SaveGameModPath, "ShipsData", ship.StructureDirectoryOrEPBName);
    var TargetDir = Path.Combine(EmpyrionConfiguration.SaveGamePath, "Shared", $"{NewID.id}");
    var exportDat = Path.Combine(SourceDir, "Export.dat");
    SpawnInfo.exportedEntityDat = File.Exists(exportDat) ? exportDat : null;
    Directory.CreateDirectory(Path.GetDirectoryName(TargetDir));
    CopyAll(new DirectoryInfo(SourceDir), new DirectoryInfo(TargetDir));
    }
    try { await Request_Load_Playfield(new PlayfieldLoad(20, ship.SpawnLocation.playfield, 0)); }
    catch { } // Playfield already loaded
    await Request_Entity_Spawn(SpawnInfo);
    await Request_Structure_Touch(NewID); // Sonst wird die Struktur sofort wieder gelöscht !!!
    }

    EPB works fine and if exportedEntityDat is set to null the structure is created also BUT without the device configurations.
    And it dosent matter if the Export.dat is in the same folder or another

    The full code you will finde here
    https://github.com/GitHub-TC/EmpyrionShipBuying
     
    #121
  2. oshadow

    oshadow Commander

    Joined:
    Dec 10, 2015
    Messages:
    55
    Likes Received:
    21
    Eleon.Modding.IPlayer Interface Reference
    SteamId[get] - always return empty string

    it would be nice to add the missing fields as in
    Eleon.Modding.PlayerInfo Class

     
    #122
  3. oshadow

    oshadow Commander

    Joined:
    Dec 10, 2015
    Messages:
    55
    Likes Received:
    21
    BUG?
    Eleon.Modding.IPlayer Interface Reference

    properties give the correct value only on the first call, then the data in them is frozen and no longer change
    List< ItemStack > Toolbar[get]
    List< ItemStack > Bag[get]

    Very nice, but the 0 slot of the Toolbar property is changing) and only it
     
    #123
    Last edited: Apr 25, 2020
  4. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Thanks. Will add it to the list
     
    #124
    Germanicus likes this.
  5. oshadow

    oshadow Commander

    Joined:
    Dec 10, 2015
    Messages:
    55
    Likes Received:
    21
    Mode: Survival
    Mode: Dedicated Server

    SERVER NAME: my test server
    SEED-ID:

    Reproducibility: Always
    Severity:Minor


    Type: DB

    Summary: API command - Entity_Destroy and Entity_Destroy2
    not mark entity deleted in database!
    isremoved parameter in entity does not change to true

    admin command in console - work correct
     
    #125
  6. Taelyn

    Taelyn Guest

    Please use the API Bug Section for the API

    Ive mereged with the correct thread

    Thanks for reporint!
     
    #126
    Germanicus likes this.
  7. tachyon

    tachyon Commander

    Joined:
    Aug 12, 2015
    Messages:
    92
    Likes Received:
    134
    Hello there,

    IBlock::getDamage()
    does not work correctly for "multe-size" blocks like HV/SV cockpits or thrusters. For such blocks the correct value is only returned for the coordinate of the structure that is shown in the debug info. All other coordinates return 0 damage. On the other hand, the Id is returned correctly for all parts of the "multi-size" block. If the damage would be returned correctly for all blocks of the dtructure that are occupied by lets say a SV cockpit, this would allow for example a mod for damage monitoring. With the current state this his hardly possible.
     
    #127
  8. Jascha

    Jascha Administrator

    • Moderator
    Joined:
    Jan 22, 2016
    Messages:
    1,141
    Likes Received:
    713
    Thanks will put it on the Devs list
     
    #128
    Germanicus and tachyon like this.
  9. tachyon

    tachyon Commander

    Joined:
    Aug 12, 2015
    Messages:
    92
    Likes Received:
    134
    I have a question here: Since the ModAPI bugs are not tracked in the regular bug thread and there are no bug states, how can we now you plan to deal with the reported bugs?
     
    #129
  10. Taelyn

    Taelyn Guest

    Jascha will test it and report it internaly towards us

    When it will be fixed you will find it in the Patch Notes
     
    #130
    tachyon likes this.
  11. oshadow

    oshadow Commander

    Joined:
    Dec 10, 2015
    Messages:
    55
    Likes Received:
    21
    Have news on bug fixes and new API improvements?
    It is necessary to fix the incorrect display of data in IPlayer, add methods for editing parameters,
    fix the StructureUnload method
    You need to get and edit data on the reputation of NPCs, debuffs, armor, armor status and improvements.
    add the ability not only to see events after the fact,
    but to receive control before the event, with the possibility of correction or cancellation.
    For example, the player wants to teleport to Aqua, and we teleport him to Omicron ...)
    or simply write to him that teleport is impossible!


    upload_2020-12-17_18-58-13.png
     
    #131
  12. idontwanttosleep

    idontwanttosleep Ensign

    Joined:
    Jan 11, 2021
    Messages:
    1
    Likes Received:
    0
    when you drive a ship to change playfield, the ship you are driving will be MISSING in the IModApi.ClientPlayfield.Entities
    looks like it is not added.
     
    #132
  13. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    @Jascha In der 1.4 arbeitet die "neue" Mimik für Blocks/Items nur über Namen - wie kann ich ermitteln welche IDs dazu gehören da die ModAPI ja nur auf IDs funktioniert?
     
    #133
  14. Taelyn

    Taelyn Guest

    ItemIds are added by Number even for > 2048
    { Item Id: 2049, Name: xxxxx
    }

    etc etc etc
    For the ModAPI its ItemsConfig IdNumber + 4096
    This number you get out of that you use in the ModAPI

    BlockIds also have a Number even for > 2048
    There written like this
    { Block Name: xxxx
    }

    But they have a number the first block is 2048, 2049, 2050 etc etc
    They just dont have this number listed in the BlocksConfig.ecf
    For the BlocksConfig you use the actual number in the ModAPI so 2048, 2049, 2050 etc etc
     
    #134
  15. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    Man hätte auch einfach sagen können <4096 ist Eleon alles darüber sind zusätzliche Dinge von Moddern. Dann hätte man nichts Ändern müssen!!! Diese, nun implementierte, "Krücke" erschließt sich mir nicht :-(
     
    #135
  16. Taelyn

    Taelyn Guest

    There will be an HOTFIX later today what will change the Config_Example.ecf so you can simple read it again for import and you dont have to add changes to your code. We changed the IdNumbes in the file

    f.ex:
    Code:
    { Item Id: 4373, Name: AnniversaryCake, Ref: FoodTemplate }
     
    #136
  17. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    GetBlockAndItemMapping doesn't work from a playfieldserver mod
     
    #137
  18. Taelyn

    Taelyn Guest

    Check your code please. It works fine for me. Checked EAH since its useing it aswell and works fine too

    EAH writes a Itemlist.csv to Root/Content/Mods/EPF/ItemList.csv

    Simple line of Code to write it to the Playfield.log File
    Code:
                    foreach (KeyValuePair<string, int> testSystem in modApi.Application.GetBlockAndItemMapping())
                    {
                        modApi.LogError($"{testSystem.Key}, {testSystem.Value}");
                    }
     
    #138
  19. ASTIC

    ASTIC Captain

    Joined:
    Dec 11, 2016
    Messages:
    991
    Likes Received:
    707
    It works in Dedi (Dedicated_210317-115746-93.log)
    Note: but the block mapping is empty :-(

    but not in PfServer (Playfield_210317-115756-30.log)
    tested with a ReforgedEden sceario
     
    #139
    Last edited: Mar 17, 2021
  20. Taelyn

    Taelyn Guest

    Iam running it on the PlayfieldServer and so is EAH. It works fine for us.

    This is really something in your code thats not correct

    You cant get this on the Dedi. Its PfServer ONLY
     
    #140

Share This Page