Snowballs are now throwable, and added extender electricity component

This commit is contained in:
IamPyu 2024-12-17 17:46:54 -06:00
parent 0df6e9a1ff
commit a6286169b3
9 changed files with 71 additions and 24 deletions

View File

@ -23,6 +23,7 @@ Notable Game Changes:
- Dispenser
- Note Block
- Delayer
- Extender
- Re-added sprinting!
- Added Magic Wands
- Added Golden Apples and Spellbooks of Healing
@ -70,6 +71,7 @@ Other Game Changes:
- New Heater Device recipe
- Added Sofas
- Removed Spellbooks of Fire
- Snowballs are now throwable
Code Changes:

View File

@ -9,7 +9,7 @@ mobs:register_arrow("pyutest_mobs:arrow_snowball", {
visual_size = { x = 1, y = 1 },
textures = { "pyutest-snowball.png" },
hit_node = function(self, pos)
PyuTest.create_explosion(pos, 1, false, 9, { self.object })
-- PyuTest.create_explosion(pos, 1, false, 9, { self.object })
end,
hit_player = snowball_hit_player,
hit_mob = snowball_hit_player,
@ -75,15 +75,3 @@ mobs:register_mob("pyutest_mobs:snowman", {
PyuTest.create_boss_egg("pyutest_mobs:snowman", "Snowman Spawn Egg",
"pyutest-egg.png^[multiply:skyblue", 0, nil,
"pyutest_blocks:snow_block")
mobs:spawn({
name = "pyutest_mobs:snowman",
nodes = { "group:ground", "group:ice" },
interval = 3,
chance = 4,
active_object_count = 3,
min_light = 0,
max_light = 15,
max_height = PyuTest.IceWorld.y_max,
min_height = PyuTest.IceWorld.y_min
})

View File

@ -1,17 +1,13 @@
local modpath = core.get_modpath(core.get_current_modname())
dofile(modpath .. "/api.lua")
dofile(modpath .. "/projectiles/snowball.lua")
PyuTest.make_projectile("pyutest_projectiles:fireball", {
visual = "sprite",
visual_size = {x = 1.4, y = 1.4},
textures = {
"pyutest-fireball.png",
"pyutest-fireball.png",
"pyutest-fireball.png",
"pyutest-fireball.png",
"pyutest-fireball.png",
"pyutest-fireball.png",
}
}, {
_slowdown = false
@ -30,10 +26,6 @@ PyuTest.make_projectile("pyutest_projectiles:arrow", {
textures = {
"pyutest-arrow.png",
"pyutest-arrow.png",
"pyutest-arrow.png",
"pyutest-arrow.png",
"pyutest-arrow.png",
"pyutest-arrow.png",
}
}, {
_slowdown = false

View File

@ -0,0 +1,39 @@
local function do_particles(pos)
local vel = 0.5
core.add_particlespawner({
amount = math.random(5, 10),
time = 0.8,
exptime = 0.3,
vertical = true,
glow = core.LIGHT_MAX,
-- collisiondetection = true,
texture = "pyutest-snowball-particle.png",
pos = pos,
vel = {
min = vector.new(-vel, -vel, -vel),
max = vector.new(vel, vel, vel),
},
-- minvel = vector.new(-vel, -vel, -vel),
-- maxvel = vector.new(vel, vel, vel),
})
end
PyuTest.make_projectile("pyutest_projectiles:snowball", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {
"pyutest-snowball.png",
}
}, {
_slowdown = false,
}, {
on_hit_node = function (self, pos, node)
do_particles(pos + vector.new(0, 1, 0))
end,
on_hit_object = function (self, object)
do_particles(self.object:get_pos())
PyuTest.deal_damage(object, 1, PyuTest.DAMAGE_TYPES.shot("Snowball"))
end
})

View File

@ -57,3 +57,11 @@ core.register_craft({
},
type = "shapeless"
})
core.register_craft({
output = "pyutest_tools:snowball 5",
recipe = {
"pyutest_blocks:snow"
},
type = "shapeless"
})

View File

@ -0,0 +1,11 @@
local function after_place_node(pos)
PyuTest.component_after_place_node(pos)
end
PyuTest.make_electricity_device("pyutest_electricity:extender", "Extender", {
cracky = PyuTest.BLOCK_NORMAL
}, {"pyutest-delayer.png"}, nil, {
after_place_node = after_place_node,
}, function (pos, node, sender_pos, sender)
PyuTest.component_action(pos, sender)
end)

View File

@ -1,6 +1,6 @@
local modpath = core.get_modpath(core.get_current_modname())
PyuTest.make_item("pyutest_magic:magic_shards", "Magic Shards", {}, "pyutest-magic-shards.png")
PyuTest.make_item("pyutest_magic:magic_shards", "Enchanted Fragments", {}, "pyutest-magic-shards.png")
PyuTest.make_item("pyutest_magic:enchanted_shard", "Enchanted Shard", {}, "pyutest-shard.png", {
color = "indigo",

View File

@ -40,6 +40,13 @@ PyuTest.make_item("pyutest_tools:glass_bottle", "Glass Bottle", {}, "pyutest-gla
stack_max = 16
})
PyuTest.make_item("pyutest_tools:brick", "Brick", {}, "pyutest-brick.png")
PyuTest.make_item("pyutest_tools:snowball", "Snowball", {}, "pyutest-snowball.png")
PyuTest.make_item("pyutest_tools:snowball", "Snowball", {}, "pyutest-snowball.png", {
on_use = function (itemstack, user, pointed_thing)
if user == nil then return end
PyuTest.shoot_projectile_from_object("pyutest_projectiles:snowball", user)
itemstack:take_item()
return itemstack
end
})
PyuTest.make_item("pyutest_tools:flint", "Flint", {}, "pyutest-flint.png")
PyuTest.make_item("pyutest_tools:paper", "Paper", {}, "pyutest-paper.png")

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B