Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Release 31
- Make the data disk description more accurate - they can only hold 20 kilobytes, not 1 megabyte
- Re-worked how meteorite attractors/repulsors attract players when holding neutronium - You now no longer can move yourself, and experience zero gravity
- This allows for making orbits if you are skilled


Release 30
- Fixed crash bugs with jumpdrive and moving nodes with luacontrollers
- Added lead shielding
Expand Down
4 changes: 4 additions & 0 deletions docs/for server owners/clearobjects.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DO NOT RUN /clearobjects

IT WILL MESS UP ALL GRAVITATIONAL ATTRACTORS/REPULSORS, making them need to be replaced or moved.
IT WILL **NOT** HELP WITH LAG
2 changes: 1 addition & 1 deletion mods/areas/pvp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ local function punchplayer_func(player, hitter, time_from_last_punch, tool_capab
return false
end
-- Check if the victim is in an area with allowed PvP or in an unprotected area
local inAreas = areas:getAreasAtPos(player:getpos()) -- replaced hitter:getpos() with player:getpos(), honestly, would not be surprized if thats a bug on bls still
local inAreas = areas:getAreasAtPos(player:get_pos()) -- replaced hitter:getpos() with player:getpos(), honestly, would not be surprized if thats a bug on bls still
-- If the table is empty, PvP is allowed
if not next(inAreas) then
return false
Expand Down
2 changes: 1 addition & 1 deletion mods/player_monoids/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Player Monoids

# Modified in skyblock zero, added some monoids
This is a small library for managing global player state, so that changes made
from different mods do not result in unexpected behavior. The README gives an
introduction to the mod, but you might want to reference API.md along the way.
Expand Down
13 changes: 13 additions & 0 deletions mods/player_monoids/standard_monoids.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,16 @@ player_monoids.visual_size = monoid({
})
end,
})

-- added in sbz:
-- Air Acceleration - Effect values are acceleration_air multipliers.
player_monoids.acceleration_air = monoid({
combine = mult,
fold = mult_fold,
identity = 1,
apply = function(multiplier, player)
local ov = player:get_physics_override()
ov.acceleration_air = multiplier
player:set_physics_override(ov)
end,
})
12 changes: 7 additions & 5 deletions mods/sbz_base/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ function sbz_api.line_of_sight(p1, p2, iters)
if success then return true end
local nodename = core.get_node(pos).name
local ndef = core.registered_nodes[nodename]
if ndef.air then
if ndef.air or (ndef.groups and ndef.groups.transparent and ndef.groups.transparent >= 1) then
-- we need to somehow advance pos to like the next node..
-- p1 -> pos -> p2
-- yeah i dont knoww, oh wait vector.direction is that isnt it?
Expand All @@ -412,7 +412,7 @@ function sbz_api.line_of_sight(p1, p2, iters)
end

function sbz_api.punch(target, hitter, time_from_last_punch, tool_caps, dir)
if target:is_player() or hitter ~= nil then
if (target:is_player()) and hitter ~= nil and not hitter.is_fake_player then
target:punch(hitter, time_from_last_punch, tool_caps, dir)
else
-- entity damage mechanism, see... uhh... the f#ck@ng lua api xD
Expand All @@ -421,9 +421,9 @@ function sbz_api.punch(target, hitter, time_from_last_punch, tool_caps, dir)
time_from_last_punch = time_from_last_punch or 0
local damage = 0
local armor_groups = target:get_armor_groups()
for group, damage in pairs(tool_caps.damage_groups or {}) do
for group, gdamage in pairs(tool_caps.damage_groups or {}) do
damage = damage +
damage * sbz_api.clamp(time_from_last_punch / (tool_caps.full_punch_interval or 0), 0, 1) *
gdamage * sbz_api.clamp(time_from_last_punch / (tool_caps.full_punch_interval or 0), 0, 1) *
((armor_groups[group] or 0) / 100)
end
target:set_hp(math.max(0, target:get_hp() - damage))
Expand Down Expand Up @@ -544,7 +544,9 @@ end

function sbz_api.get_pos_with_eye_height(placer)
local p = placer:get_pos()
p.y = p.y + (placer:get_properties().eye_height or 0)
if not placer.is_fake_player then
p.y = p.y + (placer:get_properties().eye_height or 0)
end
return p
end

