-
Notifications
You must be signed in to change notification settings - Fork 8
Add new map "Skywars" by Themostrandom01 and I_am #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Themostrandom
wants to merge
6
commits into
Minetest-JMA-group:master
Choose a base branch
from
Themostrandom:Skywars
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
64481dc
Create map.conf
Themostrandom c301be0
Add files via upload
Themostrandom 04b0177
Update init.lua
Themostrandom b4864f2
Update init.lua
Themostrandom 1df440e
deleting wrong files
Themostrandom 45c6eba
Add files via upload
Themostrandom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| minetest.register_node("ctf_map:loot_block", { | ||
| description = "Loot Block Spawner", | ||
| tiles = {"default_chest_top.png^[colorize:#FFFF00:80"}, | ||
| groups = {unbreakable=1, not_in_creative_inventory=1}, | ||
| sounds = default.node_sound_stone_defaults(), | ||
| diggable = false, | ||
| pointable = true, | ||
| walkable = true, | ||
| drop = "", | ||
| on_blast = function() end, | ||
| }) | ||
|
|
||
| local loot_table = { | ||
| {item = "default:sword_steel", chance = 15, type = "weapon", sword_type = "steel"}, | ||
| {item = "default:sword_mese", chance = 5, type = "weapon", sword_type = "mese"}, | ||
| {item = "default:sword_diamond", chance = 2, type = "weapon", sword_type = "diamond"}, | ||
| {item = "default:diamond", chance = 5}, | ||
| {item = "default:blueberries 10", chance = 15}, | ||
| {item = "ctf_map:damage_cobble 10", chance = 10}, | ||
| {item = "wind_charge:wind_charge 10", chance = 15}, | ||
| {item = "default:cobble 50", chance = 15}, | ||
| {item = "ctf_map:spike 10", chance = 5}, | ||
| {item = "ctf_landmine:landmine 2", chance = 4}, | ||
| {item = "default:mese_crystal 2", chance = 9} | ||
| } | ||
|
|
||
| local function get_random_loot() | ||
| local rnd = math.random(100) | ||
| local cumulative = 0 | ||
|
|
||
| for _, entry in ipairs(loot_table) do | ||
| local mode = ctf_modebase.current_mode | ||
|
|
||
| if mode == "classes" then | ||
| if entry.type == "weapon" then | ||
| goto continue | ||
| end | ||
| elseif mode == "nade_fight" then | ||
| if entry.type == "weapon" and entry.sword_type == "diamond" then | ||
| goto continue | ||
| end | ||
| end | ||
|
|
||
| cumulative = cumulative + entry.chance | ||
| if rnd <= cumulative then | ||
| return entry.item | ||
| end | ||
|
|
||
| ::continue:: | ||
| end | ||
|
|
||
| return nil | ||
| end | ||
|
|
||
| local function player_in_radius(pos, radius) | ||
| local objs = minetest.get_objects_inside_radius(pos, radius) | ||
| for _, obj in ipairs(objs) do | ||
| if obj:is_player() then | ||
| return true | ||
| end | ||
| end | ||
| return false | ||
| end | ||
|
|
||
| minetest.register_abm({ | ||
| label = "Loot Block Spawner", | ||
| nodenames = {"ctf_map:loot_block"}, | ||
| interval = 1, | ||
| chance = 1, | ||
| action = function(pos, node) | ||
| if not player_in_radius(pos, 5) then | ||
| return | ||
| end | ||
|
|
||
| local objs = minetest.get_objects_inside_radius({x=pos.x, y=pos.y+1, z=pos.z}, 1.5) | ||
| local item_count = 0 | ||
| for _, obj in ipairs(objs) do | ||
| if not obj:is_player() then | ||
| local ent = obj:get_luaentity() | ||
| if ent and ent.name == "__builtin:item" then | ||
| item_count = item_count + 1 | ||
| end | ||
| end | ||
| end | ||
|
|
||
| if item_count >= 10 then | ||
| return | ||
| end | ||
|
|
||
| local item = get_random_loot() | ||
| if item then | ||
| local drop_pos = {x=pos.x, y=pos.y+1, z=pos.z} | ||
| minetest.add_item(drop_pos, item) | ||
| end | ||
| end, | ||
| }) | ||
|
|
||
| local world_bound_pos1, world_bound_pos2 = nil, nil | ||
| local MAP_NAME = "Skywars" | ||
|
|
||
| local function clear_loot_items() | ||
| if not world_bound_pos1 or not world_bound_pos2 then | ||
| return | ||
| end | ||
|
|
||
| local loot_blocks = minetest.find_nodes_in_area(world_bound_pos1, world_bound_pos2, {"ctf_map:loot_block"}) | ||
|
|
||
| for _, pos in ipairs(loot_blocks) do | ||
| local objs = minetest.get_objects_inside_radius( | ||
| {x = pos.x, y = pos.y + 1, z = pos.z}, 1.5 | ||
| ) | ||
| for _, obj in ipairs(objs) do | ||
| local ent = obj:get_luaentity() | ||
| if ent and ent.name == "__builtin:item" then | ||
| obj:remove() | ||
| end | ||
| end | ||
| end | ||
| end | ||
|
|
||
| ctf_api.register_on_new_match(function() | ||
| if ctf_map.current_map and ctf_map.current_map.name == MAP_NAME then | ||
| minetest.after(0, function() | ||
| world_bound_pos1 = ctf_map.current_map.pos1 | ||
| world_bound_pos2 = ctf_map.current_map.pos2 | ||
| clear_loot_items() | ||
| end) | ||
| end | ||
| end) | ||
|
|
||
| ctf_api.register_on_match_end(function() | ||
| if ctf_map.current_map and ctf_map.current_map.name == MAP_NAME then | ||
| clear_loot_items() | ||
| world_bound_pos1 = nil | ||
| world_bound_pos2 = nil | ||
| end | ||
| end) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| game_modes = return {"classes","classic","nade_fight"} | ||
| barrier_area = return {pos2={x=143,y=61,z=144},pos1={x=0,y=0,z=0}} | ||
| chests = return {{pos2={x=133,y=30.5,z=134},pos1={x=101,y=23.5,z=102},amount=70},{pos2={x=41,y=30.5,z=134},pos1={x=9,y=23.5,z=102},amount=70},{pos2={x=41,y=30.5,z=42},pos1={x=9,y=23.5,z=10},amount=70},{pos2={x=133,y=30.5,z=42},pos1={x=101,y=23.5,z=10},amount=70},{pos2={x=123,y=32.5,z=76},amount=10,pos1={x=116,y=32.5,z=68}},{pos2={x=75,y=32.5,z=124},amount=10,pos1={x=67,y=32.5,z=117}},{pos2={x=26,y=32.5,z=76},amount=10,pos1={x=19,y=32.5,z=68}},{pos2={x=75,y=32.5,z=27},amount=10,pos1={x=67,y=32.5,z=20}},{pos2={x=81,y=36.5,z=82},amount=25,pos1={x=61,y=31.5,z=62}}} | ||
| phys_jump = 1.3 | ||
| phys_gravity = 0.9 | ||
| time_speed = 1 | ||
| enable_shadows = 0.26 | ||
| phys_speed = 1.1 | ||
| skybox = CloudyLightRays | ||
| teams = local _={};_[1]="enabled";_[2]="flag_pos";return {red={[_[1]]=true,pos1={x=0,y=1,z=0},pos2={x=71,y=61,z=72},[_[2]]={x=37,y=23.5,z=15}},purple={[_[1]]=true,pos1={x=143,y=1,z=0},pos2={x=71,y=61,z=72},[_[2]]={x=128,y=23.5,z=38}},blue={[_[1]]=true,pos1={x=71,y=61,z=72},pos2={x=143,y=1,z=144},[_[2]]={x=105,y=23.5,z=129}},yellow={[_[1]]=true,pos1={x=0,y=2,z=144},pos2={x=71,y=61,z=72},[_[2]]={x=14,y=23.5,z=106}}} | ||
| treasures = | ||
| others = You will find a block that spawns items in each base. | ||
| initial_stuff = return {} | ||
| license = CC BY-SA 4.0 | ||
| hint = Find the solution of the maze for rewards | ||
| author = Themostrandom01, I_am | ||
| start_time = 5900 | ||
| name = Skywars | ||
| enabled = true | ||
| size = return {x=143,y=61,z=144} | ||
| map_version = 3 |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that instead of ABM, you could use node timer for periodic item spawning with a chance.