1. Check out the Store if you're looking to Buy HL2RP or other schemas for your server. You can click Buy Schemas on the very top navigation bar to visit the store.
  2. Use the Plugin Center to easily subscribe to and auto-install Clockwork plugins to your server, or submit and share plugins you have developed.
  3. Having trouble setting up or developing with Clockwork? Check out the Wiki or post in the Support Forum for advice from fellow users.
Dismiss Notice
Hi Guest, you need a Steam account to register and post on these forums. Login with Steam at the top of the forums to get started!
Dismiss Notice
Hi Guest, do you want to buy HL2RP or another Clockwork schema? Visit the Cloud Sixteen Store to get started!

Uberfactory Supplement Dispensor Broke

Discussion in 'Requests' started by Wiz, Feb 16, 2018.

  1. Wiz

    Wiz Clockwork Customer Active Member

    Basically uberfactory dispenses water just not supplements, heres my code.

    Code:
    include("shared.lua");
    
    AddCSLuaFile("cl_init.lua");
    AddCSLuaFile("shared.lua");
    
    -- Called when the entity initializes.
    function ENT:Initialize()
        self:SetModel("models/MaxOfS2D/button_05.mdl");
       
        self:SetMoveType(MOVETYPE_VPHYSICS);
        self:PhysicsInit(SOLID_VPHYSICS);
        self:SetUseType(SIMPLE_USE);
        self:SetSolid(SOLID_VPHYSICS);
       
        self.tube = ents.Create("prop_dynamic");
        self.tube:DrawShadow(false);
        self.tube:SetAngles( self:GetAngles() + Angle(0,90,0));
        self.tube:SetParent(self);
        self.tube:SetModel("models/mechanics/solid_steel/box_beam_4.mdl");
        self.tube:SetMaterial("models/props_pipes/GutterMetal01a");
        self.tube:SetPos( self:GetPos() + Vector(-16,0,-6));
        self.tube:Spawn();
    
        self:DeleteOnRemove(self.tube);
           
        self:SetCollisionGroup(COLLISION_GROUP_WORLD);
       
        local phys = self:GetPhysicsObject()
        phys:SetMass( 120 )
       
        self:SetSpawnType(1);
    end;
    
    function ENT:SetSpawnType(entType)
        if (entType == TYPE_WATERCAN or entType == TYPE_CONSUMABLES) then
            self:SetDTInt(1,entType);
        end;
    end;
    
    function ENT:UpdateTransmitState()
        return TRANSMIT_ALWAYS;
    end;
    
    function ENT:EmitRandomSound()
        local randomSounds = {
            "ambient/machines/combine_terminal_idle2.wav",
            "buttons/button4.wav"
        };
       
        self:EmitSound( randomSounds[ math.random(1, #randomSounds) ] );
    end;
    
    function ENT:PhysicsUpdate(physicsObject)
        if (!self:IsPlayerHolding() and !self:IsConstrained()) then
            physicsObject:SetVelocity( Vector(0, 0, 0) );
            physicsObject:Sleep();
        end;
    end;
    
    function ENT:Use(activator, caller)
        if (activator:IsPlayer() and activator:GetEyeTraceNoCursor().Entity == self) then
            local curTime = CurTime();
           
            if (!self.nextUse or curTime >= self.nextUse) then
                self:EmitRandomSound();
               
                self:SpawnItem(activator);
               
                self.nextUse = curTime + 5;
            else
                self:EmitSound("buttons/button11.wav");
            end;
        end;
    end;
    
    function ENT:SpawnItem(activator)
        if (self:GetSpawnType() == TYPE_WATERCAN) then
            Clockwork.entity:CreateItem( activator, "breens_water", self.tube:GetPos());
        else
            Clockwork.entity:CreateItem( activator, "suppl_citizen", self:GetPos());
        end;
    end;
    
    function ENT:CanTool(player, trace, tool)
        return false;
    end;
    
     
  2. Reagent

    Reagent The Reagent Menace Active Member

    probably because you don't have any uniqueid's pointing to "suppl_citizen" that you're referencing, pretty sure the original plugin has it referenced as "citizen_supplements"
     
  3. Wiz

    Wiz Clockwork Customer Active Member

    Yes it does but that didn’t work either
     
  4. Wiz

    Wiz Clockwork Customer Active Member

    Any ideas?
     
    • Good Coder Good Coder x 1
  5. Strange. Mine works fine, but I made a ton of modifications to it to fit my server. I presume it's the item IDs because that's all I changed with the supplement dispenser.
     

Previous Readers (Total: 0)