Modding Help [URGENT] Smashing entities in multiplayer. How to use sendEntityMessage, or other Solution

Discussion in 'Starbound Modding' started by Symphony, Nov 11, 2015.

  1. Symphony

    Symphony Giant Laser Beams

    Hey everyone. So this has been an extremely painful, critical, and apparently largely ignored issued that we've been having for awhile. I'm sort of a scrub so I can't really figure out a solution on my own :( I was hoping some nice folk could either offer the solution, or some input and tips to come to a solution.

    The Problem

    It's undeniably important for the ability to smash objects, even those set to unbreakable. Mostly because, if a player were to make pornographic signs, malicious signs, clutter objects (Couches, tables, workbenches, decorations, ANYTHING), and use an editor like starcheat to make these objects unbreakable, it's next to impossible for server owners or anyone to remove these objects conveniently. The only possible way to destroy objects that have been set to unbreakable is to kick everyone from the planet, pluck that planet file from the multiplayer universe, inject it into singleplayer, use the /entityeval entity.smash() command to break it, then overwrite the multiplayer world with the singleplayer world.

    This is a frustrating, time consuming, and obnoxious solution :(


    I've heard of two possible solutions to this when asking around, both of which are unexplained and difficult to understand for a pleb like me.



    A) Use sendEntityMessage from a tech script with a messageHandler applied to every single object that then smashs it. ????

    :cool: Spawn an NPC/Stagehand which then calls upon the entity.smash() method for you. ?????????????????????????



    I'm stumped, I don't know how to do either of these things.

    What I need to be able to do, is use a custom tech to register a players cursor position, query for the closest object (any and ALL objects, ever), and then break that object on tech use, whether that be through special key or mouse click.

    As for A), yes. I have read this thread
    http://community.playstarbound.com/...for-setresourcepercentage-not-working.100021/

    Thank you so much for your time, and please please please help <3 !
     
  2. Owl_Stalker

    Owl_Stalker Guest

    I'm probably missing something here, but if the owner wanted to remove an unbreakable object, couldn't they just log into the server on an admin account and use the command there instead of doing all the jazz with the world's file?

    Also, I might want to point out that such a tech has a pretty large greifing potential and probably isn't very safe to discuss in a public space such as this thread. If anyone offers you help, I recommend taking your discussion to a private conversation so that the information on how to do this doesn't 'fall into the wrong hands'.

    Anyways, good luck with finding a solution.
     
  3. Symphony

    Symphony Giant Laser Beams

    First, no. They cannot. The /entityeval entity.smash() command cannot be used in multiplayer, ever, by anyone. Even playing on the host machine doesn't allow you to use it. There is, as of now, literally no means to break unbreakable objects in multiplayer.

    Not having the ability to break unbreakable objects, when literally anyone can make any object unbreakable (Which is a good thing, this is helpful!) is also a greifing tool. Everything can be used to greif. Greifing cannot be avoided, and annihilating useful features for the sake of 'greif prevention' is like banning knives indiscriminately for 'murder prevention', despite their overwhelming usefulness. :p

    I sort of understand what you're saying, and if anyone has a solution or some ideas, please feel free to PM me. I'll respond to this thread with 'SOLVED!" if a solution is ever discovered.
     
  4. Kluex Avatar

    Kluex Avatar Star Wrangler

    Can you ban the player to remove the object?
     
  5. TheElderScroller

    TheElderScroller Pangalactic Porcupine

    No. If you ban someone their modification to planets remain.
     
  6. TheElderScroller

    TheElderScroller Pangalactic Porcupine

    You could spawn a npc, that breaks objects for you. But you need a serverside mod for this.
    NPCs are serversided, just like objects. So the access to objects and NPCs from tech is limited.

    Have the mod contain a script that will run on the npc. for example

    Code:
    function init()
      local object = world.objectQuery(mcontroller.position(), 1)[1]
      if object then
        world.callScriptedEntity(object, "object.smash()") -- we want to use that instead sendEntityMessage!!
      end
      status.setResource("health", 0)
    end
    
    spawn an NPC with parameters set so that the NPC uses the new script from tech at your mouse position and it should destroy the nearest object, if there is one, and then die.
    Obviously you can make improvements like making the NPC invisible but thats another point.

    I didn't test this at all, but you should get the idea.
    The reason for this solution is:
    world.callScriptedEntity should always work on objects, where world.sendEntityMessage needs to have the object set up a messageHandler.
    but if someone was to grief they could remove all scripts and thus all messageHandlers.

    Also, if someone somehow knows the path and name of the script in the mod they could abuse that to break objects aswell...
     
  7. GoldenstarArtist

    GoldenstarArtist Cosmic Narwhal

    ^ does anyone know if this actually works? or knows of a mod that does?
     

Share This Page