From 1622e5cd6d2f3567efaa7f70f521044210662ad8 Mon Sep 17 00:00:00 2001 From: Looki2000 Date: Sat, 18 Feb 2023 17:15:39 +0100 Subject: [PATCH] I suspiciously f****d up last commit so theres second part of the previous one --- mods/amogus_blocks/mod.conf | 1 + mods/amogus_craftings/mod.conf | 1 + .../entities/sussy_imposter_entity.lua | 12 +- mods/amogus_entities/mod.conf | 1 + mods/amogus_general/mod.conf | 1 + mods/amogus_generator/init.lua | 118 ++++++------------ mods/amogus_generator/mod.conf | 1 + mods/amogus_items/mod.conf | 1 + 8 files changed, 49 insertions(+), 87 deletions(-) create mode 100644 mods/amogus_blocks/mod.conf create mode 100644 mods/amogus_craftings/mod.conf create mode 100644 mods/amogus_entities/mod.conf create mode 100644 mods/amogus_general/mod.conf create mode 100644 mods/amogus_generator/mod.conf create mode 100644 mods/amogus_items/mod.conf diff --git a/mods/amogus_blocks/mod.conf b/mods/amogus_blocks/mod.conf new file mode 100644 index 0000000..6911760 --- /dev/null +++ b/mods/amogus_blocks/mod.conf @@ -0,0 +1 @@ +name = amogus_blocks \ No newline at end of file diff --git a/mods/amogus_craftings/mod.conf b/mods/amogus_craftings/mod.conf new file mode 100644 index 0000000..3faac8a --- /dev/null +++ b/mods/amogus_craftings/mod.conf @@ -0,0 +1 @@ +name = amogus_craftings \ No newline at end of file diff --git a/mods/amogus_entities/entities/sussy_imposter_entity.lua b/mods/amogus_entities/entities/sussy_imposter_entity.lua index 5f0e2fe..525a227 100644 --- a/mods/amogus_entities/entities/sussy_imposter_entity.lua +++ b/mods/amogus_entities/entities/sussy_imposter_entity.lua @@ -92,22 +92,22 @@ local entity = { -- play sus sound randomly with different pitch depending on situation if self.mode == 0 or self.mode == 1 then -- stand still or walk - sound_pitch = 0.8 - sound_propability = 100 + self.sound_pitch = 0.8 + self.sound_propability = 100 else -- chase (2) - sound_pitch = 1.2 - sound_propability = 50 + self.sound_pitch = 1.2 + self.sound_propability = 50 end - if math.random(sound_propability) == 1 then + if math.random(self.sound_propability) == 1 then amogus_general.play_random_sound( "sus_sound", self.object:get_pos(), 1.0, -- gain 40, -- max_hear_distance - sound_pitch -- pitch + self.sound_pitch -- pitch ) end diff --git a/mods/amogus_entities/mod.conf b/mods/amogus_entities/mod.conf new file mode 100644 index 0000000..57d7b58 --- /dev/null +++ b/mods/amogus_entities/mod.conf @@ -0,0 +1 @@ +name = amogus_entities \ No newline at end of file diff --git a/mods/amogus_general/mod.conf b/mods/amogus_general/mod.conf new file mode 100644 index 0000000..0841c14 --- /dev/null +++ b/mods/amogus_general/mod.conf @@ -0,0 +1 @@ +name = amogus_general \ No newline at end of file diff --git a/mods/amogus_generator/init.lua b/mods/amogus_generator/init.lua index 93bcaf1..edcbb49 100644 --- a/mods/amogus_generator/init.lua +++ b/mods/amogus_generator/init.lua @@ -2,6 +2,11 @@ minetest.register_alias("mapgen_stone", "amogus_blocks:stone") minetest.register_alias("mapgen_dirt", "amogus_blocks:dirt") minetest.register_alias("mapgen_water_source", "amogus_blocks:water_source") +minetest.register_alias("mapgen_river_water_source", "amogus_blocks:water_source") + +-- I need to register alias of amogus_blocks:water that doesn't even exist in any of the mods to air because Minetest is f****d up and tries to use "water" by default +minetest.register_alias("amogus_blocks:water", "air") + minetest.register_biome({ name = "amogus_beach", @@ -11,10 +16,7 @@ minetest.register_biome({ depth_filler = 3, node_stone = "amogus_blocks:stone", - --node_water_top = "amogus_blocks:water", - --depth_water_top = 1, - node_water = "amogus_blocks:amogus_blocks:water_source", - --node_river_water = "amogus_blocks:water", + node_water = "amogus_blocks:water_source", y_max = 6, y_min = -5, @@ -23,17 +25,13 @@ minetest.register_biome({ }) minetest.register_biome({ name = "amogus_green_biome", - --node_dust = "amogus_blocks:stone", node_top = "amogus_blocks:grass_green", depth_top = 1, node_filler = "amogus_blocks:dirt", depth_filler = 1, node_stone = "amogus_blocks:stone", - --node_water_top = "amogus_blocks:water", - --depth_water_top = 1, - node_water = "amogus_blocks:amogus_blocks:water_source", - --node_river_water = "amogus_blocks:water", + node_water = "amogus_blocks:water_source", y_max = 31000, y_min = 1, @@ -42,17 +40,13 @@ minetest.register_biome({ }) minetest.register_biome({ name = "amogus_biome", - --node_dust = "amogus_blocks:stone", node_top = "amogus_blocks:grass", depth_top = 1, node_filler = "amogus_blocks:dirt", depth_filler = 1, node_stone = "amogus_blocks:stone", - --node_water_top = "amogus_blocks:water", - --depth_water_top = 1, - node_water = "amogus_blocks:amogus_blocks:water_source", - --node_river_water = "amogus_blocks:water", + node_water = "amogus_blocks:water_source", y_max = 31000, y_min = 1, @@ -452,39 +446,11 @@ minetest.register_decoration({ flags = "place_center_x, place_center_z", rotation = "random", }) ---minetest.register_abm({ --- label = "Spawn random entities", --- nodenames = {"group:soil", "group:crumbly", "group:choppy", "group:snappy", "group:cracky"}, - -- interval = 15, - -- chance = 50, - -- action = function(pos) --- local r = math.random(1, 500) - -- if r <= 50 then - -- minetest.add_entity({x = pos.x + math.random(-10, 10), - -- y = pos.y + 1, - -- z = pos.z + math.random(-10, 10)}, "amogus_entities:amogus") - -- minetest.sound_play("amogus_sound", { - -- pos = pos, - -- gain = 1.0, - -- max_hear_distance = 5 - -- }) - - -- end - -- end ---}) minetest.register_on_generated(function(minp, maxp, seed) - --local is_newchunk = true - --for , pos in ipairs(minetest.find_nodes_in_area(minp, maxp, "mymod:amogus_spawner")) do - --is_new_chunk = false - -- break - --end - --if is_new_chunk then - for i = 1, math.random(10, 25) do - minetest.add_entity({x = minp.x + math.random(16), y = minp.y + 1, z = minp.z + math.random(16)}, "amogus_entities:amogus") - --minetest.sound_play("amogus_sound", { pos = pos,gain = 1.0,max_hear_distance = 5}) - end - --end + for i = 1, math.random(10, 25) do + minetest.add_entity({x = minp.x + math.random(16), y = minp.y + 1, z = minp.z + math.random(16)}, "amogus_entities:amogus") + end end) @@ -536,50 +502,40 @@ minetest.register_decoration({ schematic = minetest.get_modpath("amogus_generator") .. "/schematics/STATUE_GIANT.mts", }) + + +-- DEBUG +--imposters_spawned = 0 + + minetest.register_abm({ label = "Spawn Imposter", nodenames = {"air"}, neighbors = {"group:stone"}, - interval = 5, - chance = 500, + interval = 10, + chance = 200, action = function(pos) - -- avoid spawning inside liquids - if minetest.registered_nodes[minetest.get_node(pos).name].liquidtype == "none" then + -- DEBUG + --imposters_spawned = imposters_spawned + 1 + --minetest.chat_send_all("Imposters spawned: " .. imposters_spawned) - local light = minetest.get_node_light(pos) - local time = minetest.get_timeofday() - if light <= 12 and time >= 0.2 and time <= 0.8 then - local entities = minetest.get_objects_inside_radius(pos, 20) - local bat_count = 0 - for _, entity in pairs(entities) do - -- get name while handling .name indexing error caused by get_luaentity() returning nil - -- i cant use get_entity_name() because its deprecated and spams logs - local name = entity:get_luaentity() and entity:get_luaentity().name or "" + -- only spawn on solid blocks AND in the dark + if minetest.registered_nodes[minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}).name].walkable and minetest.get_node_light(pos) <= 12 then + -- do not spawn if there is already an sussy imposter nearby + local nearby_entities = minetest.get_objects_inside_radius(pos, 10) + local imposter_nearby = false - if name == "amogus_entities:sussy_imposter" then - bat_count = bat_count + 1 - if bat_count >= 3 then - return - end - end + for _, entity in pairs(nearby_entities) do + if (entity:get_luaentity() and entity:get_luaentity().name or "") == "amogus_entities:sussy_imposter" then + imposter_nearby = true + break end + end + + if not imposter_nearby then minetest.add_entity(pos, "amogus_entities:sussy_imposter") end + end - end, -}) - - --- wtf is this?? ---minetest.register_on_generated(function(minp, maxp, seed) --- for x = minp.x, maxp.x do --- for y = minp.y, maxp.y do --- for z = minp.z, maxp.z do --- local p = {x=x, y=y, z=z} --- if minetest.get_node(p).name == "default:water_source" then --- minetest.set_node(p, {name="default:water_source", param2=0}) --- end --- end --- end --- end --- end) \ No newline at end of file + end +}) \ No newline at end of file diff --git a/mods/amogus_generator/mod.conf b/mods/amogus_generator/mod.conf new file mode 100644 index 0000000..10bdfca --- /dev/null +++ b/mods/amogus_generator/mod.conf @@ -0,0 +1 @@ +name = amogus_generator \ No newline at end of file diff --git a/mods/amogus_items/mod.conf b/mods/amogus_items/mod.conf new file mode 100644 index 0000000..a898097 --- /dev/null +++ b/mods/amogus_items/mod.conf @@ -0,0 +1 @@ +name = amogus_items \ No newline at end of file