Add recycling slot;simplify TA signs
|
@ -90,6 +90,8 @@ When everything is added, you should be able to see some signs. To select a diff
|
|||
|
||||
Sign writing consumes ink. The amount of ink used depends on the sign you're writing. Assuming a full set of carridges, you can write 4 lightboxes, 10 map signs or 20 line/platform signs.
|
||||
|
||||
If you insert a sign into the recycling slot, you will get back some of your ink. If you're really lucky, you'll recover a plastic sheet, too.
|
||||
|
||||
Cartridges can be refilled in the crafting grid.
|
||||
|
||||
.. image:: screenshots/recipe3.png
|
||||
|
|
|
@ -210,7 +210,6 @@ function add_map(city, city_descrip, line_table, type_table)
|
|||
-- several types - a normal station, an interchange station, a section of the line
|
||||
-- with no station, and so on
|
||||
|
||||
|
||||
for line, line_descrip in pairs(line_table) do
|
||||
for unit, unit_descrip in pairs(type_table) do
|
||||
add_map_unit(city, city_descrip, line, line_descrip, unit, unit_descrip, "", "")
|
||||
|
@ -223,8 +222,7 @@ function add_map(city, city_descrip, line_table, type_table)
|
|||
city, city_descrip, line, line_descrip, unit, unit_descrip,
|
||||
"termrc", "right terminus"
|
||||
)
|
||||
-- Tunnelers' Abyss map signs use istation for interchanges not at the end of a line
|
||||
elseif string.find(unit, "station") and unit ~= "istation" then
|
||||
elseif string.find(unit, "station") then
|
||||
add_map_unit(
|
||||
city, city_descrip, line, line_descrip, unit, unit_descrip,
|
||||
"terml", "left terminus"
|
||||
|
|
4
init.lua
|
@ -36,7 +36,7 @@
|
|||
metrosigns = {}
|
||||
metrosigns.name = "metrosigns"
|
||||
metrosigns.ver_max = 1
|
||||
metrosigns.ver_min = 19
|
||||
metrosigns.ver_min = 22
|
||||
metrosigns.ver_rev = 0
|
||||
|
||||
metrosigns.writer = {}
|
||||
|
@ -188,6 +188,8 @@ function capitalise(str)
|
|||
|
||||
if str == "newyork" then
|
||||
return "New York"
|
||||
elseif str == "tabyss" then
|
||||
return "TA"
|
||||
else
|
||||
return (str:gsub("^%l", string.upper))
|
||||
end
|
||||
|
|
108
machine.lua
|
@ -141,6 +141,9 @@ function metrosigns.writer.populateoutput(pos)
|
|||
-- Plastic
|
||||
"label[0,3;Plastic\nSheet]"..
|
||||
"list[current_name;plastic;1.5,3;1,1;]"..
|
||||
-- Recycling
|
||||
"label[0,4;Recycling\nSlot]"..
|
||||
"list[current_name;recycle;1.5,4;1,1;]"..
|
||||
-- Sign categories
|
||||
"label[0,5;Sign\nCategory]"..
|
||||
"dropdown[1.5,5;3.75,1;category;"..dropdown_string..";"..tostring(dropdown_index).."]"..
|
||||
|
@ -160,7 +163,9 @@ function metrosigns.writer.populateoutput(pos)
|
|||
"listring[current_player;main]"..
|
||||
"listring[current_name;bluecart]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;plastic]"
|
||||
"listring[current_name;plastic]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;recycle]"
|
||||
)
|
||||
meta:set_int("maxpage",maxpage)
|
||||
|
||||
|
@ -174,37 +179,46 @@ function metrosigns.writer.allow_metadata_inventory_put(pos, listname, index, st
|
|||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack_name = stack:get_name()
|
||||
local stack_count = stack:get_count()
|
||||
local player_inv = player:get_inventory()
|
||||
local move_flag
|
||||
|
||||
if listname == "redcart" and stack:get_name() == "metrosigns:cartridge_red" then
|
||||
local ink_refund = 0
|
||||
local redcart = inv:get_stack("redcart", 1)
|
||||
local greencart = inv:get_stack("greencart", 1)
|
||||
local bluecart = inv:get_stack("bluecart", 1)
|
||||
local plastic = inv:get_stack("plastic", 1)
|
||||
|
||||
-- Deal with the right node in the right slot
|
||||
if listname == "redcart" and stack_name == "metrosigns:cartridge_red" then
|
||||
return 1
|
||||
elseif listname == "greencart" and stack:get_name() == "metrosigns:cartridge_green" then
|
||||
elseif listname == "greencart" and stack_name == "metrosigns:cartridge_green" then
|
||||
return 1
|
||||
elseif listname == "bluecart" and stack:get_name() == "metrosigns:cartridge_blue" then
|
||||
elseif listname == "bluecart" and stack_name == "metrosigns:cartridge_blue" then
|
||||
return 1
|
||||
elseif listname == "plastic" and stack:get_name() == "basic_materials:plastic_sheet" then
|
||||
return stack:get_count()
|
||||
elseif listname == "plastic" and stack_name == "basic_materials:plastic_sheet" then
|
||||
return stack_count
|
||||
end
|
||||
|
||||
-- Cannot rely on the listring to put the right type of cartridge into the right slot;
|
||||
-- a green cartridge would be put into the red cartridge slot
|
||||
-- The workaround is to move the green cartridge into the green slot directly
|
||||
if stack:get_name() == "metrosigns:cartridge_green" and inv:is_empty("greencart") then
|
||||
if stack_name == "metrosigns:cartridge_green" and inv:is_empty("greencart") then
|
||||
|
||||
if player_inv:remove_item("main", stack) then
|
||||
inv:add_item("greencart", stack)
|
||||
move_flag = true
|
||||
end
|
||||
|
||||
elseif stack:get_name() == "metrosigns:cartridge_blue" and inv:is_empty("bluecart") then
|
||||
elseif stack_name == "metrosigns:cartridge_blue" and inv:is_empty("bluecart") then
|
||||
|
||||
if player_inv:remove_item("main", stack) then
|
||||
inv:add_item("bluecart", stack)
|
||||
move_flag = true
|
||||
end
|
||||
|
||||
elseif stack:get_name() == "basic_materials:plastic_sheet" and inv:is_empty("plastic") then
|
||||
elseif stack_name == "basic_materials:plastic_sheet" and inv:is_empty("plastic") then
|
||||
|
||||
if player_inv:remove_item("main", stack) then
|
||||
inv:add_item("plastic", stack)
|
||||
|
@ -213,12 +227,83 @@ function metrosigns.writer.allow_metadata_inventory_put(pos, listname, index, st
|
|||
|
||||
end
|
||||
|
||||
-- All metrosigns nodes (except lightboxes and the sign writer itself) can be recycled
|
||||
-- For each compatible node added to the recycling slot, the player has a 66% chance of
|
||||
-- receiving some plastic. In addition, they receive between 50-100% of the ink consumed in
|
||||
-- crafting the node
|
||||
if listname == "recycle"
|
||||
and not string.find(stack_name, "sign_writer")
|
||||
and (
|
||||
string.find(stack_name, "metrosigns:sign")
|
||||
or string.find(stack_name, "metrosigns:map")
|
||||
or string.find(stack_name, "signs_road:metrosigns")
|
||||
) then
|
||||
|
||||
-- Decide how much ink to recover from the recycling process, and restore it to the
|
||||
-- cartridges
|
||||
-- THe player never receives the full amount
|
||||
if string.find(stack_name, "metrosigns:sign") then
|
||||
ink_refund = math.random(1, (metrosigns.writer.sign_units - 1))
|
||||
elseif string.find(stack_name, "metrosigns:map") then
|
||||
ink_refund = math.random(1, (metrosigns.writer.map_units - 1))
|
||||
else
|
||||
ink_refund = math.random(1, (metrosigns.writer.text_units - 1))
|
||||
end
|
||||
|
||||
ink_refund = ink_refund * metrosigns.writer.cartridge_min
|
||||
|
||||
if not inv:is_empty("redcart") then
|
||||
if redcart:get_wear() < ink_refund then
|
||||
redcart:set_wear(0)
|
||||
else
|
||||
redcart:set_wear(redcart:get_wear() - ink_refund)
|
||||
end
|
||||
|
||||
inv:set_stack("redcart", 1, redcart)
|
||||
end
|
||||
|
||||
if not inv:is_empty("greencart") then
|
||||
if greencart:get_wear() < ink_refund then
|
||||
greencart:set_wear(0)
|
||||
else
|
||||
greencart:set_wear(greencart:get_wear() - ink_refund)
|
||||
end
|
||||
|
||||
inv:set_stack("greencart", 1, greencart)
|
||||
end
|
||||
|
||||
if not inv:is_empty("bluecart") then
|
||||
if bluecart:get_wear() < ink_refund then
|
||||
bluecart:set_wear(0)
|
||||
else
|
||||
bluecart:set_wear(bluecart:get_wear() - ink_refund)
|
||||
end
|
||||
|
||||
inv:set_stack("bluecart", 1, bluecart)
|
||||
end
|
||||
|
||||
-- Randomly restore a plastic sheet
|
||||
if math.random(0, 1) <= 0.67 then
|
||||
if inv:is_empty("plastic") then
|
||||
inv:add_item("plastic", ItemStack("basic_materials:plastic_sheet 1"))
|
||||
elseif plastic:get_count() < plastic:get_stack_max() then
|
||||
plastic:set_count(plastic:get_count() + 1)
|
||||
inv:set_stack("plastic", 1, plastic)
|
||||
end
|
||||
end
|
||||
|
||||
-- Destroy the recycled item
|
||||
player_inv:remove_item("main", stack)
|
||||
return 0
|
||||
|
||||
end
|
||||
|
||||
-- In this situation, the list of writeable signs is not updated automatically
|
||||
if move_flag then
|
||||
metrosigns.writer.populateoutput(pos)
|
||||
end
|
||||
|
||||
-- Having put the green cartridge in the green slot, don't put the greed cartridge in the red
|
||||
-- Having put the green cartridge in the green slot, don't put the green cartridge in the red
|
||||
-- slot (etc), as well
|
||||
return 0
|
||||
|
||||
|
@ -231,6 +316,7 @@ function metrosigns.writer.can_dig(pos)
|
|||
return (
|
||||
inv:is_empty("redcart") and inv:is_empty("greencart")
|
||||
and inv:is_empty("bluecart") and inv:is_empty("plastic")
|
||||
and inv:is_empty("recycle")
|
||||
)
|
||||
|
||||
end
|
||||
|
@ -247,6 +333,7 @@ function metrosigns.writer.on_construct(pos)
|
|||
inv:set_size("greencart", 1)
|
||||
inv:set_size("bluecart", 1)
|
||||
inv:set_size("plastic", 1)
|
||||
inv:set_size("recycle", 1)
|
||||
|
||||
metrosigns.writer.populateoutput(pos)
|
||||
|
||||
|
@ -422,7 +509,6 @@ minetest.register_node("metrosigns:sign_writer", {
|
|||
"metrosigns_writer_side.png",
|
||||
"metrosigns_writer_front.png",
|
||||
},
|
||||
inventory_image = "metrosigns_writer_front.png",
|
||||
groups = {cracky = 2},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
|
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 62 KiB |
|
@ -45,8 +45,11 @@ if metrosigns.create_all_flag or metrosigns.create_tabyss_flag then
|
|||
add_sign(server, server_descrip, "s4", "Coram Line", 1, 1)
|
||||
add_sign(server, server_descrip, "s5", "Thorviss Line", 1, 1)
|
||||
add_sign(server, server_descrip, "s6", "Recursive Dragon", 1, 1)
|
||||
add_sign(server, server_descrip, "s8", "Tiny Line", 1, 1)
|
||||
add_sign(server, server_descrip, "s13", "Exfactor Line", 2, 1)
|
||||
add_sign(server, server_descrip, "s15", "Beach Line", 2, 1)
|
||||
add_sign(server, server_descrip, "r1", "Narsh Express", 1, 1)
|
||||
add_sign(server, server_descrip, "r2", "Crystal Line", 1, 1)
|
||||
add_sign(server, server_descrip, "t1", "Tommy's Line", 1, 1)
|
||||
add_sign(server, server_descrip, "t2", "Subway", 1, 1)
|
||||
-- GS Metro
|
||||
|
@ -73,8 +76,11 @@ if metrosigns.create_all_flag or metrosigns.create_tabyss_flag then
|
|||
["s4"] = "Coram Line",
|
||||
["s5"] = "Thorviss Line",
|
||||
["s6"] = "Recursive Dragon",
|
||||
["s8"] = "Tiny Line",
|
||||
["s13"] = "Exfactor Line",
|
||||
["s15"] = "Beach Line",
|
||||
["r1"] = "Narsh Express",
|
||||
["r2"] = "Crystal Line",
|
||||
["t1"] = "Tommy's Line",
|
||||
["t2"] = "Subway",
|
||||
-- GS Metro (lines 1-3, 4A, 5A, 6-7, 8A use the same colours as above)
|
||||
|
@ -85,61 +91,8 @@ if metrosigns.create_all_flag or metrosigns.create_tabyss_flag then
|
|||
{
|
||||
["line"] = "Line",
|
||||
["station"] = "Station",
|
||||
}
|
||||
)
|
||||
|
||||
-- Interchanges show the colours of the connecting lines in the centre of the texture
|
||||
-- These interchanges are not at the end of a line
|
||||
add_map(
|
||||
server,
|
||||
server_descrip,
|
||||
{
|
||||
["s1_s15_r1"] = "Abyssal Express",
|
||||
["s1_s15"] = "Abyssal Express",
|
||||
["s1_spn"] = "Abyssal Express",
|
||||
["s1_s2_s15"] = "Abyssal Express",
|
||||
["s1_s2_s6"] = "Abyssal Express",
|
||||
["s1_s2"] = "Abyssal Express",
|
||||
["s2_s3_t1"] = "Fractal Plains",
|
||||
["s2_s3"] = "Fractal Plains",
|
||||
["s2_spn"] = "Fractal Plains",
|
||||
["s2_s1_s15"] = "Fractal Plains",
|
||||
["s2_s1_s6"] = "Fractal Plains",
|
||||
["s2_s1"] = "Fractal Plains",
|
||||
["s3_s2_t1"] = "Erosion Trap",
|
||||
["s3_s2"] = "Erosion Trap",
|
||||
["s3_s1"] = "Erosion Trap",
|
||||
["s3_s1_s15"] = "Erosion Trap",
|
||||
["s4_spn"] = "Coram Line",
|
||||
["s5_s15"] = "Thorviss Line",
|
||||
["s5_spn"] = "Thorviss Line",
|
||||
["s6_s1_s2"] = "Recursive Dragon",
|
||||
["s15_s1_r1"] = "Beach Line",
|
||||
["s15_s1"] = "Beach Line",
|
||||
["s15_s1_s4"] = "Beach Line",
|
||||
["s15_s5"] = "Beach Line",
|
||||
},
|
||||
{
|
||||
["istation"] = "Interchange",
|
||||
}
|
||||
)
|
||||
|
||||
-- These interchanges ARE at the end of a line
|
||||
add_map(
|
||||
server,
|
||||
server_descrip,
|
||||
{
|
||||
["s2_s3_s4"] = "Fractal Plains",
|
||||
["s3_s2_s4"] = "Erosion Trap",
|
||||
["s4_s2_s3"] = "Coram Line",
|
||||
["r1_s1_s15"] = "Narsh Express",
|
||||
["t1_s2_s3"] = "Tommy's Line",
|
||||
["t1_t2"] = "Tommy's Line",
|
||||
["t2_t1"] = "Subway",
|
||||
["t2_spn"] = "Subway",
|
||||
},
|
||||
{
|
||||
["cstation"] = "Interchange",
|
||||
["sstation"] = "Spawn Interchange",
|
||||
}
|
||||
)
|
||||
|
||||
|
|
After Width: | Height: | Size: 215 B |
After Width: | Height: | Size: 230 B |
After Width: | Height: | Size: 224 B |
After Width: | Height: | Size: 228 B |
After Width: | Height: | Size: 230 B |
After Width: | Height: | Size: 238 B |
After Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 244 B |
After Width: | Height: | Size: 241 B |
After Width: | Height: | Size: 230 B |
After Width: | Height: | Size: 115 B |
After Width: | Height: | Size: 236 B |
After Width: | Height: | Size: 210 B |
After Width: | Height: | Size: 227 B |
After Width: | Height: | Size: 117 B |
After Width: | Height: | Size: 236 B |
After Width: | Height: | Size: 206 B |
After Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 241 B |
Before Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 230 B |
After Width: | Height: | Size: 237 B |
After Width: | Height: | Size: 212 B |
Before Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 213 B |
Before Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 217 B |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 225 B |
After Width: | Height: | Size: 213 B |
Before Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 229 B |
Before Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 227 B |
Before Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 231 B |
After Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 241 B |
Before Width: | Height: | Size: 238 B |
After Width: | Height: | Size: 237 B |
After Width: | Height: | Size: 227 B |
Before Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 235 B |
After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 231 B |
After Width: | Height: | Size: 212 B |
Before Width: | Height: | Size: 227 B |
After Width: | Height: | Size: 229 B |
After Width: | Height: | Size: 228 B |
After Width: | Height: | Size: 117 B |
After Width: | Height: | Size: 237 B |
After Width: | Height: | Size: 213 B |
After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 236 B |
After Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 228 B |
After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 232 B After Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 234 B |
After Width: | Height: | Size: 235 B |
After Width: | Height: | Size: 201 B |
After Width: | Height: | Size: 194 B |
After Width: | Height: | Size: 180 B |
After Width: | Height: | Size: 220 B |
After Width: | Height: | Size: 197 B |
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 173 B |
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 235 B |