1. would be happy to know if theres a method / hook for that .
    i tried

    void OnStructureRotate(BaseCombatEntity entity, BasePlayer player)
    {

    doesnt work..
     
  2. No, there's not a hook for it. The only way to prevent rotation is to put items in it or building block it.
     
  3. @Crushed

    I found a way, but its hacky.

    1. Create a Dictionary to save a VendingMachine + the placement rotation
    Code:
    Dictionary<VendingMachine, Quaternion> vendings = new Dictionary<VendingMachine, Quaternion>();
    2. If a VendingMachine gets placed, save it and its rotation into a dictionary
    Code:
    void OnEntityBuilt(Planner plan, GameObject gameObject)
            {
                VendingMachine vending = gameObject.GetComponent<VendingMachine>();
                if(vending != null)
                {
                    vendings.Add(vending, vending.transform.rotation);
                }
           }
    3. Check if the rotation has been changed on tick
    Code:
    void OnTick()
            {
                foreach(var vending in vendings)
                {
                    if(vending.Key.transform.rotation != vending.Value)
                    {
                        vending.Key.transform.rotation = vending.Value;
                        vending.Key.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
                    }
                }
            }
    IMPORTANT!
    This is not the best way to do it. It's just a quick example how to achieve the "rotation block".

    Improvements would be to check only one vendingMachine per tick (to keep the "check" impact low), delete the VendingMachine from the dictionary if it doesn't exist anymore, save and load vendingmachines on server start/stop, etc.


    Greetings,
    Blackanges
     
    Last edited by a moderator: Mar 3, 2017
  4. Wulf

    Wulf Community Admin

    Latest snapshot has a hook for this.

    OnRotateVendingMachine(VendingMachine vending, BasePlayer player)

    Return anything other than null to block it.
     
  5. HAH! awesome. Thanks Mr. wulf!

    i assume the Oxide Docs ...are not completed?` i feel like theres nothing thats being added....
     
  6. Wulf

    Wulf Community Admin

    It is in a snapshot, not a release.