Barbed Fence: Difference between revisions
m (Moved Table of contents below the improve notice) |
(→Code: Addition of full code for barbed wire in lua files. First section relates to needing a hammer and wire to activate the option, 2nd section relates to consumption and placement.) |
||
Line 29: | Line 29: | ||
|} | |} | ||
==Code== | ==Code== | ||
''''' | '''''From ISBuildMenu.lua (media/lua/client/BuildingObjects/ISUI)''''' | ||
<nowiki> | |||
local barbedOption = subMenu:addOption(getText("ContextMenu_Barbed_Fence"), worldobjects, ISBuildMenu.onBarbedFence, square, player); | |||
local tooltip2 = ISBuildMenu.canBuild(0,0,0,0,1,5,barbedOption, player); | |||
-- we add that we need a Barbed wire too | |||
if not getSpecificPlayer(player):getInventory():contains("BarbedWire") and not ISBuildMenu.cheat then | |||
tooltip2.description = tooltip2.description .. " <RGB:1,0,0>" .. getItemText("Barbed wire") .. " 0/1 "; | |||
barbedOption.onSelect = nil; | |||
barbedOption.notAvailable = true; | |||
else | |||
tooltip2.description = tooltip2.description .. " <RGB:1,1,1>" .. getItemText("Barbed wire") .. " 1 "; | |||
end | |||
tooltip2:setName(getText("ContextMenu_Barbed_Fence")); | |||
tooltip2.description = getText("Tooltip_craft_barbedFenceDesc") .. tooltip2.description; | |||
tooltip2:setTexture("fencing_01_20"); | |||
ISBuildMenu.requireHammer(barbedOption) | |||
ISBuildMenu.onBarbedFence = function(worldobjects, square, player) | |||
-- sprite, northSprite, corner | |||
local fence = ISWoodenWall:new("fencing_01_20", "fencing_01_21", nil); | |||
-- we can place our fence every where | |||
-- fence.canBeAlwaysPlaced = true; | |||
fence.hoppable = true; | |||
fence.canBarricade = false | |||
fence.modData["xp:Woodwork"] = 5; | |||
fence.modData["need:Base.BarbedWire"] = "1"; | |||
fence.player = player | |||
fence.name = "Barbed Fence" | |||
getCell():setDrag(fence, player); | |||
end | |||
</nowiki> | </nowiki> | ||
Revision as of 23:34, 9 May 2017
Template:Items Barbed wire fences can help wall off and defend an area, while still allowing you to see through them.
According to the LUA file Barbed Fence is supposed to have a chance to scratch, however, this is not implemented as of yet.
(tooltip2.description = "A barbed wire fence, it's slowing your movement and can scratch you " )
In addition to the barbed wire, you also will need a wooden stake to be placed in order to make the barbed fence. Currently, each barbed wire will provide one tile of fencing, with or without the wooden stake.
Crafting
Output | Ingredients | Description | Skill Level | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Code
From ISBuildMenu.lua (media/lua/client/BuildingObjects/ISUI)
local barbedOption = subMenu:addOption(getText("ContextMenu_Barbed_Fence"), worldobjects, ISBuildMenu.onBarbedFence, square, player); local tooltip2 = ISBuildMenu.canBuild(0,0,0,0,1,5,barbedOption, player); -- we add that we need a Barbed wire too if not getSpecificPlayer(player):getInventory():contains("BarbedWire") and not ISBuildMenu.cheat then tooltip2.description = tooltip2.description .. " <RGB:1,0,0>" .. getItemText("Barbed wire") .. " 0/1 "; barbedOption.onSelect = nil; barbedOption.notAvailable = true; else tooltip2.description = tooltip2.description .. " <RGB:1,1,1>" .. getItemText("Barbed wire") .. " 1 "; end tooltip2:setName(getText("ContextMenu_Barbed_Fence")); tooltip2.description = getText("Tooltip_craft_barbedFenceDesc") .. tooltip2.description; tooltip2:setTexture("fencing_01_20"); ISBuildMenu.requireHammer(barbedOption) ISBuildMenu.onBarbedFence = function(worldobjects, square, player) -- sprite, northSprite, corner local fence = ISWoodenWall:new("fencing_01_20", "fencing_01_21", nil); -- we can place our fence every where -- fence.canBeAlwaysPlaced = true; fence.hoppable = true; fence.canBarricade = false fence.modData["xp:Woodwork"] = 5; fence.modData["need:Base.BarbedWire"] = "1"; fence.player = player fence.name = "Barbed Fence" getCell():setDrag(fence, player); end
History
Alpha | |
---|---|
- | - |