2022-11-22 15:32:50 -05:00
|
|
|
cops = {}
|
|
|
|
cops.copsSpawned = 0
|
|
|
|
|
2022-11-21 16:12:22 -05:00
|
|
|
-- Pig spawner
|
|
|
|
minetest.register_node("cops:pig_spawner", {
|
|
|
|
walkable = false;
|
2022-11-22 15:32:50 -05:00
|
|
|
drawtype = "glasslike",
|
|
|
|
paramtype = "light",
|
|
|
|
is_ground_content = false,
|
|
|
|
sunlight_propagates = true,
|
2022-11-21 16:12:22 -05:00
|
|
|
--[[on_timer = function(pos)
|
|
|
|
minetest.add_entity(pos, "cops:cop_regular_female")
|
|
|
|
return true
|
|
|
|
end,
|
|
|
|
|
|
|
|
on_construct = function(pos)
|
|
|
|
minetest.get_node_timer(pos):start(20)
|
|
|
|
end,]]
|
|
|
|
})
|
|
|
|
|
2022-11-22 15:32:50 -05:00
|
|
|
--[[
|
2022-11-21 16:12:22 -05:00
|
|
|
minetest.register_abm({
|
|
|
|
nodenames = {"cops:pig_spawner"},
|
2022-11-22 01:20:16 -05:00
|
|
|
interval = 30,
|
|
|
|
chance = 5,
|
2022-11-21 16:12:22 -05:00
|
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
2022-11-22 01:20:16 -05:00
|
|
|
local i = math.random(0, 2)
|
|
|
|
if i == 0 then
|
|
|
|
minetest.add_entity(pos, "cops:cop_regular_female")
|
|
|
|
|
|
|
|
|
|
|
|
elseif i == 1 then
|
|
|
|
minetest.add_entity(pos, "cops:cop_regular_male")
|
|
|
|
|
|
|
|
|
|
|
|
elseif i == 2 then
|
|
|
|
minetest.add_entity(pos, "cops:cop_armedthug")
|
|
|
|
end
|
2022-11-22 15:32:50 -05:00
|
|
|
end})]]
|
2022-11-22 01:20:16 -05:00
|
|
|
|
|
|
|
minetest.register_abm({
|
|
|
|
nodenames = {"main:bricks_stone"},
|
|
|
|
interval = 40,
|
2022-11-22 15:32:50 -05:00
|
|
|
chance = 140,
|
2022-11-22 01:20:16 -05:00
|
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
2022-11-22 15:32:50 -05:00
|
|
|
if cops.copsSpawned < 20 then
|
|
|
|
newPos = {x = pos.x, y = pos.y + 2, z = pos.z}
|
|
|
|
local i = math.random(0, 7)
|
|
|
|
if i < 2 then
|
|
|
|
minetest.add_entity(newPos, "cops:cop_regular_female")
|
2022-11-22 01:20:16 -05:00
|
|
|
|
2022-11-22 15:32:50 -05:00
|
|
|
elseif i < 6 then
|
|
|
|
minetest.add_entity(newPos, "cops:cop_regular_male")
|
2022-11-22 01:20:16 -05:00
|
|
|
|
2022-11-22 15:32:50 -05:00
|
|
|
elseif i == 7 then
|
|
|
|
minetest.add_entity(newPos, "cops:cop_armedthug")
|
|
|
|
end
|
|
|
|
|
|
|
|
cops.copsSpawned = cops.copsSpawned + 1
|
2022-11-22 01:20:16 -05:00
|
|
|
end
|
2022-11-21 20:43:08 -05:00
|
|
|
end})
|
2022-11-21 16:12:22 -05:00
|
|
|
|
|
|
|
-- Cops
|
|
|
|
mobs:register_mob("cops:cop_regular_female", {
|
|
|
|
type = "monster",
|
|
|
|
passive = false,
|
|
|
|
attack_type = "dogfight",
|
|
|
|
pathfinding = true,
|
|
|
|
reach = 2,
|
|
|
|
damage = 3,
|
|
|
|
hp_min = 16,
|
|
|
|
hp_max = 25,
|
|
|
|
armor = 100,
|
|
|
|
collisionbox =
|
|
|
|
{
|
|
|
|
-.4, 0, -.4, .4, 2, .4
|
|
|
|
},
|
|
|
|
pushable = true,
|
|
|
|
visual = "mesh",
|
|
|
|
mesh = "character.b3d",
|
|
|
|
textures =
|
|
|
|
{
|
|
|
|
{"cop_regular_female.png"},
|
|
|
|
},
|
|
|
|
|
|
|
|
makes_footstep_sound = true,
|
|
|
|
sounds =
|
|
|
|
{
|
|
|
|
random = "female_noise",
|
|
|
|
},
|
2022-11-22 15:32:50 -05:00
|
|
|
on_die = onCopDie,
|
2022-11-21 16:12:22 -05:00
|
|
|
walk_velocity = 2,
|
|
|
|
run_velocity = 8,
|
|
|
|
jump_height = 1,
|
|
|
|
stepheight = 0,
|
|
|
|
floats = 0,
|
|
|
|
view_range = 45,
|
|
|
|
fall_damage = true,
|
|
|
|
drops =
|
|
|
|
{
|
|
|
|
{name = "cops:badge", chance = 4, min = 0, max = 1},
|
|
|
|
{name = "cops:handcuffs", chance = 3, min = 0, max = 1},
|
|
|
|
{name = "cops:electric_weapon_broken", chance = 3, min = 0, max = 1}
|
|
|
|
},
|
|
|
|
|
|
|
|
animation =
|
|
|
|
{
|
|
|
|
speed_normal = 30,
|
|
|
|
speed_run = 50,
|
|
|
|
stand_start = 0,
|
|
|
|
stand_end = 79,
|
|
|
|
walk_start = 168,
|
|
|
|
walk_end = 187,
|
|
|
|
run_start = 168,
|
|
|
|
run_end = 187,
|
|
|
|
punch_start = 200,
|
|
|
|
punch_end = 219
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
mobs:register_mob("cops:cop_regular_male", {
|
|
|
|
type = "monster",
|
|
|
|
passive = false,
|
|
|
|
attack_type = "dogfight",
|
|
|
|
pathfinding = true,
|
|
|
|
reach = 2,
|
|
|
|
damage = 3,
|
|
|
|
hp_min = 21,
|
|
|
|
hp_max = 25,
|
|
|
|
armor = 100,
|
|
|
|
collisionbox =
|
|
|
|
{
|
|
|
|
-.4, 0, -.4, .4, 2, .4
|
|
|
|
},
|
|
|
|
pushable = true,
|
|
|
|
visual = "mesh",
|
|
|
|
mesh = "character.b3d",
|
|
|
|
textures =
|
|
|
|
{
|
|
|
|
{"cop_regular_male.png"},
|
|
|
|
},
|
|
|
|
|
|
|
|
makes_footstep_sound = true,
|
|
|
|
sounds =
|
|
|
|
{
|
|
|
|
random = "male_noise",
|
|
|
|
},
|
2022-11-22 15:32:50 -05:00
|
|
|
on_die = onCopDie,
|
2022-11-21 16:12:22 -05:00
|
|
|
walk_velocity = 2,
|
|
|
|
run_velocity = 8,
|
|
|
|
jump_height = 1,
|
|
|
|
stepheight = 0,
|
|
|
|
floats = 0,
|
|
|
|
view_range = 45,
|
|
|
|
fall_damage = true,
|
|
|
|
drops =
|
|
|
|
{
|
|
|
|
{name = "cops:badge", chance = 4, min = 0, max = 1},
|
|
|
|
{name = "cops:handcuffs", chance = 3, min = 0, max = 1},
|
|
|
|
{name = "cops:electric_weapon_broken", chance = 3, min = 0, max = 1}
|
|
|
|
},
|
|
|
|
|
|
|
|
animation =
|
|
|
|
{
|
|
|
|
speed_normal = 30,
|
|
|
|
speed_run = 50,
|
|
|
|
stand_start = 0,
|
|
|
|
stand_end = 79,
|
|
|
|
walk_start = 168,
|
|
|
|
walk_end = 187,
|
|
|
|
run_start = 168,
|
|
|
|
run_end = 187,
|
|
|
|
punch_start = 200,
|
|
|
|
punch_end = 219
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
mobs:register_mob("cops:cop_armedthug", {
|
|
|
|
type = "monster",
|
|
|
|
passive = false,
|
|
|
|
attack_type = "dogfight",
|
|
|
|
pathfinding = true,
|
|
|
|
reach = 3,
|
|
|
|
damage = 5,
|
|
|
|
hp_min = 46,
|
|
|
|
hp_max = 50,
|
|
|
|
armor = 100,
|
|
|
|
collisionbox =
|
|
|
|
{
|
|
|
|
-.4, 0, -.4, .4, 2, .4
|
|
|
|
},
|
|
|
|
pushable = true,
|
|
|
|
visual = "mesh",
|
|
|
|
mesh = "character.b3d",
|
|
|
|
textures =
|
|
|
|
{
|
|
|
|
{"cop_armedthug.png"},
|
|
|
|
},
|
|
|
|
|
|
|
|
makes_footstep_sound = true,
|
|
|
|
sounds =
|
|
|
|
{
|
|
|
|
random = "male_noise",
|
|
|
|
},
|
2022-11-22 15:32:50 -05:00
|
|
|
on_die = onCopDie,
|
2022-11-21 16:12:22 -05:00
|
|
|
walk_velocity = 2,
|
|
|
|
run_velocity = 8,
|
|
|
|
jump_height = 1,
|
|
|
|
stepheight = 0,
|
|
|
|
floats = 0,
|
|
|
|
view_range = 45,
|
|
|
|
fall_damage = true,
|
|
|
|
drops =
|
|
|
|
{
|
|
|
|
{name = "cops:badge", chance = 3, min = 0, max = 1},
|
|
|
|
{name = "cops:handcuffs", chance = 4, min = 1, max = 2},
|
|
|
|
},
|
|
|
|
|
|
|
|
animation =
|
|
|
|
{
|
|
|
|
speed_normal = 30,
|
|
|
|
speed_run = 50,
|
|
|
|
stand_start = 0,
|
|
|
|
stand_end = 79,
|
|
|
|
walk_start = 168,
|
|
|
|
walk_end = 187,
|
|
|
|
run_start = 168,
|
|
|
|
run_end = 187,
|
|
|
|
punch_start = 200,
|
|
|
|
punch_end = 219
|
|
|
|
},
|
2022-11-22 15:32:50 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
onCopDie = function()
|
|
|
|
cops.copsSpawned = cops.copsSpawned - 1
|
|
|
|
end
|