Jump to content

Barricade Issue ( Hydrocraft Mod)


Fjörgynn

Recommended Posts

Like in title, in multiplayer mode spikelog barricades are instantly disappearing when placed, and error popup in console window about bugged line #28 in file HCBarricadeAction.lua. They do exist tho, cause after placing invisible wall is created (zombies are attacking it too) and dead zombie body texture  on the floor (cannot grab it, I suppose it's bug related). In single player mode mod  is working fine. Here's the code (all file), maybe someone had same issue before. Thank you in advance for any help / suggestions and sorry if I misplaced my post, I'm new around.

 

http://s13.postimg.org/hi6okyehz/zombo.jpg

 

[spoiler]
[code]

require "TimedActions/ISBaseTimedAction"

ISAddBarricadeAction = ISBaseTimedAction:derive("ISAddBarricadeAction");

function ISAddBarricadeAction:isValid()
    return true;
end

function ISAddBarricadeAction:update()
    self.item:setJobDelta(self:getJobDelta());
end

function ISAddBarricadeAction:start()
    self.item:setJobType("placeBarricade");
    self.item:setJobDelta(0.0);
end

function ISAddBarricadeAction:stop()
    ISBaseTimedAction.stop(self);
    self.item:setJobDelta(0.0);
end

function ISAddBarricadeAction:perform()
    self.item:getContainer():setDrawDirty(true);
    self.item:setJobDelta(0.0);
    self.character:getInventory():Remove("HCLogbarrier");
    if isClient() then
        local args = {x = self.sq:getX(), y = self.sq.getY(), z = self.sq.getZ(), sprite = self.sprite};
        sendClientCommand(self.character, 'Hydrocraft', 'placeBarricade', args);
    else
        HCPlaceItem.placeBarricade(self.sq, self.sprite);
    end
    ISBaseTimedAction.perform(self);
end

function ISAddBarricadeAction:new(character, sq, item, sprite, time)
    local o = {};
    setmetatable(o, self);
    self.__index = self;
    o.character = character;
    o.item = item;
    o.stopOnWalk = true;
    o.stopOnRun = true;
    o.maxTime = time;
    o.sprite = sprite;
    o.sq = sq;
    return o;
end

[/code]
[/spoiler]

Link to comment
Share on other sites

Well, if it's physically there but appearance wise isn't, then it's most likely an issue with the sprite.

Syntax wise everything seems okay, but I'm not familiar with the arguments that sendClientCommand() takes.

 

From the source code...

 

sendClientCommand(IsoPlayer player, String module, String command, KahluaTable args)

 

How Hydrocraft calls it...

 

sendClientCommand(self.character, 'Hydrocraft', 'placeBarricade', args);

 

Seems correct to me. However, I'm not sure what defines commands. So, more code stalking.

 

After some more code stalking, I came across a function called by the OnClientCommand function.

 

function HCPlaceItem.OnClientCommand(module, command, player, args)
    if module ~= 'Hydrocraft' then return end
    if command == 'placeBarricade' then
        local gs = getCell():getGridSquare(args.x, args.y, args.z);
        if gs then
            HCPlaceItem.placeBarricade(gs, args.sprite);
        end
    elseif command == 'placeStonePillar' then
        local gs = getCell():getGridSquare(args.x, args.y, args.z);
        if gs then
            HCPlaceItem.placeStonePillar(gs, args.sprite);
        end
    end
end

 

Now that I'm in more familiar territory, I'll double check with my Cheat Menu mod to see how I placed items, and see if Hydrocraft does anything differently.

 

        local cell = getWorld():getCell();
        local sq = cell:getGridSquare(wx, wy, wz);

 

I define the cell variable as getWorld():getCell(), and then call it later.

 

Hydrocraft calls getCell() directly, but does not call getWorld().

Could this be the issue?

Link to comment
Share on other sites

They also throw errors on the server-side console . . . Will get it later.

Mind sharing the log?

Really curious as of what's wrong. Code looks fine, everything seems normal, but it inexplicably fails to load the sprite despite having it defined, even though the sprite works fine on singleplayer.

Link to comment
Share on other sites

Well, if it's physically there but appearance wise isn't, then it's most likely an issue with the sprite.

Syntax wise everything seems okay, but I'm not familiar with the arguments that sendClientCommand() takes.

 Yup, I was reading a bit, trying to dig deeper but without any results. Syntax seems to be ok, yet it isn't. That's why I've posted issue here - I'm out of ideas.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...