Changes to pipe bombs, cops, and node groups

This commit is contained in:
Functioning Member of Society 2022-11-22 15:32:50 -05:00
parent ba2da987ad
commit 71d289d98e
10 changed files with 56 additions and 88 deletions

View File

@ -1,6 +1,13 @@
cops = {}
cops.copsSpawned = 0
-- Pig spawner
minetest.register_node("cops:pig_spawner", {
walkable = false;
drawtype = "glasslike",
paramtype = "light",
is_ground_content = false,
sunlight_propagates = true,
--[[on_timer = function(pos)
minetest.add_entity(pos, "cops:cop_regular_female")
return true
@ -11,7 +18,7 @@ minetest.register_node("cops:pig_spawner", {
end,]]
})
--[[
minetest.register_abm({
nodenames = {"cops:pig_spawner"},
interval = 30,
@ -29,26 +36,28 @@ minetest.register_abm({
elseif i == 2 then
minetest.add_entity(pos, "cops:cop_armedthug")
end
end})
end})]]
minetest.register_abm({
nodenames = {"main:bricks_stone"},
interval = 40,
chance = 50,
chance = 140,
action = function(pos, node, active_object_count, active_object_count_wider)
if cops.copsSpawned < 20 then
newPos = {x = pos.x, y = pos.y + 2, z = pos.z}
local i = math.random(0, 2)
if i == 0 then
local i = math.random(0, 7)
if i < 2 then
minetest.add_entity(newPos, "cops:cop_regular_female")
elseif i == 1 then
elseif i < 6 then
minetest.add_entity(newPos, "cops:cop_regular_male")
elseif i == 2 then
elseif i == 7 then
minetest.add_entity(newPos, "cops:cop_armedthug")
end
cops.copsSpawned = cops.copsSpawned + 1
end
end})
-- Cops
@ -79,7 +88,7 @@ mobs:register_mob("cops:cop_regular_female", {
{
random = "female_noise",
},
on_die = onCopDie,
walk_velocity = 2,
run_velocity = 8,
jump_height = 1,
@ -136,7 +145,7 @@ mobs:register_mob("cops:cop_regular_male", {
{
random = "male_noise",
},
on_die = onCopDie,
walk_velocity = 2,
run_velocity = 8,
jump_height = 1,
@ -193,7 +202,7 @@ mobs:register_mob("cops:cop_armedthug", {
{
random = "male_noise",
},
on_die = onCopDie,
walk_velocity = 2,
run_velocity = 8,
jump_height = 1,
@ -221,3 +230,7 @@ mobs:register_mob("cops:cop_armedthug", {
punch_end = 219
},
})
onCopDie = function()
cops.copsSpawned = cops.copsSpawned - 1
end

View File

@ -32,7 +32,7 @@ elevator.elevator_recipe = {
elevator.tiles_elevator = {
"elevator_front.png",
"elevator_panel.png",
"elevator_outside.png",
"elevator_front.png",
"elevator_ceiling.png",
"elevator_floor.png",
"main_block_iron.png"

View File

@ -148,12 +148,12 @@ local function calc_velocity(pos1, pos2, old_vel, power)
end
local function entity_physics(pos, radius, drops)
local objs = minetest.get_objects_inside_radius(pos, radius)
local objs = minetest.get_objects_inside_radius(pos, radius * 3)
for _, obj in pairs(objs) do
local obj_pos = obj:get_pos()
local dist = math.max(1, vector.distance(pos, obj_pos))
local damage = (4 / dist) * radius
local damage = (4 / dist) * radius * 8
if obj:is_player() then
local dir = vector.normalize(vector.subtract(obj_pos, pos))
local moveoff = vector.multiply(dir, 2 / dist * radius)

View File

@ -9,64 +9,7 @@ local playerWhoThrewObject = minetest.get_player_by_name("singleplayer")
minetest.register_craftitem('more_fire:pipebomb', {
description = 'Pipe Bomb',
inventory_image = 'more_fire_pipebomb.png',
on_place = function(itemstack, user, pointed_thing)
itemstack:take_item()
minetest.sound_play('more_fire_shatter', {gain = 1.0})
--smoke particles
minetest.add_particlespawner({
amount = 400,
time = 0.1,
minpos = pointed_thing.above,
maxpos = pointed_thing.above,
minvel = {x=2, y=0.2, z=2},
maxvel = {x=-2, y=0.5, z=-2},
minacc = {x=0, y=-6, z=0},
maxacc = {x=0, y=-10, z=0},
minexptime = 5,
maxexptime = 2,
minsize = 5,
maxsize = 20,
collisiondetection = true,
texture = 'more_fire_smoke.png'})
--more smoke particles
minetest.add_particlespawner({
amount = 600,
time = 1,
minpos = pointed_thing.above,
maxpos = pointed_thing.above,
minvel = {x=10, y= 3, z=10},
maxvel = {x=-10, y= 3, z=-10},
minacc = {x=2, y=2, z=2},
maxacc = {x=-2, y=1, z=-2},
minexptime = 2,
maxexptime = 3,
minsize = 2,
maxsize = 20,
collisiondetection = true,
texture = 'more_fire_smoke.png'})
--even more smoke particles
minetest.add_particlespawner({
amount = 400,
time = 1,
minpos = pointed_thing.above,
maxpos = pointed_thing.above,
minvel = {x=0.2, y=0.2, z=0.2},
maxvel = {x=-0.2, y=0.5, z=-0.2},
minacc = {x=10, y= 2, z=10},
maxacc = {x=-10, y= 1, z=-10},
minexptime = 2,
maxexptime = 3,
minsize = 20,
maxsize = 2,
collisiondetection = true,
texture = 'more_fire_smoke.png'})
local dir = Vec3(user:get_look_dir()) *20
minetest.add_particle(
{x=user:getpos().x, y=user:getpos().y+1.5, z=user:getpos().z}, {x=dir.x, y=dir.y, z=dir.z}, {x=0, y=-10, z=0}, 0.2,
6, false, 'more_fire_smokebomb.png')
return itemstack
end,
})
local function throw_pipebomb(item, player)
@ -130,13 +73,13 @@ MORE_FIRE_PIPEBOMB_ENTITY.on_step = function(self, dtime)
self.timer = self.timer + dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer > 0.01 then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
if self.timer > 0.005 then
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= 'more_fire:pipebomb_entity' and obj:get_luaentity().name ~= '__builtin:item' then
if self.node ~= '' then
explosives.boom(pos, {})
explosives.boom(pos, {radius = 5})
local damage = 1
obj:punch(self.object, 1.0, {
full_punch_interval=1.0,
@ -147,7 +90,7 @@ MORE_FIRE_PIPEBOMB_ENTITY.on_step = function(self, dtime)
end
end
end
if self.lastpos.x ~= nil then
if node.name ~= 'air' then
self.object:remove()
@ -172,7 +115,7 @@ MORE_FIRE_PIPEBOMB_ENTITY.on_step = function(self, dtime)
})
end
end
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
end
end

View File

@ -4,7 +4,7 @@
minetest.register_node(":streets:asphalt",{
description = streets.S("Asphalt"),
tiles = {"streets_asphalt.png"},
groups = {cracky=3}
groups = {cracky=1}
})
if minetest.get_modpath("building_blocks") then

View File

@ -32,27 +32,38 @@ end
minetest.register_on_joinplayer(function(player)
player:set_physics_override({speed = 2.5, jump = 1, gravity = 1.2})
minetest.show_formspec(player:get_player_name(), "story:story_formspec", table.concat(getStoryFormspec(0), "\n"))
music = minetest.sound_play("4K", {
gain = 0,
pitch = 1.2,
pitch = 1,
loop = true,
})
minetest.sound_fade(music, .1, 1)
player:get_inventory():add_item("main", "more_fire:pipebomb 48")
player:get_inventory():add_item("main", "more_fire:molotov 48")
player:get_inventory():add_item("main", "more_fire:molotov_cocktail 48")
minetest.setting_set("time_speed", 0)
minetest.set_timeofday(.06)
minetest.set_timeofday(.21)
end)
minetest.register_on_newplayer(function(ObjectRef)
minetest.place_schematic({x = 0, y = -1, z = 0}, minetest.get_modpath("story") .. "/schems/citymap-v2.mts", "0", nil, true)
minetest.after(4, function() minetest.fix_light({x = 20, y = 129, z = 191}, {x = 236, y = 12, z = 6}) end)
ObjectRef:set_pos({x = 180, y = 42, z = 145})
end)
minetest.register_on_respawnplayer(function(ObjectRef)
minetest.after(.1, function()
ObjectRef:set_pos({x = 180, y = 42, z = 145})
end)
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "story:story_formspec" then
return
@ -76,7 +87,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
minetest.request_shutdown("The game has crashed due to the citizen's neglience.\n This incident will be reported.")
elseif fields.quit then
minetest.after(0.2, function() minetest.show_formspec(player:get_player_name(), "story:story_formspec", table.concat(getStoryFormspec(currentPage), "\n")) end)
minetest.after(.2, function() minetest.show_formspec(player:get_player_name(), "story:story_formspec", table.concat(getStoryFormspec(currentPage), "\n")) end)
end
end
end)

View File

@ -154,6 +154,7 @@ minetest.register_node("main:glass",
tiles = {"main_glass_frame.png", "main_glass.png"},
inventory_image = minetest.inventorycube("main_glass_frame.png"),
paramtype = "light",
drop = "",
sunlight_propagates = true,
is_ground_content = false,
groups = {cracky = 4, oddly_breakable_by_hand = 1},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 487 B

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 B

After

Width:  |  Height:  |  Size: 295 B