my first changes

This commit is contained in:
Bruno Rybársky 2022-07-11 08:32:12 +02:00
parent 034489359d
commit 15640770f3
15 changed files with 101 additions and 461 deletions

@ -1,4 +1,8 @@
# portalgun
original repo:https://github.com/AiTechEye/portalgun
Licenses: code: LGPL-2.1, media: CC BY-SA-4.0
For changes check git or compare to original repo
Remixed by: BRNSystems
https://forum.minetest.net/viewtopic.php?f=11&t=12772

285
craft.lua

@ -1,285 +0,0 @@
minetest.register_craft({
output = "portalgun:gun1_placed",
recipe = {{"portalgun:gun1"}}})
minetest.register_craft({
output = "portalgun:gun2_placed",
recipe = {{"portalgun:gun2"}}})
minetest.register_craft({
output = "portalgun:gun_placed",
recipe = {{"portalgun:gun"}}})
minetest.register_craft({
output = "portalgun:turretgun",
recipe = {
{"", "portalgun:secam_off", ""},
{"", "default:mese_crystal",""},
{"default:steel_ingot", "dye:white", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "portalgun:cplps1",
recipe = {{"default:mese_crystal_fragment","dye:grey","dye:grey"},
{"portalgun:apb","dye:grey","dye:grey"},
{"default:mese_crystal_fragment","dye:grey","dye:grey"},
}
})
minetest.register_craft({
output = "portalgun:sign_numa1 3",
recipe = {{"dye:black","dye:black","dye:white"},
{"portalgun:testblock","dye:black","dye:white"},
{"dye:white","dye:black","dye:white"},
}
})
minetest.register_craft({
output = "portalgun:sign_x 2",
recipe = {{"dye:blue","portalgun:testblock","dye:blue"},
{"default:glass","dye:blue","default:glass"},
{"dye:blue","default:mese_crystal_fragment","dye:blue"},
}
})
minetest.register_craft({
output = "portalgun:warntape 3",
recipe = {{"dye:black","dye:yellow","dye:black"},
{"default:stick","default:stick","default:stick"},
}
})
minetest.register_craft({
output = "portalgun:door_1",
recipe = {{"","portalgun:testblock","portalgun:testblock"},
{"","portalgun:testblock","portalgun:testblock"},
{"default:mese_crystal_fragment","portalgun:testblock","portalgun:testblock"},
}
})
minetest.register_craft({
output = "portalgun:toxwater_1 9",
recipe = {{"default:dirt","default:dirt","default:dirt"},
{"default:dirt","bucket:bucket_lava","default:dirt"},
{"default:dirt","default:dirt","default:dirt"},
}
})
minetest.register_craft({
output = "portalgun:portaltarget_1",
recipe = {{"","portalgun:testblock",""},
{"default:mese_crystal_fragment","dye:blue","default:mese_crystal_fragment"},
}
})
minetest.register_craft({
output = "portalgun:portaltarget_2",
recipe = {{"","portalgun:testblock",""},
{"default:mese_crystal_fragment","dye:orange","default:mese_crystal_fragment"},
}
})
minetest.register_craft({
output = "portalgun:sign2",
recipe = {{"","portalgun:testblock",""},
{"dye:white","dye:black","dye:orange"},
}
})
minetest.register_craft({
output = "portalgun:sign1",
recipe = {{"","portalgun:testblock",""},
{"dye:white","dye:black","dye:blue"},
}
})
minetest.register_craft({
output = "portalgun:planthole",
recipe = {
{"portalgun:testblock", "portalgun:testblock", "portalgun:testblock"},
{"portalgun:testblock", "portalgun:plantform1_1", "portalgun:testblock"},
{"portalgun:testblock", "portalgun:testblock", "portalgun:testblock"}
}
})
minetest.register_craft({
output = "portalgun:delayer",
recipe = {
{"dye:yellow", "default:mese_crystal", "dye:yellow"},
{"default:stone", "portalgun:testblock", "default:stone"},
{"dye:yellow", "default:steel_ingot", "dye:yellow"},
}
})
minetest.register_craft({
output = "portalgun:testblocks 2",
recipe = {
{"portalgun:testblock", "default:mese_crystal"},
}
})
minetest.register_craft({
output = "portalgun:hard_glass",
recipe = {
{"default:glass", "default:glass"},
{"default:glass", "default:glass"},
}
})
minetest.register_craft({
output = "portalgun:apg",
recipe = {
{"default:glass", "dye:white"},
}
})
minetest.register_craft({
output = "portalgun:powerballspawner2",
recipe = {
{"portalgun:powerballspawner", "default:mese_crystal"},
}
})
minetest.register_craft({
output = "portalgun:objdestroyer_1",
recipe = {
{"default:obsidian_glass", "default:obsidian_glass", "portalgun:dmgblock_1"},
{"default:obsidian_glass", "default:obsidian_glass", ""},
}
})
minetest.register_craft({
output = "portalgun:dmgblock_1",
recipe = {
{"default:obsidian_glass", "default:obsidian_glass", "default:mese_crystal"},
{"default:obsidian_glass", "default:obsidian_glass", ""},
}
})
minetest.register_craft({
output = "portalgun:button",
recipe = {
{"", "dye:red", ""},
{"", "portalgun:testblock", ""},
{"", "portalgun:testblock", ""},
}
})
minetest.register_craft({
output = "portalgun:cake",
recipe = {
{"dye:red", "portalgun:testblock", "dye:red"},
{"default:dirt", "default:torch", "default:dirt"},
{"dye:red", "default:dirt", "dye:red"},
}
})
minetest.register_craft({
output = "portalgun:powerdoor1_1",
recipe = {
{"default:obsidian_glass", "default:mese_crystal", "default:obsidian_glass"},
{"default:obsidian_glass", "default:obsidian", "default:obsidian_glass"},
{"default:obsidian_glass", "default:mese_crystal", "default:obsidian_glass"},
}
})
minetest.register_craft({
output = "portalgun:autocheckpoint",
recipe = {
{"default:mese_crystal", "default:mese_crystal","default:mese_crystal"},
}
})
minetest.register_craft({
output = "portalgun:testblock 3",
recipe = {
{"default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "dye:white"},
}
})
minetest.register_craft({
output = "portalgun:apb",
recipe = {
{"default:stonebrick", "dye:white"},
}
})
minetest.register_craft({
output = "portalgun:secam_off",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"dye:black", "default:glass", "dye:black"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "portalgun:powerballspawner",
recipe = {
{"default:steel_ingot", "", "default:steel_ingot"},
{"dye:yellow", "default:mese_crystal", "dye:yellow"},
{"default:steel_ingot", "", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "portalgun:powerballtarget",
recipe = {
{"portalgun:powerballspawner"},
}
})
minetest.register_craft({output = "portalgun:wscspawner2",
recipe = {{"portalgun:wscspawner1"}}})
minetest.register_craft({output = "portalgun:wscspawner3",
recipe = {{"portalgun:wscspawner2"}}})
minetest.register_craft({output = "portalgun:wscspawner4",
recipe = {{"portalgun:wscspawner3"}}})
minetest.register_craft({output = "portalgun:wscspawner1",
recipe = {{"portalgun:wscspawner4"}}})
minetest.register_craft({
output = "portalgun:wscspawner1",
recipe = {
{"", "default:steel_ingot", ""},
{"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"},
{"", "default:steel_ingot", ""},}})
minetest.register_craft({output = "portalgun:wscspawner2_2",
recipe = {{"portalgun:wscspawner2_1"}}})
minetest.register_craft({output = "portalgun:wscspawner2_3",
recipe = {{"portalgun:wscspawner2_2"}}})
minetest.register_craft({output = "portalgun:wscspawner2_4",
recipe = {{"portalgun:wscspawner2_3"}}})
minetest.register_craft({output = "portalgun:wscspawner2_1",
recipe = {{"portalgun:wscspawner2_4"}}})
minetest.register_craft({
output = "portalgun:wscspawner2_1",
recipe = {
{"", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},}})
minetest.register_craft({
output = "portalgun:plantform1_1",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},}})
minetest.register_craft({output = "portalgun:plantform1_2",
recipe = {{"portalgun:plantform1_1"}}})
minetest.register_craft({output = "portalgun:plantform1_3",
recipe = {{"portalgun:plantform1_2"}}})
minetest.register_craft({output = "portalgun:plantform1_4",
recipe = {{"portalgun:plantform1_3"}}})
minetest.register_craft({output = "portalgun:plantform_nu1",
recipe = {{"portalgun:plantform1_4"}}})
minetest.register_craft({output = "portalgun:plantform1_1",
recipe = {{"portalgun:plantform_nu1"}}})
minetest.register_craft({
output = "portalgun:gun",
recipe = {
{"", "default:diamond", ""},
{"default:diamond", "default:mese", "default:mese"},
{"", "default:steel_ingot", "default:steel_ingot"},
},
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 KiB

@ -42,7 +42,7 @@ minetest.register_entity("portalgun:power",{
spritediv = {x=1, y=1},
is_visible = true,
makes_footstep_sound = false,
automatic_rotate = false,
automatic_rotate = 0,
timer=0,
time=0.1,
portalgun_power=1,
@ -62,7 +62,6 @@ on_punch=function(self, puncher, time_from_last_punch, tool_capabilities, dir)
if self.target and self.target:get_attach() then
self.target:set_detach()
self.target:set_hp(0)
self.target:punch(self.object, {full_punch_interval=1.0,damage_groups={fleshy=4}}, "default:bronze_pick", nil)
end
end,
@ -72,7 +71,6 @@ on_step= function(self, dtime)
self.timer=0
if self.target==nil or (not self.target:get_attach()) then
self.object:set_hp(0)
self.object:punch(self.object, {full_punch_interval=1.0,damage_groups={fleshy=4}}, "default:bronze_pick", nil)
if self.sound then minetest.sound_stop(self.sound) end
end
if self.player then
@ -106,7 +104,7 @@ minetest.register_entity("portalgun:power2",{
spritediv = {x=1, y=1},
is_visible = true,
makes_footstep_sound = false,
automatic_rotate = false,
automatic_rotate = 0,
timer=0,
time=0.025,
portalgun_power=1,
@ -152,7 +150,6 @@ on_step= function(self, dtime)
if self.target==nil or (not self.target:get_attach()) then
self.object:set_hp(0)
self.object:punch(self.object, {full_punch_interval=1.0,damage_groups={fleshy=4}}, "default:bronze_pick", nil)
return self
end
return self

222
init.lua

@ -4,7 +4,6 @@ proportal_group_only = false
portalgun={new=0,checkpoints={}}
dofile(minetest.get_modpath("portalgun") .. "/gravityuse.lua") -- the gravity part of portalgun
dofile(minetest.get_modpath("portalgun") .. "/craft.lua")
dofile(minetest.get_modpath("portalgun") .. "/stuff.lua") -- security cam
if disable_portal_stuff==false and minetest.get_modpath("mesecons")~=nil then
dofile(minetest.get_modpath("portalgun") .. "/weightedstoragecube.lua") -- weighted storage cube
@ -58,7 +57,6 @@ function portal_delete(name,n) -- using set_hp & :punch instand of :remove ... n
end
portalgun_portal[name].portal1_active=false
portalgun_portal[name].portal1:set_hp(0)
portalgun_portal[name].portal1:punch(portalgun_portal[name].portal1, {full_punch_interval=1.0,damage_groups={fleshy=9000}}, "default:bronze_pick", nil)
end
if (n==2 or n==0) and portalgun_portal[name].portal2~=nil then
if n==0 then
@ -67,7 +65,6 @@ function portal_delete(name,n) -- using set_hp & :punch instand of :remove ... n
end
portalgun_portal[name].portal2_active=false
portalgun_portal[name].portal2:set_hp(0)
portalgun_portal[name].portal2:punch(portalgun_portal[name].portal2, {full_punch_interval=1.0,damage_groups={fleshy=9000}}, "default:bronze_pick", nil)
end
if n==0 then portalgun_portal[name]=nil end
end
@ -340,157 +337,85 @@ on_activate= function(self, staticdata)
end,
on_step=portalgun_on_step,
})
minetest.register_node("portalgun:gun1", {
description = "Portalgun (blue)",
range = 5,
tiles={"portalgun_gun1.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.3, -0.5, -0.3, 0.3, -0.1,0.3},
}
},
drawtype="mesh",
mesh="portalgun_gun_wearing.obj",
groups = {not_in_creative_inventory=1},
sunlight_propagates = true,
paramtype="light",
paramtype2="facedir",
on_place=function(itemstack, user, pointed_thing)
portalgun_mode(itemstack, user, pointed_thing)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
portalgun_onuse(itemstack, user, pointed_thing)
return itemstack
end
})
minetest.register_node("portalgun:gun2", {
description = "Portalgun (orange)",
range = 5,
tiles={"portalgun_gun2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.3, -0.5, -0.3, 0.3, -0.1,0.3},
}
},
drawtype="mesh",
mesh="portalgun_gun_wearing.obj",
groups = {not_in_creative_inventory=1},
sunlight_propagates = true,
paramtype="light",
paramtype2="facedir",
on_place=function(itemstack, user, pointed_thing)
portalgun_mode(itemstack, user, pointed_thing)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
portalgun_onuse(itemstack, user, pointed_thing)
return itemstack
end
})
minetest.register_node("portalgun:gun", {
minetest.register_craftitem("portalgun:gun", {
description = "Portalgun",
range = 5,
tiles={"portalgun_gun0.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.3, -0.5, -0.3, 0.3, -0.1,0.3},
}
range = 100,
inventory_image = "portalgun_gun0_rndr.png",
wield_image = "portalgun_gun0_rndr.png",
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 3,
groupcaps = {
fleshy = {times={[2]=0.80, [3]=0.40}, uses=100, maxlevel=3},
oddly_breakable_by_hand = {times={[1]=1}, uses=100, maxlevel=1},
},
drawtype="mesh",
mesh="portalgun_gun_wearing.obj",
sunlight_propagates = true,
paramtype="light",
paramtype2="facedir",
on_place=function(itemstack, user, pointed_thing)
portalgun_mode(itemstack, user, pointed_thing)
damage_groups = {fleshy=1},
},
on_place=function(itemstack, user, pointed_thing)
portalgun_setmode(itemstack, user, pointed_thing, 2)
portalgun_onuse(itemstack, user, pointed_thing)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
portalgun_setmode(itemstack, user, pointed_thing, 1)
portalgun_onuse(itemstack, user, pointed_thing)
return itemstack
end
})
minetest.register_craftitem("portalgun:gun1", {
description = "Portalgun (blue)",
range = 100,
groups = {not_in_creative_inventory=1},
inventory_image = "portalgun_gun1_rndr.png",
wield_image = "portalgun_gun1_rndr.png",
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 3,
groupcaps = {
fleshy = {times={[2]=0.80, [3]=0.40}, uses=100, maxlevel=3},
oddly_breakable_by_hand = {times={[1]=1}, uses=100, maxlevel=1},
},
damage_groups = {fleshy=1},
},
on_place=function(itemstack, user, pointed_thing)
portalgun_setmode(itemstack, user, pointed_thing, 2)
portalgun_onuse(itemstack, user, pointed_thing)
return itemstack
end,
on_use = function(itemstack, user, pointed_thing)
portalgun_setmode(itemstack, user, pointed_thing, 1)
portalgun_onuse(itemstack, user, pointed_thing)
return itemstack
end
})
minetest.register_node("portalgun:gun1_placed", {
description = "Portalgun (blue)",
range = 5,
tiles={"portalgun_gun1.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.3, -0.5, -0.3, 0.3, -0.1,0.3},
}
},
drawtype="mesh",
mesh="portalgun_gun.obj",
sunlight_propagates = true,
paramtype="light",
paramtype2="facedir",
visual_scale=0.4,
groups = {not_in_creative_inventory=1,dig_immediate = 3},
on_use = function(itemstack, user, pointed_thing)
portalgun_onuse(itemstack, user, pointed_thing)
return itemstack
end
})
minetest.register_node("portalgun:gun2_placed", {
minetest.register_craftitem("portalgun:gun2", {
description = "Portalgun (orange)",
range = 5,
tiles={"portalgun_gun2.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.3, -0.5, -0.3, 0.3, -0.1,0.3},
}
range = 100,
inventory_image = "portalgun_gun2_rndr.png",
wield_image = "portalgun_gun2_rndr.png",
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level = 3,
groupcaps = {
fleshy = {times={[2]=0.80, [3]=0.40}, uses=100, maxlevel=3},
oddly_breakable_by_hand = {times={[1]=1}, uses=100, maxlevel=1},
},
drawtype="mesh",
mesh="portalgun_gun.obj",
sunlight_propagates = true,
paramtype="light",
paramtype2="facedir",
visual_scale=0.4,
groups = {not_in_creative_inventory=1,dig_immediate = 3},
on_use = function(itemstack, user, pointed_thing)
damage_groups = {fleshy=1},
},
groups = {not_in_creative_inventory=1},
on_place=function(itemstack, user, pointed_thing)
portalgun_setmode(itemstack, user, pointed_thing, 2)
portalgun_onuse(itemstack, user, pointed_thing)
return itemstack
end
})
minetest.register_node("portalgun:gun_placed", {
description = "Portalgun",
range = 5,
tiles={"portalgun_gun0.png"},
selection_box = {
type = "fixed",
fixed = {
{-0.3, -0.5, -0.3, 0.3, -0.1,0.3},
}
},
drawtype="mesh",
mesh="portalgun_gun.obj",
sunlight_propagates = true,
paramtype="light",
paramtype2="facedir",
visual_scale=0.4,
groups = {not_in_creative_inventory=1,dig_immediate = 3},
on_use = function(itemstack, user, pointed_thing)
end,
on_use = function(itemstack, user, pointed_thing)
portalgun_setmode(itemstack, user, pointed_thing, 1)
portalgun_onuse(itemstack, user, pointed_thing)
return itemstack
end
end
})
function portalgun_mode(itemstack, user, pointed_thing) -- change modes
local item=itemstack:to_table()
local meta=minetest.deserialize(item["metadata"])
@ -516,6 +441,23 @@ function portalgun_mode(itemstack, user, pointed_thing) -- change modes
minetest.sound_play("portalgun_mode", {pos=user:get_pos(),max_hear_distance = 5, gain = 1})
end
function portalgun_setmode(itemstack, user, pointed_thing, mode) -- change modes
local item=itemstack:to_table()
local meta=minetest.deserialize(item["metadata"])
if meta==nil then
meta={}
mode=1
minetest.chat_send_player(user:get_player_name(), "<Portalgun> PLACE to change portal mode (or LEFT+RIGHTCLICK to use the other)")
minetest.chat_send_player(user:get_player_name(), "<Portalgun> LEFTCLICK on an object to carry it, CLICK AGAIN to release")
minetest.chat_send_player(user:get_player_name(), "<Portalgun> SHIFT+LEFTCLICK to close both portals (or wait 40sec until it removes it self)")
end
if meta.mode==nil then meta.mode=2 end
meta.mode=mode
item.name="portalgun:gun"..mode
item.metadata=minetest.serialize(meta)
itemstack:replace(item)
minetest.sound_play("portalgun_mode", {pos=user:get_pos(),max_hear_distance = 5, gain = 1})
end
local function rnd(r)
return math.floor(r+ 0.5)
@ -558,12 +500,6 @@ function portalgun_onuse(itemstack, user, pointed_thing) -- using the gun
portalgun_portal[name]={lifelime=portalgun_lifelime,project=1,timer=0,portal1_active=false,portal2_active=false,portal1_use=0,portal2_use=0}
end
if key.RMB and mode==2 then -- hold rmbutton to use the other one (like diplazer)
mode=1
elseif key.RMB and mode==1 then
mode=2
end
if key.sneak then
portal_delete(name,0)
return itemstack

@ -1,4 +1,2 @@
name = portalgun
description = Portals and stuff
depends = default
optional_depends = mesecons

BIN
models/prtl_0.blend Normal file

Binary file not shown.

BIN
models/prtl_0.blend1 Normal file

Binary file not shown.

@ -470,7 +470,6 @@ minetest.register_node("portalgun:door_1", {
description = "Mesecon Door",
drop="portalgun:door_1",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
@ -512,7 +511,6 @@ minetest.register_node("portalgun:door_2", {
description = "Door 2-1",
drawtype = "nodebox",
drop="portalgun:door_1",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
@ -544,7 +542,6 @@ minetest.register_node("portalgun:door_open_1", {
description = "Door (open) 2-o-1",
drop="portalgun:door_1",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
@ -575,7 +572,6 @@ minetest.register_node("portalgun:door_open_2", {
description = "Door (open) 2-o-1",
drawtype = "nodebox",
drop="portalgun:door_1",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {

@ -66,7 +66,7 @@ minetest.register_entity("portalgun:powerball",{
initial_sprite_basepos = {x=0, y=0},
is_visible = true,
makes_footstep_sound = false,
automatic_rotate = false,
automatic_rotate = 0,
portalgun=2,
powerball=1,
on_activate= function(self, staticdata)
@ -87,8 +87,6 @@ on_step= function(self, dtime)
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 2)) do
if ob:is_player() or (ob:get_luaentity() and ob:get_luaentity().portalgun~=1 and ob:get_luaentity().wsc==nil and ob:get_luaentity().powerball~=1) then
ob:set_hp(0)
ob:punch(ob, {full_punch_interval=1.0,damage_groups={fleshy=9000}}, "default:bronze_pick", nil)
end
end
self.timer2=self.timer2+1
@ -101,7 +99,6 @@ on_step= function(self, dtime)
if self.timer2>40 then
minetest.sound_stop(self.sound)
self.object:set_hp(0)
self.object:punch(self.object, {full_punch_interval=1.0,damage_groups={fleshy=9000}}, "default:bronze_pick", nil)
return self
end
local v=self.object:get_velocity()

@ -231,7 +231,6 @@ minetest.register_node("portalgun:toxwater_1", {
description = "Toxic water",
drawtype = "liquid",
tiles = {"portalgun_toxwat.png"},
post_effect_color = {a = 200, r = 119, g = 70, b = 16},
alpha = 190,
paramtype = "light",
walkable = false,
@ -256,7 +255,6 @@ minetest.register_node("portalgun:toxwater_1", {
minetest.register_node("portalgun:toxwater_2", {
description = "Toxic water 2",
drawtype = "flowingliquid",
tiles = {"portalgun_toxwat.png"},
tiles = {name = "portalgun_toxwat.png",backface_culling=false},
special_tiles = {{name = "portalgun_toxwat.png",backface_culling=true},{name = "portalgun_toxwat.png",backface_culling=false}},
alpha = 190,
@ -301,7 +299,6 @@ on_use = function(itemstack, user, pointed_thing)
for ii, ob in pairs(minetest.get_objects_inside_radius(pos, 7)) do
if ob:get_luaentity() then
ob:set_hp(0)
ob:punch(ob, {full_punch_interval=1.0,damage_groups={fleshy=9000}}, "default:bronze_pick", nil)
end
end
return itemstack
@ -506,9 +503,12 @@ on_step= function(self, dtime)
return
end
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 1.5)) do
if ob:is_player() or (ob:get_luaentity() and ob:get_luaentity().bullet~=1) then
ob:set_hp(ob:get_hp()-7)
ob:punch(self.object, 1,{full_punch_interval=1.0,damage_groups={fleshy=4}}, "default:bronze_pick", nil)
if ob:is_player() then
if ob:get_hp() > 2 then
ob:set_hp(ob:get_hp()-2)
else
ob:set_hp(0)
end
self.object:remove()
return
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

@ -28,11 +28,10 @@ minetest.register_node("portalgun:wscspawner2_" .. ii, {
description = "Weighted storage cube spawner2 " ..ptgwsc[ii][3],
tiles = {"default_steel_block.png","default_steel_block.png","default_steel_block.png","default_steel_block.png","default_steel_block.png",ptgwsc[ii][1]},
groups = {cracky=2,mesecon_receptor_off = 1, mesecon_effector_off = 1},
mesecons = {receptor = {state = "off"}},
sounds = default.node_sound_glass_defaults(),
is_ground_content = false,
paramtype2 = "facedir",
mesecons = {effector = {
mesecons = {receptor = {state = "off"}, effector = {
action_on = function (pos, node)
local dir=minetest.get_node(pos).param2
local v={x=0, y=0, z=0}
@ -62,7 +61,7 @@ minetest.register_entity("portalgun:wsc" ..ii,{
initial_sprite_basepos = {x=0, y=0},
is_visible = true,
makes_footstep_sound = true,
automatic_rotate = false,
automatic_rotate = 0,
portalgun=2,
wsc=ii,
on_activate= function(self, staticdata)
@ -78,7 +77,7 @@ on_step= function(self, dtime)
self.timer=0
self.object:set_acceleration({x=0, y=-10, z=0})
self.timer2=self.timer2+1
if self.timer2>10 then
if self.timer2>4 then
self.timer2=0
for i, ob in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 20)) do
if ob:is_player() then
@ -86,7 +85,6 @@ on_step= function(self, dtime)
end
end
self.object:set_hp(0)
self.object:punch(self.object, 1, "default:bronze_pick", nil)
end
end,
timer=0,
@ -333,7 +331,6 @@ minetest.register_node("portalgun:objdestroyer_1", {
for i, ob in pairs(minetest.get_objects_inside_radius(pos, 5)) do
if ob:get_luaentity() then
ob:set_hp(0)
ob:punch(ob, {full_punch_interval=1.0,damage_groups={fleshy=9000}}, "default:bronze_pick", nil)
end
end
end