feat: give proper names to each cannon (#18)

Also show descriptions in HUD
This commit is contained in:
Kiëd Llaentenn 2023-05-31 04:48:56 -04:00 committed by GitHub
parent 29c0daca0b
commit 4ab6284534
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -101,7 +101,8 @@ local register_spacecannon = function(def)
minetest.register_node("spacecannon:cannon_" .. def.color, { minetest.register_node("spacecannon:cannon_" .. def.color, {
description = "Spacecannon (" .. def.desc .. ")", description = def.name .. " (" .. def.desc .. ")",
-- top, bottom -- top, bottom
tiles = { tiles = {
"cannon_blank.png" .. cable_entry, "cannon_blank.png" .. cable_entry,
@ -175,7 +176,11 @@ local register_spacecannon = function(def)
local config_require = spacecannon.config.ki_powerrequirement local config_require = spacecannon.config.ki_powerrequirement
if def.is_th then config_require = spacecannon.config.th_powerrequirement end if def.is_th then config_require = spacecannon.config.th_powerrequirement end
meta:set_string("infotext", "Power: " .. eu_input .. "/" .. demand .. " Store: " .. store) local infotext =
"Power: " .. eu_input .. "/" .. demand .. " " ..
"Store: " .. store .. "\n" ..
def.name .. ": " .. def.desc
meta:set_string("infotext", infotext)
if store < config_store then if store < config_store then
-- charge -- charge
@ -230,8 +235,10 @@ local register_spacecannon = function(def)
end end
register_spacecannon({ register_spacecannon({
is_th = true,
color = "green", color = "green",
name = "Ion cannon",
desc = "fast, low damage",
is_th = true,
range = 1, range = 1,
storage_require_mod = 1, storage_require_mod = 1,
damage = 2, damage = 2,
@ -239,13 +246,14 @@ register_spacecannon({
timeout = 8, timeout = 8,
speed = 10, speed = 10,
penetration = 0, penetration = 0,
desc = "fast,low damage",
ingredient = "default:mese_block" ingredient = "default:mese_block"
}) })
register_spacecannon({ register_spacecannon({
is_th = true,
color = "yellow", color = "yellow",
name = "Plasma cannon",
desc = "medium speed, medium damage",
is_th = true,
range = 3, range = 3,
storage_require_mod = 3, storage_require_mod = 3,
intensity = 2, intensity = 2,
@ -253,13 +261,14 @@ register_spacecannon({
timeout = 8, timeout = 8,
speed = 5, speed = 5,
penetration = 0, penetration = 0,
desc = "medium speed, medium damage",
ingredient = "spacecannon:cannon_green" ingredient = "spacecannon:cannon_green"
}) })
register_spacecannon({ register_spacecannon({
is_th = true,
color = "red", color = "red",
name = "Nova cannon",
desc = "slow, heavy damage",
is_th = true,
range = 5, range = 5,
storage_require_mod = 5, storage_require_mod = 5,
intensity = 4, intensity = 4,
@ -267,7 +276,6 @@ register_spacecannon({
timeout = 15, timeout = 15,
speed = 3, speed = 3,
penetration = 0, penetration = 0,
desc = "slow, heavy damage",
ingredient = "spacecannon:cannon_yellow" ingredient = "spacecannon:cannon_yellow"
}) })
@ -275,8 +283,10 @@ register_spacecannon({
-- Regular railgun -- Regular railgun
register_spacecannon({ register_spacecannon({
is_th = false,
color = "blue", color = "blue",
name = "Railgun cannon",
desc = "fast, 2x penetrating damage",
is_th = false,
range = 0, range = 0,
storage_require_mod = 1, storage_require_mod = 1,
intensity = 2, intensity = 2,
@ -284,14 +294,15 @@ register_spacecannon({
timeout = 10, timeout = 10,
speed = 9, speed = 9,
penetration = 2, penetration = 2,
desc = "fast, 2x penetrating damage",
ingredient = "technic:copper_coil" ingredient = "technic:copper_coil"
}) })
-- Helical railgun -- Helical railgun
register_spacecannon({ register_spacecannon({
is_th = false,
color = "purple", color = "purple",
name = "Helical railgun cannon",
desc = "fast, 4x penetrating damage",
is_th = false,
range = 0, range = 0,
storage_require_mod = 1.5, storage_require_mod = 1.5,
intensity = 4, intensity = 4,
@ -299,6 +310,5 @@ register_spacecannon({
timeout = 15, timeout = 15,
speed = 10, speed = 10,
penetration = 4, penetration = 4,
desc = "fast, 4x penetrating damage",
ingredient = "spacecannon:cannon_blue" ingredient = "spacecannon:cannon_blue"
}) })