mirror of
https://github.com/pandorabox-io/spacecannon.git
synced 2024-12-21 05:15:47 +01:00
only shoot in warzone
This commit is contained in:
parent
2ceaa9857e
commit
21c908792c
@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
local register_spacecannon = function(def)
|
local register_spacecannon = function(def)
|
||||||
|
|
||||||
local entity_texture = "energycube_" .. def.color .. ".png"
|
local entity_texture = "energycube_" .. def.color .. ".png"
|
||||||
|
15
util.lua
15
util.lua
@ -1,4 +1,4 @@
|
|||||||
|
local has_warzone_mod = minetest.get_modpath("warzone")
|
||||||
|
|
||||||
spacecannon.update_formspec = function(meta)
|
spacecannon.update_formspec = function(meta)
|
||||||
meta:set_string("formspec", "size[8,2;]" ..
|
meta:set_string("formspec", "size[8,2;]" ..
|
||||||
@ -6,6 +6,19 @@ spacecannon.update_formspec = function(meta)
|
|||||||
end
|
end
|
||||||
|
|
||||||
spacecannon.fire = function(pos, color, speed, range)
|
spacecannon.fire = function(pos, color, speed, range)
|
||||||
|
|
||||||
|
|
||||||
|
if has_warzone_mod then
|
||||||
|
-- check warzone height
|
||||||
|
local min_y = warzone.y_start
|
||||||
|
local max_y = warzone.y_start + warzone.y_height
|
||||||
|
|
||||||
|
if pos.y < min_y or pos.y > max_y then
|
||||||
|
-- not in warzone
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- check fuel/power
|
-- check fuel/power
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local owner = meta:get_string("owner")
|
local owner = meta:get_string("owner")
|
||||||
|
Loading…
Reference in New Issue
Block a user