Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

Modding API - new requests

Discussion in 'Modding API' started by joeblack616, Oct 22, 2014.

Thread Status:
Not open for further replies.
This last post in this thread was made more than 31 days old.
  1. midspace Senior Engineer

    Messages:
    2,224
    Please add `BuiltBy` to `VRage.Game.ModAPI.IMySlimBlock`

    BuiltBy information seems to be very lacking in the API.



    The `Sandbox.Game.Entities.MyCubeGrid.TransferBlocksBuiltByID` appears to be the only available API to transfer the BuiltBy to another player.

    However this does not work with older savegames where the BuiltBy has not been set.
    The code is checking for a valid IdentityId, and it isn't valid where it is not set (it defaults to zero).
     
    Last edited: Jan 4, 2017
  2. Eikester Apprentice Engineer

    Messages:
    423
    i request access to Render.GetModel()
     
  3. Phoera Senior Engineer

    Messages:
    1,713
    at least dummies itself.
    and safe-only ofc.
     
  4. Dummy0815 Trainee Engineer

    Messages:
    16
    Can we have access to:
    Code:
    MyTerminalBlock.RaisePropertiesChanged();
    or put a RaisePropertiesChanged inside RefreshCustomInfo
    Code:
    ..MyTerminalBlock ..{
    public void RefreshCustomInfo()
            {
                CustomInfo.Clear();
                var handler = AppendingCustomInfo;
                if (handler != null)
                {
                    handler(this, CustomInfo);
                    RaisePropertiesChanged();
                }
            }
    }
    
    I can't see any other way to update the GUI Terminal screen immediately, if a mod add CustomInfo to DetailInfo.
    Or have I missed something?
     
  5. mooviies Trainee Engineer

    Messages:
    14
    Any plans to add access to MySoundBlock.CueId via IMySoundBlock so that it is possible to change the played sound?
     
  6. Digi Senior Engineer

    Messages:
    2,393
    @mooviies
    It already has a way to change the sound.
    Code:
    		/// <summary>
    		/// Gets or sets the selected sound.
    		/// </summary>
    		/// <remarks>The sound can be selected either by using the unique hash name, or the user visible text.<p />
    		/// Fetching the name will always return the unique hash name.
    		/// </remarks>
    		string SelectedSound
    		{
    			get;
    			set;
    		}
    
    There's no way to get the list of sounds via code tho, you'll have to look in the SoundBlock.sbc.

    You can also use modded ones if you know their name and you can even check if it exists by setting it then getting it and comparing it to your set value, as it will refuse to set it if it doesn't exist.
     
    • Informative Informative x 1
  7. midspace Senior Engineer

    Messages:
    2,224
    Not quite true.
    Via the ModAPI...
    Code:
    SoundDescription soundsDesc = MyDefinitionManager.Static.GetSoundCategoryDefinitions().First(d => d.Id.SubtypeName.Equals("DefaultCategory", StringComparison.InvariantCultureIgnoreCase)).Sounds.FirstOrDefault(s => s.SoundId.Equals("SoundBlockLightsOn", StringComparison.CurrentCultureIgnoreCase));
    You can then test soundsDesc for null to see if it exists, or change "DefaultCategory" to whatever your mod has created.
    and use the value from soundsDesc.SoundName
     
  8. Digi Senior Engineer

    Messages:
    2,393
    Ah, of course in modding you can access definitions, I assumed they asked about PB because if you want to play sounds in mods you don't need to bother with sound blocks, you can just create an MyEntity3DSoundEmitter object and play sounds wherever you want.
     
  9. mooviies Trainee Engineer

    Messages:
    14
    Oh good to know. Thanks.
     
  10. midspace Senior Engineer

    Messages:
    2,224
    We need better methods of setting/changing BuiltBy.

    I've been trying to change all blocks on a grid to a specific player, but the closest method I've found is this.
    Code:
    ((MyCubeGrid)grid).TransferBlocksBuiltByID(fromIdentityId, toIdentityId);
    This requires me to cycle through all existing playerIds.
    And... it doesn't appear to sync.
     
  11. Duckroll Trainee Engineer

    Messages:
    73
    Request: The ability to add a filter interface globally to all turrets in order to disable or specify targeting.

    Spec: Given a turret A IMyUserControllableGun) and target B (IMyCubeBlock) the filter could return either a boolean (true: it's fine to shoot, false: don't shoot this)


    Use Case Example 1: Mod which allows turrets to only shoot at weapons / engines / etc.

    Code enters the filter with the argument of the closest target it found, a battery block, and the filter checks to see if this block is a turret/engine and returns false. The targeting code continues to iterate all other possible targets until it finds a valid one (with the filter returning true) or until it reaches the end of the list.

    Use Case Example 2: Mod which adds a nebula with low visibility

    Code enters the filter with the argument of the turret and block to target. The code checks to see if either are within the nebula, and if so if they are within the lowered visible distance, returning false if this is not the case.

    Use Case Example 3: Mod which adds pirates that steal cargo

    Similar to example 1, turrets only fire on hostile targets, but if a ship is disabled the pirates attempt to grind apart containers and steal from it instead.
     
  12. xphoenixxx Junior Engineer

    Messages:
    529
    also need to make a decoy block show as all kinds of block types in this case.. or they become useless.. so an undamaged one would always show as true
     
  13. Duckroll Trainee Engineer

    Messages:
    73
    Well, I expect that would be up to the modder. Someone might want to have decoy blocks only work 95% of the time or something. How they implement the filter should be left open.
     
  14. Phoera Senior Engineer

    Messages:
    1,713
    you can do this now, but are you sure that you want? :)
     
  15. etopsirhc Trainee Engineer

    Messages:
    98
    wonder if we could get system.speech.synthesis added to whitelist. i think it'd be cool to make it so we can make custom ship messages w/o having to add audio files everywhere or pulling in a half dozen existing mods that don't even sound the same.
     
  16. rexxar Senior Engineer

    Messages:
    1,532
Thread Status:
Not open for further replies.
This last post in this thread was made more than 31 days old.