Expand Down
2 changes: 1 addition & 1 deletion mods/sbz_logic/code_disks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local logic = sbz_api.logic
minetest.register_craftitem("sbz_logic:data_disk", {
description = "Empty Data Disk",
info_extra = {
"Can hold 1mb of anything.",
"Can hold 20 kilobytes.",
"Can be configured to override editor or normal code on use.",
"Insert into a luacontroller to configure",
},
Expand Down
16 changes: 16 additions & 0 deletions mods/sbz_meteorites/attractor.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
local elapsed = 0

local attracted_players = {}

local function attract_meteorites(pos, dtime, t)
elapsed = elapsed + dtime

Expand All @@ -16,6 +18,9 @@ local function attract_meteorites(pos, dtime, t)
magnitude = (wielded_item:get_definition().groups or {}).attraction
if not magnitude then return end
magnitude = magnitude * wielded_item:get_count()
attracted_players[obj:get_player_name()] = 2 -- VERY low gravity for 2 seconds
player_monoids.gravity:add_change(obj, 0, "sbz_meteorite:attracted")
player_monoids.speed:add_change(obj, 0, "sbz_meteorite:attracted")
end
obj:add_velocity(t * dtime * sbz_api.get_attraction(obj:get_pos(), pos) * magnitude)
if elapsed > 1 then
Expand Down Expand Up @@ -147,3 +152,14 @@ function sbz_api.get_attraction(pos1, pos2)
local length = vector.length(dir)
return vector.normalize(dir) * (length ~= 0 and (length ^ (-2)) or 0)
end

core.register_globalstep(function(dtime)
for k, v in pairs(attracted_players) do
attracted_players[k] = attracted_players[k] - dtime
if attracted_players[k] <= 0 and core.get_player_by_name(k) then
player_monoids.gravity:del_change(core.get_player_by_name(k), "sbz_meteorite:attracted")
player_monoids.speed:del_change(core.get_player_by_name(k), "sbz_meteorite:attracted")
attracted_players[k] = nil
end
end
end)
41 changes: 28 additions & 13 deletions mods/sbz_meteorites/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,49 @@ local function spawn_meteorite(pos)
repeat
pos = player_pos + vector.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
attempts = attempts + 1
until attempts >= 256 or vector.length(pos) > 80 and vector.length(pos) < 100 and minetest.get_node(pos).name ~= "ignore"
until attempts >= 256 or vector.length(pos) > 80 and vector.length(pos) < 100 and minetest.get_node(pos).name == "air"
end
return minetest.add_entity(pos, "sbz_meteorites:meteorite")
end

minetest.register_chatcommand("spawn_meteorite", {
params = "[<x> <y> <z>] | [\"here\"]",
params = "([<x> <y> <z>] | [\"here\"]) [number]",
description = "Attempts to spawn a meteorite somewhere.",
privs = { give = true },
func = function(name, param)
if param == "here" and minetest.get_player_by_name(name) then
param = minetest.get_player_by_name(name):get_pos()
local split = string.split(param, " ", false)
local num_of_meteorites = 1
local pos = nil
-- do not read below
if type(tonumber(split[1])) == "number" and type(tonumber(split[2])) ~= "number" then
num_of_meteorites = math.max(1, tonumber(split[1]))
elseif split[1] == "here" and minetest.get_player_by_name(name) then
pos = minetest.get_player_by_name(name):get_pos()
if tonumber(split[2]) ~= nil then
num_of_meteorites = math.max(1, tonumber(split[2]))
end
else
param = string.split(param, " ")
if #param == 3 and tonumber(param[1]) ~= "fail" and tonumber(param[2]) ~= "fail" and tonumber(param[3]) ~= "fail" then
param = vector.new(tonumber(param[1]), tonumber(param[2]), tonumber(param[3]))
else
param = nil
if tonumber(split[1]) ~= nil and tonumber(split[2]) ~= nil and tonumber(split[3]) ~= nil then
pos = vector.new(tonumber(split[1]), tonumber(split[2]), tonumber(split[3]))
if tonumber(split[4]) ~= nil then
num_of_meteorites = math.min(1, tonumber(split[4]))
end
end
end

local meteorite = spawn_meteorite(param)
local meteorite
for _ = 1, num_of_meteorites do
meteorite = spawn_meteorite(pos)
end
if not meteorite then
minetest.chat_send_player(name, "Failed to spawn meteorite.")
return
end
local pos = vector.round(meteorite:get_pos())
minetest.chat_send_player(name, "Spawned meteorite at " .. pos.x .. " " .. pos.y .. " " .. pos.z .. ".")
local mpos = vector.round(meteorite:get_pos())
if num_of_meteorites == 1 then
minetest.chat_send_player(name, "Spawned meteorite at " .. mpos.x .. " " .. mpos.y .. " " .. mpos.z .. ".")
else
minetest.chat_send_player(name, "Spawned meteorites.")
end
end
})

Expand Down
1 change: 1 addition & 0 deletions mods/sbz_planets/mapgen.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- THE MAPGEN THAT EXECUTES CODE FROM planet_types.lua
local c = core.get_content_id

local c_core = c("sbz_resources:the_core")
Expand Down
12 changes: 5 additions & 7 deletions mods/sbz_planets/planet_teleporter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ core.register_node("sbz_planets:planet_teleporter", {
local content = sbz_api.planets.area:get_area(id, true, true)
local data = core.deserialize(content.data)
local pos_to_tp_to = (vector.subtract(content.max, content.min) / 2) + content.min
pos_to_tp_to.y = content.max.y + 50
pos_to_tp_to.y = content.max.y + 60
if sbz_api.planets.has_rings(data[1], data[2]) then
pos_to_tp_to.y = pos_to_tp_to.y - ((content.max.y - content.min.y) / 2 + sbz_api.planets.ring_size + 10)
end
if sbz_api.can_move_object(clicker:get_armor_groups()) then
clicker:set_pos(pos_to_tp_to)
core.chat_send_player(clicker_name, "You have been teleported to the planet. Please wait and fall a bit.")
stack:take_item(1)
pos_to_tp_to.y = pos_to_tp_to.y - (((content.max.y - content.min.y) / 4) + sbz_api.planets.ring_size + 10)
end
clicker:set_pos(pos_to_tp_to)
core.chat_send_player(clicker_name, "You have been teleported to the planet. Please wait and fall a bit.")
stack:take_item(1)
return stack
end
})
Expand Down
53 changes: 2 additions & 51 deletions mods/sbz_planets/planet_types.lua
Original file line number Diff line number Diff line change
@@ -1,47 +1,4 @@
-- yipee
-- TODO: FOR LATER: ADD PROBABILITIES SO P(STAR) ~= P(DWARF PLANET);

--[[
Types:

PLANET TYPE - think of <real/fake world example>

Dwarf planet - pluto
Dead planet - mercury/mars
Water planet - earth
Ice planet - 'anus/neptune
Deadly planet - venus
Star - Sun
Neutron star - couple of blocks of neutronium, and a neutronium orb at the center
- they would have immense gravity
Black holes - theidealist *really* wanted to make those
]]

--[[
Rock ideas:

dwarfs:
- regular stone+caves+randomly distributed dwarf orb+shape noise

dead planets:
Crust:
- Red Sand
- Sand
- Limestone
- Marble
- Basalt
- Red Stone
- Granite
- Shape noise
- Mountains - it's okay to use 3D noise for 2D things...
- 1/10 chance of having rings
Core:
- Liquid Iron (flowing)
- Liquid Nickel (flowing)
- Dead Core (not flowing)

Where liquid chemicals would be registered in sbz_chem
]]
-- The PLANET-SPECIFIC MAPGEN FILE!

local c = core.get_content_id

Expand Down Expand Up @@ -354,16 +311,10 @@ sbz_api.planets.register_type {
for y = maxp.y - 1, minp.y, -1 do
ni = math.abs(z - minp.z - 1) * sidelen ^ 2 + math.abs(y - minp.y - 1) * sidelen +
math.abs(x - minp.x)
--[[
error(dump {
ni,
#shapenoise
})
--]]
vi = area:index(x, y, z)
local node = data[vi]

if node ~= c_air then
if node ~= c_air and shapenoise[ni] ~= nil then
local xyzvec = vector.new(x, y, z)
local dist_to_center = vector.distance(xyzvec, center)
local radius_value = prad - (shapenoise[ni] * 0.5)
Expand Down
2 changes: 2 additions & 0 deletions mods/sbz_power/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,5 @@ dofile(modpath .. "/ele_fab.lua")
dofile(modpath .. "/lights.lua")
dofile(modpath .. "/batteries.lua")
dofile(modpath .. "/phlogiston_fuser.lua")

dofile(modpath .. "/turret.lua")
5 changes: 5 additions & 0 deletions mods/sbz_power/misc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ sbz_api.register_machine("sbz_power:interactor", {
drop = "pipeworks:puncher",
groups = { matter = 1, cracky = 3, not_in_creative_inventory = 1 },
action = function(pos, node, meta, supply, demand)
meta:set_string("infotext", "Deprecated, get rid of this.")
return 0
end
})
Expand All @@ -68,9 +69,13 @@ local function vacuum(pos, radius, inv)
end

local item_vaccum_power_demand = 20

-- you expected this to be in the pipeworks mod didn't you... well its more convenient to put it here because sbz_api
-- Couldnt you just make pipeworks depend on the mod that implements register_machine and just call it from there ???

-- frog here: Hey anon, no, this mod depends on pipeworks
-- frog here: this mod depends on pipeworks to add pipeworks support...

sbz_api.register_machine("sbz_power:item_vacuum", {
description = "Item Vacuum",
tiles = { "item_vacuum.png" },
Expand Down
1 change: 1 addition & 0 deletions mods/sbz_power/models/turret.bbmodel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"meta":{"format_version":"4.10","model_format":"free","box_uv":false},"name":"turret","model_identifier":"","visible_box":[1,1,0],"variable_placeholders":"","variable_placeholder_buttons":[],"timeline_setups":[],"unhandled_root_fields":{},"resolution":{"width":32,"height":32},"elements":[{"name":"cube","box_uv":false,"rescale":false,"locked":false,"light_emission":0,"render_order":"default","allow_mirror_modeling":true,"from":[-8,-8,-8],"to":[8,8,8],"autouv":0,"color":1,"origin":[0,-8,0],"uv_offset":[0,16],"faces":{"north":{"uv":[0,0,16,16],"texture":0},"east":{"uv":[16,0,32,16],"texture":0},"south":{"uv":[0,0,16,16],"texture":0},"west":{"uv":[0,0,16,16],"texture":0},"up":{"uv":[0,0,16,16],"texture":0},"down":{"uv":[0,0,16,16],"texture":0}},"type":"cube","uuid":"8b8be5c0-a3fe-611f-fb3b-9cc04e07d015"},{"name":"cube","box_uv":false,"rescale":false,"locked":false,"light_emission":0,"render_order":"default","allow_mirror_modeling":true,"from":[8,-2,2],"to":[16,2,3],"autouv":0,"color":5,"origin":[12,8,7],"faces":{"north":{"uv":[0,17,8,21],"texture":0},"east":{"uv":[0,1,1,5],"texture":0},"south":{"uv":[0,17.075,8,21.075],"texture":0},"west":{"uv":[0,1,1,5],"texture":0},"up":{"uv":[0,17,8,18],"texture":0},"down":{"uv":[0,17,8,18],"texture":0}},"type":"cube","uuid":"8e805853-09a0-c797-1b4a-f23908dfa6cd"},{"name":"cube","box_uv":false,"rescale":false,"locked":false,"light_emission":0,"render_order":"default","allow_mirror_modeling":true,"from":[8,-1,-1],"to":[16,5,0],"autouv":0,"color":5,"rotation":[90,1.7655625192200634e-31,-3.975693351829396e-16],"origin":[12,2,0],"faces":{"north":{"uv":[0,16,8,22],"texture":0},"east":{"uv":[0,16,1,22],"texture":0},"south":{"uv":[0,16,8,22],"texture":0},"west":{"uv":[0,16,1,22],"texture":0},"up":{"uv":[0,16,8,17],"texture":0},"down":{"uv":[0,16,8,17],"texture":0}},"type":"cube","uuid":"8f4d02c5-78dd-6b79-eea4-1b277b96a675"},{"name":"cube","box_uv":false,"rescale":false,"locked":false,"light_emission":0,"render_order":"default","allow_mirror_modeling":true,"from":[8,-6,-1],"to":[16,0,0],"autouv":0,"color":5,"rotation":[90,1.7655625192200634e-31,-3.975693351829396e-16],"origin":[12,-3,0],"faces":{"north":{"uv":[0,16,8,22],"texture":0},"east":{"uv":[0,16,1,22],"texture":0},"south":{"uv":[0,16,8,22],"texture":0},"west":{"uv":[0,16,1,22],"texture":0},"up":{"uv":[0,16,8,17],"texture":0},"down":{"uv":[0,16,8,17],"texture":0}},"type":"cube","uuid":"c69eb253-c85b-6829-1e90-5f7f2c372d68"},{"name":"cube","box_uv":false,"rescale":false,"locked":false,"light_emission":0,"render_order":"default","allow_mirror_modeling":true,"from":[8,-2,-3],"to":[16,2,-2],"autouv":0,"color":5,"origin":[12,8,2],"faces":{"north":{"uv":[0,17,8,21],"texture":0},"east":{"uv":[0,17,1,21],"texture":0},"south":{"uv":[0,17,8,21],"texture":0},"west":{"uv":[0,17,1,21],"texture":0},"up":{"uv":[0,17,8,18],"texture":0},"down":{"uv":[0,17,8,18],"texture":0}},"type":"cube","uuid":"35cadf3a-d672-2090-3983-c710c73b9713"},{"name":"cube","box_uv":false,"rescale":false,"locked":false,"light_emission":0,"render_order":"default","allow_mirror_modeling":true,"from":[13,-2,-2],"to":[15,2,2],"autouv":0,"color":4,"origin":[14,-3,1],"faces":{"north":{"uv":[11,5,13,9],"texture":0},"east":{"uv":[11,1,15,5],"texture":0},"south":{"uv":[11,5,13,9],"texture":0},"west":{"uv":[11,1,15,5],"texture":0},"up":{"uv":[13,9,11,5],"texture":0},"down":{"uv":[13,5,11,9],"texture":0}},"type":"cube","uuid":"ceaef535-7d2f-c666-60ee-69cb8547e19a"}],"outliner":[{"name":"Everything","origin":[0,0,0],"rotation":[0,90,0],"color":0,"uuid":"43346984-110c-ec41-5356-96e7783fc7ae","export":true,"mirror_uv":false,"isOpen":true,"locked":false,"visibility":true,"autouv":0,"selected":true,"children":["8b8be5c0-a3fe-611f-fb3b-9cc04e07d015",{"name":"Turrethead","origin":[12,1.5,1.5],"color":0,"uuid":"daae58bb-1d0a-f749-6d0f-3d2a9c4f44bc","export":true,"mirror_uv":false,"isOpen":true,"locked":false,"visibility":true,"autouv":0,"selected":false,"children":[{"name":"Smallcubes","origin":[12,8,7],"color":0,"uuid":"fa8cf01e-eaa3-4fbe-ef2f-dae0f88f94fe","export":true,"mirror_uv":false,"isOpen":true,"locked":false,"visibility":true,"autouv":0,"selected":false,"children":["8e805853-09a0-c797-1b4a-f23908dfa6cd","35cadf3a-d672-2090-3983-c710c73b9713"]},"8f4d02c5-78dd-6b79-eea4-1b277b96a675","c69eb253-c85b-6829-1e90-5f7f2c372d68","ceaef535-7d2f-c666-60ee-69cb8547e19a"]}]}],"textures":[{"path":"/home/et/.minetest/games/skyblock_zero/mods/sbz_power/textures/turret.png","name":"turret.png","folder":"block","namespace":"","id":"2","group":"","width":32,"height":32,"uv_width":32,"uv_height":32,"particle":false,"use_as_default":true,"layers_enabled":false,"sync_to_project":"","render_mode":"default","render_sides":"auto","pbr_channel":"color","frame_time":1,"frame_order_type":"loop","frame_order":"","frame_interpolate":false,"visible":true,"internal":true,"saved":true,"uuid":"eeb64e57-bd80-6ce1-baf2-cb0d43cb9ae2","relative_path":"../textures/turret.png","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAJBJREFUWEdjjAwL+s8wgIAR5AABEQmynPDhzQuwPkr0jzqA6iEAixZccYocXSC1NHEArjQBsnDUAaMhMDJCAF+xSvMQIKVMp0k5MDQdQIqrqa0WXBTjM3T5qnWM1LYU2Ty8dQEokYw6YGSEwIAmQlqmcGLMpmkWo4sDQOUIJQl16IcAMcGMT81oCIyGwICHAADQPcYhyX/DkQAAAABJRU5ErkJggg=="}],"export_options":{"gltf":{"encoding":"ascii","scale":16,"embed_textures":false,"armature":false,"animations":false}}}
Loading