diff --git a/MINIGAMES.SK/core/_lib/nbt.sk b/MINIGAMES.SK/core/_lib/nbt.sk new file mode 100644 index 0000000..f72d3c7 --- /dev/null +++ b/MINIGAMES.SK/core/_lib/nbt.sk @@ -0,0 +1,41 @@ +# +# ============== +# nbt.sk +# ============== +# nbt.sk is part of the MINIGAMES.SK library. +# ============== + +import: + org.bukkit.Bukkit + org.bukkit.NamespacedKey + org.bukkit.persistence.PersistentDataType + org.bukkit.persistence.PersistentDataContainer + +# +# > Function - getnbtvalue +# > Parameters: +# > The item with the nbt value +# > The nbt tag data which is needed +# > Actions: +# > Loads nbt value for the parameter tag and return the value. +function getnbtvalue(item:item,tag:text) :: object: + set {_namespacedKey} to new NamespacedKey(Bukkit.getServer().getPluginManager().getPlugin("Skript"), {_tag}) + set {_meta} to {_item}.getItemMeta() + set {_container} to {_meta}.getPersistentDataContainer() + if {_container}.has({_namespacedKey} , PersistentDataType.STRING!): + return {_container}.get({_namespacedKey}, PersistentDataType.STRING!) + +# +# > Function - setnbtvalue +# > Parameters: +# > The item to set the nbt value on +# > The tag which should be set +# > The value which should be set +# > Actions: +# > Sets the tag to the value and return the item with the new nbt data. +function setnbtvalue(item:item,tag:text,value:text) :: item: + set {_namespacedKey} to new NamespacedKey(Bukkit.getServer().getPluginManager().getPlugin("Skript"), {_tag}) + set {_meta} to {_item}.getItemMeta() + {_meta}.getPersistentDataContainer().set({_namespacedKey}, PersistentDataType.STRING!, {_value}) + {_item}.setItemMeta({_meta}) + return {_item} diff --git a/MINIGAMES.SK/core/events/mgFixInvisiblePlayers.sk b/MINIGAMES.SK/core/events/mgFixInvisiblePlayers.sk index 2c4cf41..b718459 100644 --- a/MINIGAMES.SK/core/events/mgFixInvisiblePlayers.sk +++ b/MINIGAMES.SK/core/events/mgFixInvisiblePlayers.sk @@ -5,8 +5,12 @@ # mgFixInvisiblePlayers.sk is part of the MINIGAMES.SK library. # ============== +import: + org.bukkit.Bukkit + on join: wait 1 second + set {_plugin} to Bukkit.getServer().getPluginManager().getPlugin("Skript") loop all players: - loop-player.showPlayer(player) - player.showPlayer(loop-player) + loop-player.showPlayer({_plugin},player) + player.showPlayer({_plugin},loop-player) diff --git a/MINIGAMES.SK/games/CannonBattle/-init.sk b/MINIGAMES.SK/games/CannonBattle/-init.sk new file mode 100644 index 0000000..f665bb1 --- /dev/null +++ b/MINIGAMES.SK/games/CannonBattle/-init.sk @@ -0,0 +1,77 @@ + +# +# ============== +# init.sk +# ============== +# init.sk is part of the MINIGAMES.SK library. +# ============== +# > GAME: CannonBattle +# ============== + +on load: + wait 1 tick + mgCannonBattleHandler("start") + +every 1 second: + feed all players + +on quit: + if mgGetTemporaryGameData("playerstatus|%player%") is true: + set {_playersingame} to mgGetTemporaryGameData("playersingame") + remove 1 from {_playersingame} + mgSetTemporaryGameData("playersingame",{_playersingame}) + mgSetTemporaryGameData("playerstatus|%player%",false) + mgCheckCannonBattleRoundEnd() + +on join: + clear inventory of player + set gamemode of player to spectator + set {_loc} to mgGetTemporaryGameData("respawnloc") + teleport player to {_loc} + +on damage: + if victim is a player: + if "%event.getCause()%" is "unknown" or "fall": + cancel event + mgCannonBattleHandleGameDeath(victim) + +on death: + if victim is a player: + wait 1 tick + force victim to respawn + wait 1 tick + mgCannonBattleHandleGameDeath(player) + +on explosion: + loop all blocks in radius 5 around event-location: + if loop-block is grass block or dirt or sandstone: + add location of loop-block to {_expblocks::*} + add loop-block.getBlockData() to {_expdata::*} + wait 1 tick + loop {_expblocks::*}: + if block at loop-value is air: + chance of 50%: + set {_direction} to direction from event-location to loop-value + set {_e} to (event-locations's world).spawnFallingBlock(loop-value, {_expdata::%loop-index%}) + push {_e} {_direction} at speed 1 + + +on respawn: + wait 1 tick + mgCannonBattleHandleGameDeath(player) + + +on break: + clear drops + if mgGetTemporaryGameData("status") is not "ingame": + cancel event + +every 1 tick: + if mgGetTemporaryGameData("status") is "ingame": + loop all players: + set {_loc} to location of loop-player + remove 1 from y-coord of {_loc} + loop blocks in radius 1.2 around {_loc}: + if loop-block is lime concrete: + set {_bloc} to location of loop-block + mgCannonBattleFloor({_bloc}) diff --git a/MINIGAMES.SK/games/CannonBattle/config.sk b/MINIGAMES.SK/games/CannonBattle/config.sk new file mode 100644 index 0000000..07b9918 --- /dev/null +++ b/MINIGAMES.SK/games/CannonBattle/config.sk @@ -0,0 +1,14 @@ +# +# ============== +# config.sk +# ============== +# config.sk is part of the MINIGAMES.SK library. +# ============== + +on load: + wait 1 tick + set {_game} to "CannonBattle" + mgSetTranslation("en",{_game},"name","CannonBattle") + mgSetTranslation("en",{_game},"desc","Build TNT Cannons and destory the beacon of the enemy.") + mgSetTranslation("en",{_game},"bossbar_countdown","Prepare yourself...") + mgSetTranslation("en",{_game},"toplist_scoreboard","&7&l | &f &7&l>> &e&l") diff --git a/MINIGAMES.SK/games/CannonBattle/functions.sk b/MINIGAMES.SK/games/CannonBattle/functions.sk new file mode 100644 index 0000000..2530fa2 --- /dev/null +++ b/MINIGAMES.SK/games/CannonBattle/functions.sk @@ -0,0 +1,461 @@ +# +# ============== +# functions.sk +# ============== +# functions.sk is part of the MINIGAMES.SK library. +# ============== +# > GAME: CannonBattle +# ============== + +options: + islandsize: 100 + walldepth: 5 + wallheight: 40 + gametime: 3600 +#Regeln: +# 1. Der Becon darf nur mit tnt zerstört werden. +# 2. die tnt kanonen dürfen nur auf seiner eigenen seite gebaut werden. +# 3. kein PVP +# 4. ein verkämpen +# 5. alle tnt kanonen sin erlaubt +# 6. keine hacks beleidigungen oder semtliches anderes zeug +# +#Anleitung: Es gibt zwei oder mehr sh. unten Teams mit jeweils einer Insel. Zwichen den Inseln befindet sich eine dicke mauer die erst mit tnt zerstört werden muss um den Becon des anderen teams zu zerstören. +# Auf der Insel befinden sich chest mit notwendigen sachen wie z.b. obsidian restone tnt (tnt sapawner) redston kram ... +# +#Funktionen: - man wird unendlich respawnt (kann so oft sterben wie möglich). +# - es gibt ein tnt spawner. +# - mann sollte haste 3 und effi 5 haben. +# - 1vs.1 oder 2vs.2 oder 1vs.1vs.1vs.1 oder 4vs.4 oder 2vs.2vs.2 oder 1vs.1vs.1 semtliche kombis auf grund der spieleranzahlen von skyroad +# +#Tips: man solte im team komuniziren +# man sollte sich vorher über tnt kanonen informirt haben + + +function mgCannonBattleSpawnSupplyVillager(loc:location,name:text): + loop all entities in radius 0.2 around {_loc}: + if loop-entity is a villager: + kill loop-entity + spawn villager at {_loc} + set {_villager} to last spawned entity + set {_head} to 1 of button + set {_head} to setnbtvalue({_head},"CannonBattle","true") + set {_villager}'s helmet to {_head} + {_villager}.setCustomName({_name}) + {_villager}.setCustomNameVisible(true) + {_villager}.setInvulnerable(true) + {_villager}.setSilent(true) + {_villager}.setAI(false) + {_villager}.setRotation(-180) + {_villager}.setVillagerType(2) + +on damage of villager: + if victim's helmet is set: + set {_cannonbattle} to getnbtvalue(victim's helmet,"CannonBattle") + if {_cannonbattle} is "true": + mgBattleOpenSupplyMenu(attacker) + cancel event +on rightclick on villager: + if event-entity's helmet is set: + set {_cannonbattle} to getnbtvalue(event-entity's helmet,"CannonBattle") + if {_cannonbattle} is "true": + mgBattleOpenSupplyMenu(player) + cancel event + +function mgBattleOpenSupplyMenu(player:player): + opengui({_player},54,"&lSupplies") + set {_inv} to {_player}'s current inventory + loop 54 times: + set {_loop} to loop-number - 1 + if {_loop} is 0 or 1 or 2 or 9 or 10 or 11 or 18 or 19 or 20 or 27 or 28 or 29 or 36 or 37 or 38 or 45 or 46 or 47: + set {_item} to 64 of tnt + if {_loop} is 3 or 4: + set {_item} to 64 of dispenser + if {_loop} is 5 or 6: + set {_item} to 64 of cobblestone + if {_loop} is 7 or 8: + set {_item} to 64 of redstone repeater + if {_loop} is 12 or 13: + set {_item} to 64 of sticky piston + if {_loop} is 14 or 15: + set {_item} to 64 of smooth stone slab + if {_loop} is 16 or 17: + set {_item} to 64 of redstone comparator + if {_loop} is 21 or 22: + set {_item} to 64 of piston + if {_loop} is 23 or 24: + set {_item} to 64 of stone pressure plate + if {_loop} is 25 or 26: + set {_item} to 64 of redstone + if {_loop} is 30 or 31: + set {_item} to 64 of obsidian + if {_loop} is 32 or 33: + set {_item} to 64 of ladder + if {_loop} is 34 or 35: + set {_item} to 16 of oak sign + if {_loop} is 39 or 40: + set {_item} to 1 of water bucket + if {_loop} is 41: + set {_item} to 64 of lever + if {_loop} is 42: + set {_item} to 64 of stone button + if {_loop} is 43: + set {_item} to 1 of flint and steel + if {_loop} is 44: + set {_item} to 1 of diamond pickaxe of efficiency 10 + if {_loop} is 48 or 49: + set {_item} to 1 of water bucket + if {_loop} is 50 or 51: + set {_item} to 64 of oak fence + if {_loop} is 52: + set {_item} to 1 of diamond pickaxe of efficiency 10 + if {_loop} is 53: + set {_item} to 1 of flint and steel + set slot {_loop} of {_inv} to {_item} + + +options: + gamerounds: 1 + +# +# > Function - mgCannonBattleHandler +# > Starts or stops the game depending on the parameter. +# > Parameters: +# > task, either "start" or "stop" +function mgCannonBattleHandler(task:text): + if {_task} is "start": + mgSetTemporaryGameData("round",0) + mgSetTemporaryGameData("status","loading") + + loop all players: + mgSetCurrentGamePoints("CannonBattle",loop-player,"points",0) + mgSetSidebarToplist("CannonBattle","points",5,1) + + mgSetTemporaryGameData("playersingame",number of all players) + mgCannonBattleStartNewRound() + + # + # > If the game should be stopped, use the MINIGAMES.SK function to + # > clear out any temporary data and unload the game. + if {_task} is "stop": + mgFinishGame() + +# +# > Function - mgCannonBattleStartNewRound +# > Starts a new CannonBattle round. +function mgCannonBattleStartNewRound(): + set {_tplayers} to 0 + set {_tplayers} to number of all players + if {_tplayers} is bigger than 0: + + mgSetTemporaryGameData("playersingame",number of all players) + loop all players: + mgSetTemporaryGameData("playerstatus|%loop-player%",true) + mgSetTemporaryGameData("status","preparing") + + set {_round} to mgGetTemporaryGameData("round") + add 1 to {_round} + mgSetTemporaryGameData("round",{_round}) + + if {_round} is bigger than {@gamerounds}: + mgSpleefHandler("stop") + stop + broadcast "%getChatPrefix()% Round %{_round}%/{@gamerounds}" + + # + # > Create a fitting arena. Base size 40x40 + 2x2 per player + set {_mapsize} to 10 + number of all players + set {_mainarena} to "" + set {_mainarena} to location at 0.5, 1, 0.5 in mgGetCurrentWorld() + mgSetTemporaryGameData("respawnloc",location at 0.5, 2, 0.5 in mgGetCurrentWorld()) + + set {_xstart} to -50000 + set {_zstart} to -50000 + + loop {_round} times: + add 50000 to {_xstart} + add 50000 to {_zstart} + + loop all players: + add 1 to {_playerloop} + set {_islandloc} to location at {_xstart}, 20, {_zstart} in mgGetCurrentWorld() + mgSetTemporaryGameData("Island|%loop-player%",{_islandloc}) + mgSetTemporaryGameData("Islandloc|%{_xstart}%|%{_zstart}%",true) + set {_spawnloc} to {_islandloc} + set y-coord of {_spawnloc} to 21 + mgSetTemporaryGameData("Respawnloc|%loop-player%",{_spawnloc}) + remove 3 from z-coord of {_spawnloc} + mgCannonBattleSpawnSupplyVillager({_spawnloc},"&lSupply") + + loop all blocks in radius 10 around {_islandloc}: + if 20.5 is bigger than y-coord of loop-block: + set loop-block to grass block + loop all blocks in radius 3 around {_islandloc}: + if 20.5 is bigger than y-coord of loop-block: + set loop-block to obsidian + + if {_playerloop} is 1: + add {@islandsize} to {_xstart} + if {_removez} is true: + remove {_zstart} from {_zstart} + delete {_removez} + if {_playerloop} is 2: + add {@islandsize} to {_zstart} + set {_removez} to true + delete {_playerloop} + + loop all players: + set {_loc} to mgGetTemporaryGameData("Island|%loop-player%") + mgCannonBattleCalculateWalls({_loc}, red sandstone, sandstone, red sandstone) + + # + # > Create a countdown that lets the players wait for 5 seconds. + mgDisplayBossbarCountdown(10,"CannonBattle","bossbar_countdown",null) + + wait 1 seconds + loop all players: + set {_loc} to mgGetTemporaryGameData("Respawnloc|%loop-player%") + teleport loop-player to {_loc} + + + apply resistance 12 without particles to all players for 1 seconds + apply invisibility 1 without particles to all players for 0.1 seconds + set gamemode of all players to survival + + set {_loc} to mgGetTemporaryGameData("respawnloc") + teleport all players to {_loc} + clear inventory of all players + + # + # > Give the items to the players. + mgSetTemporaryGameData("status","ingame") + set {_rending} to {@gametime} + while mgGetTemporaryGameData("status") is "ingame": + add 1 to {_roundtime} + remove 1 from {_rending} + send action bar "%{_rending}%" to all players + loop all players: + if gamemode of loop-player is survival: + if -1 is bigger than y-coordinate of loop-player: + damage loop-player by 5 hearts + if {_roundtime} is bigger than {@gametime}: + mgSetTemporaryGameData("status","exitround") + mgCannonBattleStartNewRound() + wait 1 second + + else: + broadcast "%getChatPrefix()% Not enough players." + mgSpleefHandler("stop") +import: + java.lang.Math + +# +# > Function - mgCannonBattleCreateWalls +# > Creates a Wall of the defined material between the two locations. +# > Parameters: +# > One of the two points where the block should be placed. +# > One of the two points where the block should be placed. +# > The block (item) that should be placed. +function mgCannonBattleCreateWalls(loc1:location,loc2:location,block:item,mode:text="x",xwait:number=0,ywait:number=0,zwait:number=0): + set {_minx} to Math.min(x-coord of {_loc1},x-coord of {_loc2}) + set {_miny} to Math.min(y-coord of {_loc1},y-coord of {_loc2}) + set {_minz} to Math.min(z-coord of {_loc1},z-coord of {_loc2}) + set {_maxx} to Math.max(x-coord of {_loc1},x-coord of {_loc2}) + set {_maxy} to Math.max(y-coord of {_loc1},y-coord of {_loc2}) + set {_maxz} to Math.max(z-coord of {_loc1},z-coord of {_loc2}) + set {_world} to {_loc1}'s world + + set {_diffx} to difference between {_minx} and {_maxx} + set {_diffy} to difference between {_miny} and {_maxy} + set {_diffz} to difference between {_minz} and {_maxz} + + if {_xwait} is not 0: + set {_xwait} to "%{_xwait}% ticks" parsed as timespan + if {_ywait} is not 0: + set {_ywait} to "%{_ywait}% ticks" parsed as timespan + if {_zwait} is not 0: + set {_zwait} to "%{_zwait}% ticks" parsed as timespan + if {_mode} is "x": + set {_x} to {_minx} + loop {_diffx} times: + if {_xwait} is not 0: + wait {_xwait} + set {_z} to {_minz} + add 1 to {_x} + loop {_diffz} times: + if {_zwait} is not 0: + wait {_zwait} + set {_y} to {_miny} + add 1 to {_z} + loop {_diffy} times: + if {_ywait} is not 0: + wait {_ywait} + set {_blockloc} to location at {_x}, {_y}, {_z} in {_world} + add 1 to {_y} + set block at {_blockloc} to {_block} + else if {_mode} is "z": + set {_z} to {_minz} + loop {_diffz} times: + if {_zwait} is not 0: + wait {_zwait} + set {_x} to {_minx} + add 1 to {_z} + loop {_diffx} times: + if {_xwait} is not 0: + wait {_xwait} + set {_y} to {_miny} + add 1 to {_x} + loop {_diffy} times: + if {_ywait} is not 0: + wait {_ywait} + set {_blockloc} to location at {_x}, {_y}, {_z} in {_world} + add 1 to {_y} + set block at {_blockloc} to {_block} + else if {_mode} is "y": + set {_y} to {_miny} + loop {_diffy} times: + if {_ywait} is not 0: + wait {_ywait} + set {_x} to {_minx} + add 1 to {_y} + loop {_diffx} times: + if {_xwait} is not 0: + wait {_xwait} + set {_z} to {_minz} + add 1 to {_x} + loop {_diffz} times: + if {_zwait} is not 0: + wait {_zwait} + set {_blockloc} to location at {_x}, {_y}, {_z} in {_world} + add 1 to {_z} + set block at {_blockloc} to {_block} + +function mgCannonBattleCalculateWalls(loc:location, floor:item, filling:item, top:item): + wait 1 tick + set {_floorheight} to y-coord of {_loc} + remove 10 from {_floorheight} + set {_walldistance} to {@islandsize} / 2 + + set {_checkx} to x-coord of {_loc} + set {_checkz} to z-coord of {_loc} + remove {@islandsize} from {_checkz} + if mgGetTemporaryGameData("Islandloc|%{_checkx}%|%{_checkz}%") is true: + set {_northwall1} to {_loc} + remove {_walldistance} from z-coord of {_northwall1} + set {_northwall2} to {_northwall1} + add {_walldistance} to x-coord of {_northwall1} + remove {_walldistance} from x-coord of {_northwall2} + add {@walldepth} to z-coord of {_northwall2} + set y-coord of {_northwall1} to {_floorheight} + set y-coord of {_northwall2} to {_floorheight} + 1 + if {_floor} is not air: + mgCannonBattleCreateWalls({_northwall1},{_northwall2},{_floor}) + if {_filling} is not air: + set y-coord of {_northwall1} to {_floorheight} + 1 + set y-coord of {_northwall2} to {_floorheight} + {@wallheight} + mgCannonBattleCreateWalls({_northwall1},{_northwall2},{_filling}) + if {_top} is not air: + set y-coord of {_northwall1} to {_floorheight} + {@wallheight} + set y-coord of {_northwall2} to {_floorheight} + {@wallheight} + 1 + mgCannonBattleCreateWalls({_northwall1},{_northwall2},{_top}) + + set {_checkx} to x-coord of {_loc} + set {_checkz} to z-coord of {_loc} + add {@islandsize} to {_checkz} + if mgGetTemporaryGameData("Islandloc|%{_checkx}%|%{_checkz}%") is true: + set {_southwall1} to {_loc} + add {_walldistance} to z-coord of {_southwall1} + set {_southwall2} to {_southwall1} + add {_walldistance} to x-coord of {_southwall1} + remove {_walldistance} from x-coord of {_southwall2} + remove {@walldepth} from z-coord of {_southwall2} + + set y-coord of {_southwall1} to {_floorheight} + set y-coord of {_southwall2} to {_floorheight} + 1 + if {_floor} is not air: + mgCannonBattleCreateWalls({_southwall1},{_southwall2},{_floor}) + if {_filling} is not air: + set y-coord of {_southwall1} to {_floorheight} + 1 + set y-coord of {_southwall2} to {_floorheight} + {@wallheight} + mgCannonBattleCreateWalls({_southwall1},{_southwall2},{_filling}) + if {_top} is not air: + set y-coord of {_southwall1} to {_floorheight} + {@wallheight} + set y-coord of {_southwall2} to {_floorheight} + {@wallheight} + 1 + mgCannonBattleCreateWalls({_southwall1},{_southwall2},{_top}) + + set {_checkx} to x-coord of {_loc} + set {_checkz} to z-coord of {_loc} + remove {@islandsize} from {_checkx} + if mgGetTemporaryGameData("Islandloc|%{_checkx}%|%{_checkz}%") is true: + set {_westwall1} to {_loc} + remove {_walldistance} from x-coord of {_westwall1} + set {_westwall2} to {_westwall1} + add {_walldistance} to z-coord of {_westwall1} + remove {_walldistance} from z-coord of {_westwall2} + add {@walldepth} to x-coord of {_westwall2} + + set y-coord of {_westwall1} to {_floorheight} + set y-coord of {_westwall2} to {_floorheight} + 1 + if {_floor} is not air: + mgCannonBattleCreateWalls({_westwall1},{_westwall2},{_floor}) + if {_filling} is not air: + set y-coord of {_westwall1} to {_floorheight} + 1 + set y-coord of {_westwall2} to {_floorheight} + {@wallheight} + mgCannonBattleCreateWalls({_westwall1},{_westwall2},{_filling}) + if {_top} is not air: + set y-coord of {_westwall1} to {_floorheight} + {@wallheight} + set y-coord of {_westwall2} to {_floorheight} + {@wallheight} + 1 + mgCannonBattleCreateWalls({_westwall1},{_westwall2},{_top}) + + set {_checkx} to x-coord of {_loc} + set {_checkz} to z-coord of {_loc} + add {@islandsize} to {_checkx} + if mgGetTemporaryGameData("Islandloc|%{_checkx}%|%{_checkz}%") is true: + set {_eastwall1} to {_loc} + add {_walldistance} to x-coord of {_eastwall1} + set {_eastwall2} to {_eastwall1} + add {_walldistance} to z-coord of {_eastwall1} + remove {_walldistance} from z-coord of {_eastwall2} + remove {@walldepth} from x-coord of {_eastwall2} + + set y-coord of {_eastwall1} to {_floorheight} + set y-coord of {_eastwall2} to {_floorheight} + 1 + if {_floor} is not air: + mgCannonBattleCreateWalls({_eastwall1},{_eastwall2},{_floor}) + if {_filling} is not air: + set y-coord of {_eastwall1} to {_floorheight} + 1 + set y-coord of {_eastwall2} to {_floorheight} + {@wallheight} + mgCannonBattleCreateWalls({_eastwall1},{_eastwall2},{_filling}) + if {_top} is not air: + set y-coord of {_eastwall1} to {_floorheight} + {@wallheight} + set y-coord of {_eastwall2} to {_floorheight} + {@wallheight} + 1 + mgCannonBattleCreateWalls({_eastwall1},{_eastwall2},{_top}) + +# +# > Function - mgCheckCannonBattleRoundEnd +# > Checks if the CannonBattle round should be stopped. +function mgCheckCannonBattleRoundEnd(): + if mgGetTemporaryGameData("status") is "ingame": + if mgGetTemporaryGameData("playersingame") is smaller than 2: + loop all players: + if loop-player's gamemode is survival: + mgAddPlayerToplistWin("CannonBattle",loop-player,1) + broadcast "%getChatPrefix()% %loop-player% has won this round." + mgSetTemporaryGameData("status","preparing") + mgCannonBattleStartNewRound() + +# +# > Function - mgCannonBattleHandleGameDeath +# > If a player died in CannonBattle, do everything needed. +# > Parameters: +# > the player who died +function mgCannonBattleHandleGameDeath(player:player): + set {_loc} to mgGetTemporaryGameData("Respawnloc|%{_player}%") + teleport {_player} to {_loc} + +function mgCannonBattleFloor(loc:location): + set block at {_loc} to yellow concrete + wait 5 ticks + set block at {_loc} to red concrete + wait 5 ticks + set block at {_loc} to air diff --git a/MINIGAMES.SK/games/CannonBattle/init.sk b/MINIGAMES.SK/games/CannonBattle/init.sk new file mode 100644 index 0000000..7f191ee --- /dev/null +++ b/MINIGAMES.SK/games/CannonBattle/init.sk @@ -0,0 +1,74 @@ + +# +# ============== +# init.sk +# ============== +# init.sk is part of the MINIGAMES.SK library. +# ============== +# > GAME: CannonBattle +# ============== + +on load: + wait 1 tick + mgCannonBattleHandler("start") + +every 1 second: + feed all players + +on quit: + if mgGetTemporaryGameData("playerstatus|%player%") is true: + set {_playersingame} to mgGetTemporaryGameData("playersingame") + remove 1 from {_playersingame} + mgSetTemporaryGameData("playersingame",{_playersingame}) + mgSetTemporaryGameData("playerstatus|%player%",false) + mgCheckCannonBattleRoundEnd() + +on join: + clear inventory of player + set gamemode of player to spectator + set {_loc} to mgGetTemporaryGameData("respawnloc") + teleport player to {_loc} + +on damage: + if victim is a player: + broadcast "%event.getCause()%" + if "%event.getCause()%" is "unknown" or "fall": + cancel event + mgCannonBattleHandleGameDeath(victim) + +on death: + if victim is a player: + wait 1 tick + force victim to respawn + wait 1 tick + mgCannonBattleHandleGameDeath(player) + +on explosion: + cancel event + event-world.createExplosion(x-coord of event-location, y-coord of event-location, z-coord of event-location, 2, false, false) + loop all blocks in radius 5 around event-location: + if loop-block is not grass block or dirt or obsidian: + set {_direction} to direction from event-location to location of loop-block + set {_e} to (event-locations's world).spawnFallingBlock(location of loop-block, loop-block.getBlockData()) + push {_e} {_direction} at speed 1 + set loop-block to air + +on respawn: + wait 1 tick + mgCannonBattleHandleGameDeath(player) + + +on break: + clear drops + if mgGetTemporaryGameData("status") is not "ingame": + cancel event + +every 1 tick: + if mgGetTemporaryGameData("status") is "ingame": + loop all players: + set {_loc} to location of loop-player + remove 1 from y-coord of {_loc} + loop blocks in radius 1.2 around {_loc}: + if loop-block is lime concrete: + set {_bloc} to location of loop-block + mgCannonBattleFloor({_bloc}) diff --git a/MINIGAMES.SK/games/GoldRush/-init.sk b/MINIGAMES.SK/games/GoldRush/-init.sk new file mode 100644 index 0000000..665b028 --- /dev/null +++ b/MINIGAMES.SK/games/GoldRush/-init.sk @@ -0,0 +1,181 @@ + +# +# ============== +# init.sk +# ============== +# init.sk is part of the MINIGAMES.SK library. +# ============== +# > GAME: GoldRush +# ============== + +on load: + wait 1 tick + mgGoldRushHandler("start") + +every 1 second: + feed all players + +import: + java.util.ArrayList + +on quit: + if mgGetTemporaryGameData("playerstatus|%player%") is true: + set {_playersingame} to mgGetTemporaryGameData("playersingame") + remove 1 from {_playersingame} + mgSetTemporaryGameData("playersingame",{_playersingame}) + mgSetTemporaryGameData("playerstatus|%player%",false) + mgCheckGoldRushRoundEnd() + +on join: + clear inventory of player + set gamemode of player to survival + set {_loc} to mgGetTemporaryGameData("respawnloc") + if mgGetTemporaryGameData("Base|%player%") is not set: + mgGoldRushGiveBaseItem(player) + teleport player to {_loc} + + +every 1 second: + loop all zombies: + if block below loop-entity is not magenta glazed terracotta: + set {_loc} to loop-entity's location + set {_gold} to metadata value "Gold" of loop-entity + drop {_gold} of gold ingot at {_loc} + remove 500 from y-coord of {_loc} + teleport loop-entity to {_loc} + else: + set {_block} to block below loop-entity + set {_loc} to location of loop-entity + set {_direction} to "%{_block}.getData()%" parsed as number + mgGoldRushFluidMovement(loop-entity,{_direction}) + +on death: + if victim is a player: + wait 1 tick + force victim to respawn + wait 1 tick + mgGoldRushHandleGameDeath(player) + +on explosion: + loop all blocks in radius 5 around event-location: + if loop-block is grass block or dirt or sandstone: + add location of loop-block to {_expblocks::*} + add loop-block.getBlockData() to {_expdata::*} + wait 1 tick + loop {_expblocks::*}: + if block at loop-value is air: + chance of 50%: + set {_direction} to direction from event-location to loop-value + set {_e} to (event-locations's world).spawnFallingBlock(loop-value, {_expdata::%loop-index%}) + push {_e} {_direction} at speed 1 + +on explosion: + cancel event + +on respawn: + wait 1 tick + mgGoldRushHandleGameDeath(player) + +on build: + if "%event.getHand()%" is "HAND": + set {_tool} to player's tool + else if "%event.getHand()%" is "OFF_HAND": + set {_tool} to player's offhand tool + set {_val} to getnbtvalue({_tool},"Placeable") + if {_val} is "true": + set {_val1} to getnbtvalue({_tool},"BaseItem") + set {_specialtool} to getnbtvalue({_tool},"Specialtool") + if {_val1} is "true": + set {_bases} to mgGetTemporaryGameData("GoldRushBases") + if {_bases} is set: + loop ...{_bases}: + if distance between loop-value and event-location <= 10: + message "%getChatPrefix()% You have to build at least 10 blocks away from other bases." + cancel event + stop + mgGoldRushPlaceBase(event-player,location of event-block) + else if {_specialtool} is "Golddrill": + if block 1 below event-block is grass block or stone: + set block 1 below event-block to event-block + set event-block to air + mgGoldRushPlaceDrill(location of event-block) + else: + cancel event + else: + if {_tool} is magenta glazed terracotta: + if block 1 below event-block is grass block or magenta glazed terracotta or stone: + set block 1 below event-block to event-blocks + set event-block to air + else: + cancel event + + else: + cancel event +on break: + cancel event +on damage: + if victim is a player: + if attacker is a player: + cancel event + +on death of zombie: + if metadata value "Gold" of victim is set: + set {_gold} to metadata value "Gold" of victim + clear drops + set {_goldaccount} to mgGetTemporaryGameData("Gold|%attacker%") + set {_goldaccount} to {_goldaccount} parsed as number + if {_goldaccount} is not set: + set {_goldaccount} to 0 + add {_gold} to {_goldaccount} + mgSetTemporaryGameData("Gold|%attacker%","%{_goldaccount}%") + set {_uuid} to uuid of attacker + add {_gold} to {cobble::%{_uuid}%} +on drop: + cancel event + +on pickup of gold ingot: + wait 1 tick + set {_picked} to number of gold ingot in event-player's inventory + set {_gold} to mgGetTemporaryGameData("Gold|%event-player%") + set {_gold} to {_gold} parsed as number + if {_gold} is not set: + set {_gold} to 0 + add {_picked} to {_gold} + mgSetTemporaryGameData("Gold|%event-player%","%{_gold}%") + remove {_picked} of gold ingot from event-player's inventory + mgAddCurrentGamePoints("GoldRush",player,"points",{_picked}) + #mgAddPlayerToplistScore("GoldRush",loop-player,%{_picked}%) + mgSetSidebarToplist("GoldRush","points",5,1) + set {_uuid} to uuid of event-player + add {_picked} to {cobble::%{_uuid}%} +on damage of villager: + if victim's helmet is set: + set {_GoldRush} to getnbtvalue(victim's helmet,"MineLoc") + if {_GoldRush} is set: + set {_loc} to getnbtvalue(victim's helmet,"MineLoc") + mgGoldRushOpenMineMenu(attacker,{_loc}) + cancel event + stop + set {_base} to getnbtvalue(victim's helmet,"Base") + if {_base} is set: + if {_base} is "%attacker%": + mgGoldRushOpenBaseMenu(attacker) + cancel event + +on rightclick on villager: + if event-entity's helmet is set: + set {_GoldRush} to getnbtvalue(event-entity's helmet,"MineLoc") + if {_GoldRush} is set: + set {_loc} to getnbtvalue(event-entity's helmet,"MineLoc") + mgGoldRushOpenMineMenu(player,{_loc}) + cancel event + stop + set {_base} to getnbtvalue(event-entity's helmet,"Base") + if {_base} is set: + if {_base} is "%player%": + mgGoldRushOpenBaseMenu(player) + cancel event +every 1 second: + mgGoldRushInformation() +every 3 seconds: + mgGoldRushSpawnGold() diff --git a/MINIGAMES.SK/games/GoldRush/config.sk b/MINIGAMES.SK/games/GoldRush/config.sk new file mode 100644 index 0000000..26a8c1b --- /dev/null +++ b/MINIGAMES.SK/games/GoldRush/config.sk @@ -0,0 +1,14 @@ +# +# ============== +# config.sk +# ============== +# config.sk is part of the MINIGAMES.SK library. +# ============== + +on load: + wait 1 tick + set {_game} to "GoldRush" + mgSetTranslation("en",{_game},"name","GoldRush") + mgSetTranslation("en",{_game},"desc","&7Connect rails from the\n&7mines to your base and vandalize\n&7your enemies to get the\n&7best gold digger.") + mgSetTranslation("en",{_game},"bossbar_countdown","Prepare yourself...") + mgSetTranslation("en",{_game},"toplist_scoreboard","&7&l | &f &7&l>> &e&l") diff --git a/MINIGAMES.SK/games/GoldRush/functions.sk b/MINIGAMES.SK/games/GoldRush/functions.sk new file mode 100644 index 0000000..100922c --- /dev/null +++ b/MINIGAMES.SK/games/GoldRush/functions.sk @@ -0,0 +1,398 @@ +# +# ============== +# functions.sk +# ============== +# functions.sk is part of the MINIGAMES.SK library. +# ============== +# > GAME: GoldRush +# ============== + +options: + islandsize: 100 + walldepth: 5 + wallheight: 40 + gametime: 600 + baseupgradeprice: 20 + upgrademultiplier: 2 + backgrounditem: gray stained glass pane + +import: + java.util.ArrayList + +function mgGoldRushSpawnGold(): + set {_drills} to mgGetTemporaryGameData("GoldDrills") + set {_drills::*} to ...{_drills} + loop {_drills::*}: + drop 1 of gold ingot at loop-value + add location at -28.5, 6, 40.5 in mgGetCurrentWorld() to {_goldrushspawns::*} + add location at -28.5, 6, -33.5 in mgGetCurrentWorld() to {_goldrushspawns::*} + add location at -38.5, 6, 14.5 in mgGetCurrentWorld() to {_goldrushspawns::*} + add location at -43.5, 6, -2.5 in mgGetCurrentWorld() to {_goldrushspawns::*} + add location at -9.5, 11, -46.5 in mgGetCurrentWorld() to {_goldrushspawns::*} + add location at 3.5, 6, -45.5 in mgGetCurrentWorld() to {_goldrushspawns::*} + add location at 19.5, 6, -43.5 in mgGetCurrentWorld() to {_goldrushspawns::*} + add location at 33.5, 6, -46.5 in mgGetCurrentWorld() to {_goldrushspawns::*} + add location at 46.5, 6, -7.5 in mgGetCurrentWorld() to {_goldrushspawns::*} + add location at 45.5, 6, 23.5 in mgGetCurrentWorld() to {_goldrushspawns::*} + add location at 22.5, 6, 44.5 in mgGetCurrentWorld() to {_goldrushspawns::*} + add location at -8.5, 6, 40.5 in mgGetCurrentWorld() to {_goldrushspawns::*} + + loop {_goldrushspawns::*}: + delete {_level} + delete {_minerfound} + set {_level} to mgGetTemporaryGameData("MineLevel|%loop-value%") + set {_level} to {_level} parsed as number + if {_level} is not set: + set {_level} to 1 + spawn 1 zombie at loop-value + set {_z} to last spawned entity + set metadata value "Gold" of {_z} to {_level} + set {_z}'s helmet to gold ore + {_z}.setAI(false) + {_z}.setSilent(true) + {_z}.setCustomNameVisible(true) + {_z}.setCustomName("&l%{_level}% Gold") + set {_z}'s tool to gold ingot + set {_z}'s offhand tool to gold ingot + set maximum health of {_z} to 1 + + + set {_minerloc} to loop-value + loop all entities in radius 0.2 around {_minerloc}: + if loop-entity is a villager: + set {_minerfound} to true + if {_minerfound} is not set: + mgGoldRushSpawnMineVillager({_minerloc},"Miner",loop-value) +function mgGoldRushFluidMovement(entity:entity,direction:number): + set {_loc} to {_entity}.getLocation().clone() + loop 10 times: + if {_direction} is 0: + remove 0.1 from z-coord of {_loc} + {_loc}.setYaw(180.01) + else if {_direction} is 1: + add 0.1 to x-coord of {_loc} + {_loc}.setYaw(-90.01) + else if {_direction} is 2: + add 0.1 to z-coord of {_loc} + {_loc}.setYaw(0.01) + else if {_direction} is 3: + remove 0.1 from x-coord of {_loc} + {_loc}.setYaw(90.01) + teleport {_entity} to {_loc} + if loop-number is 10: + if block below {_entity} is white wool: + set {_loc} to {_entity}'s location + set {_owner} to mgGetTemporaryGameData("GoldRushBase|%{_loc}%") + set {_gold} to metadata value "Gold" of {_entity} + + remove 500 from y-coord of {_loc} + teleport {_entity} to {_loc} + set {_goldaccount} to mgGetTemporaryGameData("Gold|%{_owner}%") + set {_goldaccount} to {_goldaccount} parsed as number + if {_goldaccount} is not set: + set {_goldaccount} to 0 + add {_gold} to {_goldaccount} + mgSetTemporaryGameData("Gold|%{_owner}%","%{_goldaccount}%") + set {_owner} to "%{_owner}%" parsed as player + set {_uuid} to uuid of {_owner} + add {_gold} to {cobble::%{_uuid}%} + mgAddCurrentGamePoints("GoldRush",{_owner},"points",{_gold}) + #mgAddPlayerToplistScore("GoldRush",{_owner} parsed as player,%{_gold}%) + mgSetSidebarToplist("GoldRush","points",5,1) + wait 2 ticks + +function mgGoldRushSpawnMineVillager(loc:location,name:text,mineloc:location): + loop all entities in radius 0.2 around {_loc}: + if loop-entity is a villager: + kill loop-entity + spawn villager at {_loc} + set {_villager} to last spawned entity + set {_head} to 1 of button + set {_head} to setnbtvalue({_head},"GoldRush","true") + set {_head} to setnbtvalue({_head},"MineLoc","%{_mineloc}%") + set {_villager}'s helmet to {_head} + {_villager}.setCustomName({_name}) + {_villager}.setCustomNameVisible(true) + {_villager}.setInvulnerable(true) + {_villager}.setSilent(true) + {_villager}.setAI(false) + {_villager}.setRotation(-180) + {_villager}.setVillagerType(2) + +function mgGoldRushSpawnBaseVillager(loc:location,name:text,owner:player): + loop all entities in radius 0.2 around {_loc}: + if loop-entity is a villager: + kill loop-entity + spawn villager at {_loc} + set {_villager} to last spawned entity + set {_head} to 1 of button + set {_head} to setnbtvalue({_head},"GoldRush","true") + set {_head} to setnbtvalue({_head},"Base","%{_owner}%") + set {_villager}'s helmet to {_head} + {_villager}.setCustomName({_name}) + {_villager}.setCustomNameVisible(true) + {_villager}.setInvulnerable(true) + {_villager}.setSilent(true) + {_villager}.setAI(false) + {_villager}.setRotation(-180) + {_villager}.setVillagerType(2) + + + +function mgGoldRushGiveBaseItem(player:player): + set {_item} to 1 of chest named "%{_player}%'s base" + set 1st line of lore of {_item} to "&7Place your base for this round." + set {_item} to setnbtvalue({_item},"BaseItem","true") + set {_item} to setnbtvalue({_item},"Specialtool","Base") + set {_item} to setnbtvalue({_item},"Placeable","true") + give 1 of {_item} to {_player} + +function mgGoldRushPlaceBase(player:player,loc:location): + clear {_player}'s inventory + if mgGetTemporaryGameData("Base|%{_player}%") is not set: + remove 0.5 from y-coord of {_loc} + set {_bases} to mgGetTemporaryGameData("GoldRushBases") + if {_bases} is not set: + set {_bases} to new ArrayList() + {_bases}.add({_loc}) + mgSetTemporaryGameData("GoldRushBases",{_bases}) + mgSetTemporaryGameData("GoldRushBase|%{_loc}%",{_player}) + mgSetTemporaryGameData("Base|%{_player}%",{_loc}) + mgGoldRushSpawnBaseVillager({_loc},"&l%{_player}%'s Base",{_player}) + set block at {_loc} to air + set block 1 below {_loc} to white wool + +function mgGoldRushOpenMineMenu(player:player,mineloc:text): + set {_level} to mgGetTemporaryGameData("MineLevel|%{_mineloc}%") + set {_level} to {_level} parsed as number + if {_level} is not set: + set {_level} to 1 + + opengui({_player},54,"&lMine Level %{_level}%") + loop 27 times: + setguiitem({_player},loop-number - 1,{@backgrounditem},1," ","") + + set {_slot} to 9 + loop 7 times: + add 1 to {_slot} + if {_level} >= loop-number: + setguiitem({_player},{_slot},glowing gold ingot,1,"Level %loop-number%","&7Produces &6%loop-number%&7 gold per second") + else if ({_level} + 1) is loop-number: + set {_price} to {@upgrademultiplier} * loop-number + set {_price} to {@baseupgradeprice} * {_price} + setguiitem({_player},{_slot},gold ingot,1,"Level %loop-number%","&7Click here to &6upgrade&7.\n&7Price: &6%{_price}%&7 Gold\n&7Produces &6%loop-number%&7","mgGoldRushMineUpgrade(""%{_player}%"" parsed as player,""%{_mineloc}%"")") + else: + setguiitem({_player},{_slot},gold ingot,1,"Level %loop-number%","&7Upgrade not available yet.") + +function mgGoldRushOpenBaseMenu(player:player): + opengui({_player},27,"&l%{_player}%'s Base") + loop 27 times: + setguiitem({_player},loop-number - 1,{@backgrounditem},1," ","") + + set {_price} to 10 + setguiitem({_player},10,magenta glazed terracotta,1,"","&7Price: %{_price}%\n&7Connect mines with\n&7your base villager.\n&7Build a path.","mgGoldRushShop(""%{_player}%"" parsed as player,""1 of magenta glazed terracotta"",%{_price}%)") + setguiitem({_player},11,diamond sword,1,"","&7Price: %{_price}%\n&7Kill the suppliers\n&7to get their gold.","mgGoldRushShop(""%{_player}%"" parsed as player,""1 of diamond sword"",%{_price}%)") + set {_price} to 100 + setguiitem({_player},12,gold block,1,"&rGold drill","&7Price: %{_price}%\n&7Drills gold out of the floor.","mgGoldRushShop(""%{_player}%"" parsed as player,""1 of gold block"",%{_price}%)") + +function mgGoldRushShop(player:player,item:text,price:object): + set {_item} to {_item} parsed as item + if {_item} is gold block: + set {_item}'s name to "&rGold drill" + set 1st line of lore of {_item} to "&rDrills gold out of the floor." + set 1st line of lore of {_item} to "&rDrills gold out of the floor." + set {_item} to setnbtvalue({_item},"Placeable","true") + set {_item} to setnbtvalue({_item},"Specialtool","Golddrill") + set {_item} to setnbtvalue({_item},"Golddrill","true") + set {_gold} to mgGetTemporaryGameData("Gold|%{_player}%") + set {_gold} to {_gold} parsed as number + if {_gold} is not set: + set {_gold} to 0 + + if {_gold} >= {_price}: + set {_item} to setnbtvalue({_item},"Placeable","true") + give {_item} to {_player} + remove {_price} from {_gold} + mgSetTemporaryGameData("Gold|%{_player}%",{_gold}) + else: + message "%getChatPrefix()% You only have %{_gold}% gold, you need %{_price}%." to {_player} + + +function mgGoldRushMineUpgrade(player:player,mineloc:text): + set {_level} to mgGetTemporaryGameData("MineLevel|%{_mineloc}%") + set {_level} to {_level} parsed as number + if {_level} is not set: + set {_level} to 1 + set {_price} to {_level} + 1 + set {_price} to {@upgrademultiplier} * {_price} + set {_price} to {@baseupgradeprice} * {_price} + + set {_gold} to mgGetTemporaryGameData("Gold|%{_player}%") + set {_gold} to {_gold} parsed as number + if {_gold} is not set: + set {_gold} to 0 + + if {_gold} >= {_price}: + mgSetTemporaryGameData("MineLevel|%{_mineloc}%","%{_level} + 1%") + play sound "entity.experience_orb.pickup" with volume 1 with pitch 0.7 at location of {_player} for {_player} + remove {_price} from {_gold} + mgSetTemporaryGameData("Gold|%{_player}%",{_gold}) + + else: + message "%getChatPrefix()% You only have %{_gold}% gold, you need %{_price}%." to {_player} + mgGoldRushOpenMineMenu({_player},{_mineloc}) + +function mgGoldRushInformation(): + mgSetSidebarToplist("GoldRush","points",5,1) + set {_time} to mgGetTemporaryGameData("TimeLeft") + loop all players: + set {_gold} to mgGetTemporaryGameData("Gold|%loop-player%") + set {_gold} to {_gold} parsed as number + if {_gold} is not set: + set {_gold} to 0 + send action bar "%getChatPrefix()% Gold: %{_gold}% | Time: %{_time}%" to loop-player + +function mgGoldRushPlaceDrill(loc:location): + set {_drills} to mgGetTemporaryGameData("GoldDrills") + if {_drills} is not set: + set {_drills} to new ArrayList() + {_drills}.add({_loc}) + mgSetTemporaryGameData("GoldDrills",{_drills}) + +options: + gamerounds: 1 + +# +# > Function - mgGoldRushHandler +# > Starts or stops the game depending on the parameter. +# > Parameters: +# > task, either "start" or "stop" +function mgGoldRushHandler(task:text): + if {_task} is "start": + mgSetTemporaryGameData("round",0) + mgSetTemporaryGameData("status","loading") + + loop all players: + mgSetCurrentGamePoints("GoldRush",loop-player,"points",0) + mgSetSidebarToplist("GoldRush","points",5,1) + + mgSetTemporaryGameData("playersingame",number of all players) + mgGoldRushStartNewRound() + + # + # > If the game should be stopped, use the MINIGAMES.SK function to + # > clear out any temporary data and unload the game. + if {_task} is "stop": + mgFinishGame() + +# +# > Function - mgGoldRushStartNewRound +# > Starts a new GoldRush round. +function mgGoldRushStartNewRound(): + set {_tplayers} to 0 + set {_tplayers} to number of all players + if {_tplayers} is bigger than 0: + + mgSetTemporaryGameData("playersingame",number of all players) + loop all players: + mgSetTemporaryGameData("playerstatus|%loop-player%",true) + mgSetTemporaryGameData("status","preparing") + + set {_round} to mgGetTemporaryGameData("round") + add 1 to {_round} + mgSetTemporaryGameData("round",{_round}) + + if {_round} is bigger than {@gamerounds}: + mgSpleefHandler("stop") + stop + broadcast "%getChatPrefix()% Round %{_round}%/{@gamerounds}" + + # + # > Create a fitting arena. Base size 40x40 + 2x2 per player + set {_mapsize} to 10 + number of all players + set {_mainarena} to "" + set {_mainarena} to location at 0.5, 6, 0.5 in mgGetCurrentWorld() + mgSetTemporaryGameData("respawnloc",location at 0.5, 6, 0.5 in mgGetCurrentWorld()) + + set {_xstart} to -50000 + set {_zstart} to -50000 + + loop {_round} times: + add 50000 to {_xstart} + add 50000 to {_zstart} + + loop all players: + add 1 to {_playerloop} + set {_islandloc} to location at {_xstart}, 20, {_zstart} in mgGetCurrentWorld() + mgSetTemporaryGameData("Island|%loop-player%",{_islandloc}) + mgSetTemporaryGameData("Islandloc|%{_xstart}%|%{_zstart}%",true) + set {_spawnloc} to {_islandloc} + set y-coord of {_spawnloc} to 21 + mgSetTemporaryGameData("Respawnloc|%loop-player%",{_spawnloc}) + remove 3 from z-coord of {_spawnloc} + + # + # > Create a countdown that lets the players wait for 5 seconds. + mgDisplayBossbarCountdown(10,"GoldRush","bossbar_countdown",null) + + apply resistance 12 without particles to all players for 1 seconds + apply invisibility 1 without particles to all players for 0.1 seconds + set gamemode of all players to survival + + set {_loc} to mgGetTemporaryGameData("respawnloc") + teleport all players to {_loc} + clear inventory of all players + loop all players: + mgGoldRushGiveBaseItem(loop-player) + + # + # > Give the items to the players. + mgSetTemporaryGameData("status","ingame") + set {_rending} to {@gametime} + while mgGetTemporaryGameData("status") is "ingame": + add 1 to {_roundtime} + remove 1 from {_rending} + mgSetTemporaryGameData("TimeLeft",{_rending}) + + loop all players: + if gamemode of loop-player is survival: + if -1 is bigger than y-coordinate of loop-player: + damage loop-player by 5 hearts + if {_roundtime} is bigger than {@gametime}: + mgSetTemporaryGameData("status","exitround") + + mgGoldRushStartNewRound() + wait 1 second + + else: + broadcast "%getChatPrefix()% Not enough players." + mgSpleefHandler("stop") + +# +# > Function - mgCheckGoldRushRoundEnd +# > Checks if the GoldRush round should be stopped. +function mgCheckGoldRushRoundEnd(): + if mgGetTemporaryGameData("status") is "ingame": + if mgGetTemporaryGameData("playersingame") is smaller than 2: + loop all players: + if loop-player's gamemode is survival: + mgAddPlayerToplistWin("GoldRush",loop-player,1) + broadcast "%getChatPrefix()% %loop-player% has won this round." + mgSetTemporaryGameData("status","preparing") + mgGoldRushStartNewRound() + +# +# > Function - mgGoldRushHandleGameDeath +# > If a player died in GoldRush, do everything needed. +# > Parameters: +# > the player who died +function mgGoldRushHandleGameDeath(player:player): + set {_loc} to mgGetTemporaryGameData("Respawnloc|%{_player}%") + teleport {_player} to {_loc} + +function mgGoldRushFloor(loc:location): + set block at {_loc} to yellow concrete + wait 5 ticks + set block at {_loc} to red concrete + wait 5 ticks + set block at {_loc} to air diff --git a/MINIGAMES.SK/games/GoldRush/maps/1/data/villages.dat b/MINIGAMES.SK/games/GoldRush/maps/1/data/villages.dat new file mode 100644 index 0000000..36614ee Binary files /dev/null and b/MINIGAMES.SK/games/GoldRush/maps/1/data/villages.dat differ diff --git a/MINIGAMES.SK/games/GoldRush/maps/1/level.dat b/MINIGAMES.SK/games/GoldRush/maps/1/level.dat new file mode 100644 index 0000000..6cb7402 Binary files /dev/null and b/MINIGAMES.SK/games/GoldRush/maps/1/level.dat differ diff --git a/MINIGAMES.SK/games/GoldRush/maps/1/level.dat_old b/MINIGAMES.SK/games/GoldRush/maps/1/level.dat_old new file mode 100644 index 0000000..c1ed4ce Binary files /dev/null and b/MINIGAMES.SK/games/GoldRush/maps/1/level.dat_old differ diff --git a/MINIGAMES.SK/games/GoldRush/maps/1/poi/r.-1.-1.mca b/MINIGAMES.SK/games/GoldRush/maps/1/poi/r.-1.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/GoldRush/maps/1/poi/r.-1.-1.mca differ diff --git a/MINIGAMES.SK/games/GoldRush/maps/1/poi/r.-1.0.mca b/MINIGAMES.SK/games/GoldRush/maps/1/poi/r.-1.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/GoldRush/maps/1/poi/r.-1.0.mca differ diff --git a/MINIGAMES.SK/games/GoldRush/maps/1/poi/r.0.-1.mca b/MINIGAMES.SK/games/GoldRush/maps/1/poi/r.0.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/GoldRush/maps/1/poi/r.0.-1.mca differ diff --git a/MINIGAMES.SK/games/GoldRush/maps/1/poi/r.0.0.mca b/MINIGAMES.SK/games/GoldRush/maps/1/poi/r.0.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/GoldRush/maps/1/poi/r.0.0.mca differ diff --git a/MINIGAMES.SK/games/GoldRush/maps/1/region/r.-1.-1.mca b/MINIGAMES.SK/games/GoldRush/maps/1/region/r.-1.-1.mca new file mode 100644 index 0000000..d62b124 Binary files /dev/null and b/MINIGAMES.SK/games/GoldRush/maps/1/region/r.-1.-1.mca differ diff --git a/MINIGAMES.SK/games/GoldRush/maps/1/region/r.-1.0.mca b/MINIGAMES.SK/games/GoldRush/maps/1/region/r.-1.0.mca new file mode 100644 index 0000000..1b1930a Binary files /dev/null and b/MINIGAMES.SK/games/GoldRush/maps/1/region/r.-1.0.mca differ diff --git a/MINIGAMES.SK/games/GoldRush/maps/1/region/r.0.-1.mca b/MINIGAMES.SK/games/GoldRush/maps/1/region/r.0.-1.mca new file mode 100644 index 0000000..221399c Binary files /dev/null and b/MINIGAMES.SK/games/GoldRush/maps/1/region/r.0.-1.mca differ diff --git a/MINIGAMES.SK/games/GoldRush/maps/1/region/r.0.0.mca b/MINIGAMES.SK/games/GoldRush/maps/1/region/r.0.0.mca new file mode 100644 index 0000000..fe7884b Binary files /dev/null and b/MINIGAMES.SK/games/GoldRush/maps/1/region/r.0.0.mca differ diff --git a/MINIGAMES.SK/games/GoldRush/maps/1/uid.dat b/MINIGAMES.SK/games/GoldRush/maps/1/uid.dat new file mode 100644 index 0000000..d91691a --- /dev/null +++ b/MINIGAMES.SK/games/GoldRush/maps/1/uid.dat @@ -0,0 +1 @@ +&Op \ No newline at end of file diff --git a/MINIGAMES.SK/games/Trainmasters/-init.sk b/MINIGAMES.SK/games/Trainmasters/-init.sk new file mode 100644 index 0000000..c2c5d25 --- /dev/null +++ b/MINIGAMES.SK/games/Trainmasters/-init.sk @@ -0,0 +1,111 @@ + +# +# ============== +# init.sk +# ============== +# init.sk is part of the MINIGAMES.SK library. +# ============== +# > GAME: Trainmasters +# ============== + +on load: + wait 1 tick + mgTrainmastersHandler("start") + +every 1 second: + feed all players + mgTrainmastersProduceRail() + mgTrainmastersUpdateSidebarStats() + +import: + java.util.ArrayList + org.bukkit.event.player.PlayerInteractAtEntityEvent + org.bukkit.event.player.PlayerArmorStandManipulateEvent + +on quit: + if mgGetTemporaryGameData("playerstatus|%player%") is true: + set {_playersingame} to mgGetTemporaryGameData("playersingame") + remove 1 from {_playersingame} + mgSetTemporaryGameData("playersingame",{_playersingame}) + mgSetTemporaryGameData("playerstatus|%player%",false) + mgCheckTrainmastersRoundEnd() + + +on join: + clear inventory of player + set gamemode of player to survival + set {_loc} to mgGetTemporaryGameData("respawnloc") + wait 5 ticks + teleport player to {_loc} + mgTrainmastersGiveTools(player) + +on death: + if victim is a player: + wait 1 tick + force victim to respawn + wait 1 tick + mgTrainmastersHandleGameDeath(player) + +on explosion: + loop all blocks in radius 5 around event-location: + if loop-block is iron ore or coal ore or oak log or oak leaves or stone: + loop-block.breakNaturally() + +on explosion: + cancel event + +on respawn: + wait 1 tick + mgTrainmastersHandleGameDeath(player) + +on spawn of armor stand: + wait 1 tick + if event-entity's boots is barrier named "wagoncontrol": + set metadata value "lastwagonfront" of getMetadataBlock() to event-entity + if event-entity's leggings is water bucket: + set metadata value "waterwagon" of getMetadataBlock() to event-entity + if event-entity's leggings is coal: + set metadata value "coalwagon" of getMetadataBlock() to event-entity + if event-entity's leggings is rail: + set metadata value "producerwagon" of getMetadataBlock() to event-entity + if event-entity's leggings is oak log: + set metadata value "storagewagon" of getMetadataBlock() to event-entity + +on click: + if target block is water: + cancel event + set target block to air + give 1 of light blue concrete named "&rWater" to player + +on PlayerArmorStandManipulateEvent: + event.setCancelled(true) + +on break: + repair player's tool + if event-block is grass or dirt: + cancel event + if event-block is rail: + if block 1 below event-block is not grass block or dirt: + cancel event + + +on PlayerInteractAtEntityEvent: + set {_player} to event.getPlayer() + set {_entity} to event.getRightClicked() + if "%{_entity}%" is "armor stand": + set {_checkitem} to {_entity}'s chestplate + if display name of {_entity}'s chestplate is "clickevent": + if 1st line of lore of {_entity}'s chestplate is "storage": + mgTrainmastersHandleStorageClick({_player},{_entity}) + if 1st line of lore of {_entity}'s chestplate is "water": + mgTrainmastersHandleWaterClick({_player},{_entity}) + if 1st line of lore of {_entity}'s chestplate is "coal": + mgTrainmastersHandleCoalClick({_player},{_entity}) + if 1st line of lore of {_entity}'s chestplate is "producer": + mgTrainmastersHandleProducerClick({_player},{_entity}) + event.setCancelled(true) + +on damage: + if victim is a player: + if attacker is a player: + cancel event diff --git a/MINIGAMES.SK/games/Trainmasters/config.sk b/MINIGAMES.SK/games/Trainmasters/config.sk new file mode 100644 index 0000000..c502cdc --- /dev/null +++ b/MINIGAMES.SK/games/Trainmasters/config.sk @@ -0,0 +1,66 @@ +# +# ============== +# config.sk +# ============== +# config.sk is part of the MINIGAMES.SK library. +# ============== + +on load: + wait 1 tick + set {_game} to "Trainmasters" + mgSetTranslation("en",{_game},"name","TrainMasters") + mgSetTranslation("en",{_game},"desc","&7Help the train move further\nhow far will you get?") + mgSetTranslation("en",{_game},"bossbar_countdown","Prepare yourself...") + mgSetTranslation("en",{_game},"toplist_scoreboard","&7&l | &f &7&l>> &e&l") + mgSetTranslation("en",{_game},"train_distance","&7&lDriven Blocks &7&l>> &e&l") + mgSetTranslation("en",{_game},"train_coal","&7&lCoal &7&l>> &e&l/") + mgSetTranslation("en",{_game},"train_water","&7&lWater &7&l>> &e&l/") + + delete {MG::%{_game}%::chances::*} + delete {MG::%{_game}%::actions::*} + delete {MG::%{_game}%::hillchances::*} + delete {MG::%{_game}%::hillblocks::*} + delete {MG::%{_game}%::floorchances::*} + delete {MG::%{_game}%::floorblocks::*} + + + add 0.5 to {MG::%{_game}%::chances::*} + add "smallpond" to {MG::%{_game}%::actions::*} + + add 1.5 to {MG::%{_game}%::chances::*} + add "tree" to {MG::%{_game}%::actions::*} + + add 0.5 to {MG::%{_game}%::chances::*} + add "bigtree" to {MG::%{_game}%::actions::*} + + add 0.4 to {MG::%{_game}%::chances::*} + add "smallhill" to {MG::%{_game}%::actions::*} + + add 0.05 to {MG::%{_game}%::chances::*} + add "mediumhill" to {MG::%{_game}%::actions::*} + + add 0.01 to {MG::%{_game}%::chances::*} + add "bighill" to {MG::%{_game}%::actions::*} + + add 50 to {MG::%{_game}%::chances::*} + add "floor" to {MG::%{_game}%::actions::*} + + add 40 to {MG::%{_game}%::hillchances::*} + add coal ore to {MG::%{_game}%::hillblocks::*} + add 40 to {MG::%{_game}%::hillchances::*} + add iron ore to {MG::%{_game}%::hillblocks::*} + add 0.05 to {MG::%{_game}%::hillchances::*} + add diamond ore to {MG::%{_game}%::hillblocks::*} + + add 3 to {MG::%{_game}%::floorchances::*} + add dandelion to {MG::%{_game}%::floorblocks::*} + add 3 to {MG::%{_game}%::floorchances::*} + add poppy to {MG::%{_game}%::floorblocks::*} + add 3 to {MG::%{_game}%::floorchances::*} + add oxeye daisy to {MG::%{_game}%::floorblocks::*} + add 50 to {MG::%{_game}%::floorchances::*} + add short grass to {MG::%{_game}%::floorblocks::*} + add 10 to {MG::%{_game}%::floorchances::*} + add tall grass to {MG::%{_game}%::floorblocks::*} + + \ No newline at end of file diff --git a/MINIGAMES.SK/games/Trainmasters/functions.sk b/MINIGAMES.SK/games/Trainmasters/functions.sk new file mode 100644 index 0000000..f178669 --- /dev/null +++ b/MINIGAMES.SK/games/Trainmasters/functions.sk @@ -0,0 +1,121 @@ +# +# ============== +# functions.sk +# ============== +# functions.sk is part of the MINIGAMES.SK library. +# ============== +# > GAME: Trainmasters +# ============== + +options: + gametime: 100000 + backgrounditem: gray stained glass pane + +options: + gamerounds: 1 + +# +# > Function - mgTrainmastersHandler +# > Starts or stops the game depending on the parameter. +# > Parameters: +# > task, either "start" or "stop" +function mgTrainmastersHandler(task:text): + if {_task} is "start": + mgSetTemporaryGameData("round",0) + mgSetTemporaryGameData("status","loading") + + + mgSetTemporaryGameData("playersingame",number of all players) + mgTrainmastersStartNewRound() + + # + # > If the game should be stopped, use the MINIGAMES.SK function to + # > clear out any temporary data and unload the game. + if {_task} is "stop": + vehiclesKillAllVehicles() + mgFinishGame() + +# +# > Function - mgTrainmastersStartNewRound +# > Starts a new Trainmasters round. +function mgTrainmastersStartNewRound(): + set {_tplayers} to 0 + set {_tplayers} to number of all players + if {_tplayers} is bigger than 0: + + mgSetTemporaryGameData("playersingame",number of all players) + loop all players: + mgSetTemporaryGameData("playerstatus|%loop-player%",true) + mgSetTemporaryGameData("status","preparing") + + set {_round} to mgGetTemporaryGameData("round") + add 1 to {_round} + mgSetTemporaryGameData("round",{_round}) + + if {_round} is bigger than {@gamerounds}: + mgSpleefHandler("stop") + stop + + mgSetTemporaryGameData("respawnloc",location at -4, 8, -6 in mgGetCurrentWorld()) + + + # + # > Create a countdown that lets the players wait for 5 seconds. + mgDisplayBossbarCountdown(10,"Trainmasters","bossbar_countdown",null) + + apply resistance 12 without particles to all players for 1 seconds + apply invisibility 1 without particles to all players for 0.1 seconds + set gamemode of all players to survival + + set {_loc} to mgGetTemporaryGameData("respawnloc") + teleport all players to {_loc} + loop all players: + mgTrainmastersGiveTools(loop-player) + + set {_pitch} to 0.7 + loop 10 times: + add 0.1 to {_pitch} + loop all players: + play sound "block.note_block.pling" with volume 0.5 with pitch {_pitch} at loop-player's location for loop-player + wait 1 second + loop all players: + play sound "block.note_block.pling" with volume 0.5 with pitch 2 at loop-player's location for loop-player + + mgTrainmastersSummonTrain() + + # + # > Give the items to the players. + mgSetTemporaryGameData("status","ingame") + set {_rending} to {@gametime} + while mgGetTemporaryGameData("status") is "ingame": + add 1 to {_roundtime} + remove 1 from {_rending} + mgSetTemporaryGameData("TimeLeft",{_rending}) + + if {_roundtime} is bigger than {@gametime}: + mgSetTemporaryGameData("status","exitround") + + mgTrainmastersStartNewRound() + wait 1 second + + else: + broadcast "%getChatPrefix()% Not enough players." + mgSpleefHandler("stop") + +# +# > Function - mgCheckTrainmastersRoundEnd +# > Checks if the Trainmasters round should be stopped. +function mgCheckTrainmastersRoundEnd(): + if mgGetTemporaryGameData("status") is "ingame": + if mgGetTemporaryGameData("playersingame") is smaller than 1: + mgTrainmastersStartNewRound() + +# +# > Function - mgTrainmastersHandleGameDeath +# > If a player died in Trainmasters, do everything needed. +# > Parameters: +# > the player who died +function mgTrainmastersHandleGameDeath(player:player): + set {_loc} to mgGetTemporaryGameData("respawnloc") + mgTrainmastersGiveTools({_player}) + teleport {_player} to {_loc} diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/data/raids.dat b/MINIGAMES.SK/games/Trainmasters/maps/1/data/raids.dat new file mode 100644 index 0000000..117d053 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/data/raids.dat differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/data/villages.dat b/MINIGAMES.SK/games/Trainmasters/maps/1/data/villages.dat new file mode 100644 index 0000000..9d22b67 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/data/villages.dat differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/level.dat b/MINIGAMES.SK/games/Trainmasters/maps/1/level.dat new file mode 100644 index 0000000..802a680 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/level.dat differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/level.dat_old b/MINIGAMES.SK/games/Trainmasters/maps/1/level.dat_old new file mode 100644 index 0000000..401cfd4 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/level.dat_old differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.-1.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.-1.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.-1.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.-1.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.-1.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.-1.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.0.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.0.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.0.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.0.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.0.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.0.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.1.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.1.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.1.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.1.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.1.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.1.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.10.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.10.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.10.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.10.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.10.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.10.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.11.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.11.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.11.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.11.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.11.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.11.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.12.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.12.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.12.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.12.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.12.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.12.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.13.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.13.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.13.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.13.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.13.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.13.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.14.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.14.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.14.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.14.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.14.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.14.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.15.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.15.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.15.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.15.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.15.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.15.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.16.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.16.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.16.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.16.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.16.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.16.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.17.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.17.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.17.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.17.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.17.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.17.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.18.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.18.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.18.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.18.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.18.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.18.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.2.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.2.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.2.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.2.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.2.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.2.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.3.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.3.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.3.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.3.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.3.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.3.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.4.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.4.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.4.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.4.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.4.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.4.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.5.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.5.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.5.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.5.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.5.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.5.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.6.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.6.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.6.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.6.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.6.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.6.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.7.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.7.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.7.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.7.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.7.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.7.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.8.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.8.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.8.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.8.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.8.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.8.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.9.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.9.-1.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.9.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.9.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.9.0.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/poi/r.9.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.-1.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.-1.-1.mca new file mode 100644 index 0000000..90e8652 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.-1.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.-1.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.-1.0.mca new file mode 100644 index 0000000..613cd17 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.-1.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.0.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.0.-1.mca new file mode 100644 index 0000000..d3f21ce Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.0.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.0.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.0.0.mca new file mode 100644 index 0000000..af9c5f4 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.0.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.1.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.1.-1.mca new file mode 100644 index 0000000..bb3a240 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.1.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.1.-2.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.1.-2.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.1.-2.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.1.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.1.0.mca new file mode 100644 index 0000000..11cde29 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.1.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.10.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.10.-1.mca new file mode 100644 index 0000000..5187e38 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.10.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.10.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.10.0.mca new file mode 100644 index 0000000..a79da2e Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.10.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.11.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.11.-1.mca new file mode 100644 index 0000000..736dad4 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.11.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.11.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.11.0.mca new file mode 100644 index 0000000..59a22b7 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.11.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.12.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.12.-1.mca new file mode 100644 index 0000000..8c36ae5 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.12.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.12.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.12.0.mca new file mode 100644 index 0000000..ae007e8 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.12.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.13.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.13.-1.mca new file mode 100644 index 0000000..bf8e340 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.13.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.13.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.13.0.mca new file mode 100644 index 0000000..713959e Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.13.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.14.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.14.-1.mca new file mode 100644 index 0000000..376fada Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.14.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.14.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.14.0.mca new file mode 100644 index 0000000..84a5b98 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.14.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.15.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.15.-1.mca new file mode 100644 index 0000000..a8429f7 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.15.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.15.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.15.0.mca new file mode 100644 index 0000000..6483cb2 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.15.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.16.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.16.-1.mca new file mode 100644 index 0000000..d989a71 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.16.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.16.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.16.0.mca new file mode 100644 index 0000000..7673d9c Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.16.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.17.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.17.-1.mca new file mode 100644 index 0000000..5883324 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.17.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.17.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.17.0.mca new file mode 100644 index 0000000..58dc23f Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.17.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.18.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.18.-1.mca new file mode 100644 index 0000000..70691fa Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.18.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.18.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.18.0.mca new file mode 100644 index 0000000..2bd3aab Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.18.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.2.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.2.-1.mca new file mode 100644 index 0000000..cf00ee5 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.2.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.2.-2.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.2.-2.mca new file mode 100644 index 0000000..6d17cf9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.2.-2.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.2.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.2.0.mca new file mode 100644 index 0000000..3104bb8 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.2.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.3.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.3.-1.mca new file mode 100644 index 0000000..ade46c0 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.3.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.3.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.3.0.mca new file mode 100644 index 0000000..f900682 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.3.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.4.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.4.-1.mca new file mode 100644 index 0000000..27c20eb Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.4.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.4.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.4.0.mca new file mode 100644 index 0000000..6005553 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.4.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.5.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.5.-1.mca new file mode 100644 index 0000000..e59f721 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.5.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.5.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.5.0.mca new file mode 100644 index 0000000..fb01a30 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.5.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.6.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.6.-1.mca new file mode 100644 index 0000000..e135c73 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.6.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.6.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.6.0.mca new file mode 100644 index 0000000..54d7109 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.6.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.7.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.7.-1.mca new file mode 100644 index 0000000..e3a5ed7 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.7.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.7.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.7.0.mca new file mode 100644 index 0000000..85e89eb Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.7.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.8.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.8.-1.mca new file mode 100644 index 0000000..75c811b Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.8.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.8.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.8.0.mca new file mode 100644 index 0000000..1c7cedc Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.8.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.9.-1.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.9.-1.mca new file mode 100644 index 0000000..1484bf6 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.9.-1.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.9.0.mca b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.9.0.mca new file mode 100644 index 0000000..dcd686c Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/region/r.9.0.mca differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/session.lock b/MINIGAMES.SK/games/Trainmasters/maps/1/session.lock new file mode 100644 index 0000000..60867e9 Binary files /dev/null and b/MINIGAMES.SK/games/Trainmasters/maps/1/session.lock differ diff --git a/MINIGAMES.SK/games/Trainmasters/maps/1/uid.dat b/MINIGAMES.SK/games/Trainmasters/maps/1/uid.dat new file mode 100644 index 0000000..bd8d4af --- /dev/null +++ b/MINIGAMES.SK/games/Trainmasters/maps/1/uid.dat @@ -0,0 +1 @@ +ERA \ No newline at end of file diff --git a/MINIGAMES.SK/games/Trainmasters/strain.sk b/MINIGAMES.SK/games/Trainmasters/strain.sk new file mode 100644 index 0000000..20128aa --- /dev/null +++ b/MINIGAMES.SK/games/Trainmasters/strain.sk @@ -0,0 +1,860 @@ + +options: + trainloc: location(0.0, 7.5, -0.5, mgGetCurrentWorld()) + +import: + org.bukkit.event.player.PlayerArmorStandManipulateEvent + org.bukkit.WorldBorder + +function mgTrainmastersGiveTools(player:player): + clear {_player}'s inventory + set slot 0 of {_player}'s inventory to iron pickaxe + set slot 1 of {_player}'s inventory to iron axe + message "%getChatPrefix()% ---------------------------------------" to {_player} + message "%getChatPrefix()% Drive the train as far as possible." to {_player} + message "%getChatPrefix()% Each block is one score point for everyone." to {_player} + message "%getChatPrefix()% Fill the train iron and logs to get rails." to {_player} + message "%getChatPrefix()% Use rightclick to load and unload the train." to {_player} + message "%getChatPrefix()% If the train derails or has no coal" to {_player} + message "%getChatPrefix()% or water, the game is over." to {_player} + message "%getChatPrefix()% (Water can be obtained by clicking on it)" to {_player} + message "%getChatPrefix()% ---------------------------------------" to {_player} + message "%getChatPrefix()% Bringe den Zug so weit wie möglich." to {_player} + message "%getChatPrefix()% Jeder Block vorwärts ist ein Punkt." to {_player} + message "%getChatPrefix()% Fülle den Zug mit Eisen & Stämmen für Gleise." to {_player} + message "%getChatPrefix()% Verwende rechtsklick zum be- & entladen." to {_player} + message "%getChatPrefix()% Wenn der Zug entgleist oder keine Kohle" to {_player} + message "%getChatPrefix()% oder Wasser mehr hat, ist das Spiel vorbei." to {_player} + message "%getChatPrefix()% (Wasser erhält man, indem man darauf klickt)" to {_player} + message "%getChatPrefix()% ---------------------------------------" to {_player} +function mgTrainmastersUpdateSidebarStats(): + set {_distance} to mgGetTemporaryGameData("traindistance") + if {_distance} is not set: + set {_distance} to 0 + if {_distance} is smaller than 0: + set {_distance} to 0 + set {_placeholder} to HashMap() + {_placeholder}.put("",{_distance}) + mgSetGlobalSidebarSlotContent(5,"Trainmasters","train_distance",{_placeholder}) + +function mgTrainmastersHandleProducerClick(player:player,vehiclepart:entity): + set {_eventitem} to rail + set {_vehicleuuid} to metadata value "vehicles.sk|vehicleuuid" of {_vehiclepart} + set {_alivevehicles} to vehiclesGetTmpData("alivevehicles") + loop ...{_alivevehicles}.get({_vehicleuuid}).get("parts"): + if loop-value.get("part")'s leggings is {_eventitem}: + set {_part} to loop-value.get("part") + set {_storageid} to 1st line of lore of {_part}'s leggings + set {_storageparts::%{_storageid}%} to loop-value.get("part") + + loop {_storageparts::*}: + if loop-value's helmet is rail: + add 1 of rail to {_player}'s inventory + set loop-value's helmet to air + + +function mgTrainmastersHandleWaterClick(player:player,vehiclepart:entity): + if {_player}'s tool is light blue concrete: + set {_alivevehicles} to vehiclesGetTmpData("alivevehicles") + set {_eventitem} to water bucket + set {_vehicleuuid} to metadata value "vehicles.sk|vehicleuuid" of {_vehiclepart} + loop ...{_alivevehicles}.get({_vehicleuuid}).get("parts"): + if loop-value.get("part")'s leggings is {_eventitem}: + set {_currentwater} to 1st line of lore of loop-value.get("part")'s leggings parsed as number + set {_maxwater} to 2nd line of lore of loop-value.get("part")'s leggings parsed as number + if {_currentwater} <= {_maxwater}: + if {_player} has 1 of light blue concrete: + add 1 to {_currentwater} + remove 1 light blue concrete from {_player}'s inventory + set {_item} to loop-value.get("part")'s leggings + set 1st line of lore of {_item} to "%{_currentwater}%" + set loop-value.get("part")'s leggings to {_item} + set {_bar} to mgTrainmastersCreateStatusBar({_maxwater},{_currentwater},"&b&l","&7&l","|") + loop-value.get("part").setCustomName("&7[%{_bar}%&7]") + stop + +function mgTrainmastersHandleCoalClick(player:player,vehiclepart:entity): + if {_player}'s tool is coal: + set {_alivevehicles} to vehiclesGetTmpData("alivevehicles") + set {_eventitem} to coal + set {_vehicleuuid} to metadata value "vehicles.sk|vehicleuuid" of {_vehiclepart} + loop ...{_alivevehicles}.get({_vehicleuuid}).get("parts"): + if loop-value.get("part")'s leggings is {_eventitem}: + set {_currentcoal} to 1st line of lore of loop-value.get("part")'s leggings parsed as number + set {_maxcoal} to 2nd line of lore of loop-value.get("part")'s leggings parsed as number + if {_currentcoal} <= {_maxcoal}: + if {_player} has 1 of coal: + add 1 to {_currentcoal} + remove 1 coal from {_player}'s inventory + set {_item} to loop-value.get("part")'s leggings + set 1st line of lore of {_item} to "%{_currentcoal}%" + set loop-value.get("part")'s leggings to {_item} + set {_bar} to mgTrainmastersCreateStatusBar({_maxcoal},{_currentcoal},"&0&l","&7&l","|") + loop-value.get("part").setCustomName("&7[%{_bar}%&7]") + stop + +function mgTrainmastersUseCoal(): + set {_coalwagon} to metadata value "coalwagon" of getMetadataBlock() + set {_currentcoal} to 1st line of lore of {_coalwagon}'s leggings parsed as number + set {_maxcoal} to 2nd line of lore of {_coalwagon}'s leggings parsed as number + remove 0.05 from {_currentcoal} + if {_currentcoal} is smaller than 0: + set {_currentcoal} to 0 + set {_locomotive} to mgGetTemporaryGameData("locomotive") + set block at {_locomotive} to air + broadcast "%getChatPrefix()% The locomotive ran out of coal." + set 1st line of lore of {_coalwagon}'s leggings to "%{_currentcoal}%" + set {_bar} to mgTrainmastersCreateStatusBar({_maxcoal},{_currentcoal},"&0&l","&7&l","|") + {_coalwagon}.setCustomName("&7[%{_bar}%&7]") + set {_placeholder} to HashMap() + {_placeholder}.put("","%{_currentcoal}%") + {_placeholder}.put("","%{_maxcoal}%") + mgSetGlobalSidebarSlotContent(6,"Trainmasters","train_coal",{_placeholder}) + + +function mgTrainmastersUseWater(): + set {_waterwagon} to metadata value "waterwagon" of getMetadataBlock() + set {_currentwater} to 1st line of lore of {_waterwagon}'s leggings parsed as number + set {_maxwater} to 2nd line of lore of {_waterwagon}'s leggings parsed as number + remove 0.05 from {_currentwater} + if {_currentwater} is smaller than 0: + set {_currentwater} to 0 + set {_locomotive} to mgGetTemporaryGameData("locomotive") + set block at {_locomotive} to air + broadcast "%getChatPrefix()% The locomotive ran out of water." + set 1st line of lore of {_waterwagon}'s leggings to "%{_currentwater}%" + set {_bar} to mgTrainmastersCreateStatusBar({_maxwater},{_currentwater},"&b&l","&7&l","|") + {_waterwagon}.setCustomName("&7[%{_bar}%&7]") + set {_placeholder} to HashMap() + {_placeholder}.put("","%{_currentwater}%") + {_placeholder}.put("","%{_maxwater}%") + mgSetGlobalSidebarSlotContent(7,"Trainmasters","train_water",{_placeholder}) + + +function mgTrainmastersHandleStorageClick(player:player,vehiclepart:entity): + if {_player}'s tool is oak log or iron ore: + if {_player}'s tool is oak log: + set {_eventitem} to oak log + else if {_player}'s tool is iron ore: + set {_eventitem} to iron ore + set {_vehicleuuid} to metadata value "vehicles.sk|vehicleuuid" of {_vehiclepart} + set {_alivevehicles} to vehiclesGetTmpData("alivevehicles") + loop ...{_alivevehicles}.get({_vehicleuuid}).get("parts"): + if loop-value.get("part")'s leggings is {_eventitem}: + set {_part} to loop-value.get("part") + set {_storageid} to 1st line of lore of {_part}'s leggings + set {_storageparts::%{_storageid}%} to loop-value.get("part") + loop {_storageparts::*}: + if loop-value's helmet is not {_eventitem}: + if {_player} has 1 of {_eventitem}: + remove 1 of {_eventitem} from {_player}'s inventory + set loop-value's helmet to {_eventitem} + +function mgTrainmastersCreateStatusBar(max:number,currently:number,filledcolor:text="&f",emptycolor:text="&7",statussymbol:text="|") :: text: + set {_bar} to "" + loop {_max} times: + if loop-number <= {_currently}: + set {_bar} to "%{_bar}%%{_filledcolor}%%{_statussymbol}%" + else: + set {_bar} to "%{_bar}%%{_emptycolor}%%{_statussymbol}%" + return {_bar} + +function mgTrainmastersCreateResources(): + set {_distance} to mgGetTemporaryGameData("traindistance") + set {_waituntildistancereached} to mgGetTemporaryGameData("distanceuntilresourcecreate") + if {_waituntildistancereached} is not set: + mgSetTemporaryGameData("distanceuntilresourcecreate",0) + set {_waituntildistancereached} to 0 + # + # > If the distance is set, always generate 50 blocks to x-coordinate. + if {_distance} is set: + if {_distance} >= {_waituntildistancereached}: + add 50 to {_waituntildistancereached} + mgSetTemporaryGameData("distanceuntilresourcecreate",{_waituntildistancereached}) + set {_startx} to {_waituntildistancereached} + set {_endx} to {_startx} + 50 + set {_startz} to 14.5 + set {_endz} to -14.5 + set {_xdiff} to difference between {_startx} and {_endx} + set {_zdiff} to difference between {_startz} and {_endz} + loop {_xdiff} times: + loop {_zdiff} times: + delete {_success} + loop {MG::Trainmasters::chances::*}: + if {_success} is not set: + chance of loop-value-3%: + mgTrainmastersCreateResource({MG::Trainmasters::actions::%loop-index%},loop-number-1 + {_startx},{_endz} + loop-number-2) + set {_success} to true +import: + org.bukkit.TreeType +function mgTrainmastersCreateResource(action:text,x:number,z:number): + set {_world} to mgGetCurrentWorld() + set {_loc} to location({_x}, 8, {_z}, {_world}) + if {_action} is "tree": + if block 1 below {_loc} is grass block or dirt: + loop all blocks in radius 2 around {_loc}: + if loop-block is oak log: + stop + {_world}.generateTree({_loc}, TreeType.TREE!) + if {_action} is "bigtree": + if block 1 below {_loc} is grass block or dirt: + loop all blocks in radius 2 around {_loc}: + if loop-block is oak log: + stop + {_world}.generateTree({_loc}, TreeType.BIG_TREE!) + if {_action} is "floor": + if block 1 below {_loc} is grass block or dirt: + if block at {_loc} is air: + loop {MG::Trainmasters::floorchances::*}: + if {_chance} is not set: + chance of loop-value%: + set {_chance} to true + set {_block} to {MG::Trainmasters::floorblocks::%loop-index%} + if {_block} is tall grass: + add 1.1 to y-coord of {_loc} + set block at {_loc} to {_block} + + if {_action} is "smallhill" or "mediumhill" or "bighill": + if {_action} is "smallhill": + set {_radius} to 3 + else if {_action} is "mediumhill": + set {_radius} to 6 + else if {_action} is "bighill": + set {_radius} to 10 + loop all blocks in radius {_radius} around {_loc}: + if block 1 below loop-block is not water or air or oak leaves or short grass or tall grass or dandelion or poppy or oxeye daisy: + if loop-block is not oak leaves or oak log or grass block or dirt or short grass or tall grass or dandelion or poppy or oxeye daisy: + delete {_chance} + loop {MG::Trainmasters::hillchances::*}: + if {_chance} is not set: + chance of loop-value-2%: + set {_chance} to true + set loop-block to {MG::Trainmasters::hillblocks::%loop-index%} + + if {_action} is "smallpond": + loop all blocks in radius 3 around {_loc}: + if loop-block is not air or grass block or dirt or short grass or tall grass: + stop + loop all blocks in radius 3 around {_loc}: + if loop-block is grass block or dirt: + set loop-block to water + if loop-block is short grass or tall grass: + set loop-block to air + set block 1 above loop-block to air + +function mgTrainmastersProduceRail(): + set {_eventitem} to rail + set {_vehiclepart} to metadata value "producerwagon" of getMetadataBlock() + if {_vehiclepart} is not set: + stop + set {_vehicleuuid} to metadata value "vehicles.sk|vehicleuuid" of {_vehiclepart} + set {_alivevehicles} to vehiclesGetTmpData("alivevehicles") + loop ...{_alivevehicles}.get({_vehicleuuid}).get("parts"): + if loop-value.get("part")'s leggings is {_eventitem}: + set {_part} to loop-value.get("part") + set {_storageid} to 1st line of lore of {_part}'s leggings + set {_produceslots::%{_storageid}%} to loop-value.get("part") + + loop {_produceslots::*}: + if loop-value's helmet is not rail: + set {_produceslot} to loop-value + stop loop + set {_vehiclepart} to metadata value "storagewagon" of getMetadataBlock() + + set {_storagewagonuuid} to metadata value "vehicles.sk|vehicleuuid" of {_vehiclepart} + + if {_produceslot} is set: + set {_eventitem} to oak log + loop ...{_alivevehicles}.get({_storagewagonuuid}).get("parts"): + if loop-value.get("part")'s leggings is oak log: + set {_part} to loop-value.get("part") + set {_storageid} to 1st line of lore of {_part}'s leggings + set {_storageparts::%{_storageid}%} to loop-value.get("part") + set {_i} to 0 + set {_loopid} to size of {_storageparts::*} + loop {_storageparts::*}: + set {_nloop} to {_loopid} - {_i} + if {_storageparts::%{_nloop}%}'s helmet is {_eventitem}: + set {_logslot} to {_storageparts::%{_nloop}%} + stop loop + add 1 to {_i} + + if {_logslot} is set: + set {_eventitem} to iron ore + loop ...{_alivevehicles}.get({_storagewagonuuid}).get("parts"): + if loop-value.get("part")'s leggings is iron ore: + set {_part} to loop-value.get("part") + set {_storageid} to 1st line of lore of {_part}'s leggings + set {_storageparts::%{_storageid}%} to loop-value.get("part") + set {_i} to 0 + set {_loopid} to size of {_storageparts::*} + loop {_storageparts::*}: + set {_nloop} to {_loopid} - {_i} + if {_storageparts::%{_nloop}%}'s helmet is {_eventitem}: + set {_ironslot} to {_storageparts::%{_nloop}%} + stop loop + add 1 to {_i} + if {_ironslot} is set: + set {_ironslot}'s helmet to air + set {_logslot}'s helmet to air + set {_produceslot}'s helmet to rail + +function mgTrainmastersSummonWagon(type:text,loc:location): + if {_type} is "water": + set {_item} to barrier named "clickevent" + set 1st line of lore of {_item} to "water" + else if {_type} is "producer": + set {_item} to barrier named "clickevent" + set 1st line of lore of {_item} to "producer" + else if {_type} is "coal": + set {_item} to barrier named "clickevent" + set 1st line of lore of {_item} to "coal" + else if {_type} is "storage": + set {_item} to barrier named "clickevent" + set 1st line of lore of {_item} to "storage" + else: + set {_item} to air + + # + # > Basic train wagon setup. + set {_vehicle} to vehiclesCreateVehicle() + set {_x} to -0.8 + set {_x1} to -1.5 + + # + # > Floor + loop 5 times: + add 0.31 to {_x1} + set {_part} to vehicesCreateVehiclePart(black concrete,air,{_item}) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x1},0,-0.21) + + set {_part} to vehicesCreateVehiclePart(black concrete,air,{_item}) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x1},0,0.21) + + # + # > Tires + set {_part} to vehicesCreateVehiclePart(stone button,air,{_item}) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-0.1,-1.05,-0.3) + set {_part} to vehicesCreateVehiclePart(stone button,air,{_item}) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-1,-1.05,-0.3) + set {_part} to vehicesCreateVehiclePart(stone button,air,{_item}) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-0.1,-1.05,0.3) + set {_part} to vehicesCreateVehiclePart(stone button,air,{_item}) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-1,-1.05,0.3) + + set {_part} to vehicesCreateVehiclePart(air, barrier named "wagoncontrol",{_item}) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-0.5,0.5,0) + + # + # > Special train wagon setups: + # + # > Water wagon + if {_type} is "producer": + set {_x} to -0.8 + set {_y} to -0.4 + loop 3 times: + add 0.62 to {_x} + + set {_part} to vehicesCreateVehiclePart(iron block,air,{_item}) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x}-1,{_y},-0.31) + set {_part} to vehicesCreateVehiclePart(iron block,air,{_item}) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x}-1,{_y},0.31) + + set {_y} to 0.43 + set {_x} to -1.52 + loop 2 times: + set {_part} to vehicesCreateVehiclePart(heavy weighted pressure plate,air,{_item}) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,-1.57)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x},{_y},-0.35) + + set {_part} to vehicesCreateVehiclePart(heavy weighted pressure plate,air,{_item}) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,-1.57)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x},{_y},0.35) + add 0.547 to {_y} + + set {_y} to 0.43 + set {_x} to 0.31 + loop 2 times: + set {_part} to vehicesCreateVehiclePart(heavy weighted pressure plate,air,{_item}) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,-1.57)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x},{_y},-0.35) + + set {_part} to vehicesCreateVehiclePart(heavy weighted pressure plate,air,{_item}) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,-1.57)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x},{_y},0.35) + add 0.547 to {_y} + set {_x} to -1.18 + loop 3 times: + set {_part} to vehicesCreateVehiclePart(iron trapdoor,air,{_item}) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x},1.2,-0.31) + + set {_part} to vehicesCreateVehiclePart(iron trapdoor,air,{_item}) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x},1.2,0.31) + add 0.62 to {_x} + + set {_part} to vehicesCreateVehiclePart(daylight sensor,air,{_item}) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,3.14)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-0.56,1.15,0) + add 0.62 to {_x} + + # + # > Rail heads: + set {_storageitem} to rail + set {_y} to -0.1 + loop 10 times: + add 1 to {_producerheadid} + set 1st line of lore of {_storageitem} to "%{_producerheadid}%" + set {_part} to vehicesCreateVehiclePart(rail,air,{_item},{_storageitem}) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(1.57,1.57,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},0.17,{_y},0) + + add 0.04 to {_y} + add 1 to {_producerheadid} + set 1st line of lore of {_storageitem} to "%{_producerheadid}%" + set {_part} to vehicesCreateVehiclePart(rail,air,{_item},{_storageitem}) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(1.57,0,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-0.6,{_y},-0.755) + add 0.04 to {_y} + set {_uuid} to vehiclesSpawnVehicle({_vehicle},{_loc}) + wait 2 ticks + mgTrainmastersHandleTrain({_uuid},"other",0.5) + + # + # > Water wagon + if {_type} is "coal": + set {_x} to -0.8 + set {_y} to -0.4 + loop 3 times: + add 0.62 to {_x} + + set {_part} to vehicesCreateVehiclePart(black concrete,air,{_item}) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x}-1,{_y},-0.31) + set {_part} to vehicesCreateVehiclePart(black concrete,air,{_item}) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x}-1,{_y},0.31) + + set {_x} to -0.7 + loop 3 times: + add 0.42 to {_x} + + set {_part} to vehicesCreateVehiclePart(coal block,{_item}) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x}-0.7,0.9,-0.21) + set {_part} to vehicesCreateVehiclePart(coal block,{_item}) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x}-0.7,0.9,0.21) + + # + # > Wagon information + set {_storageitem} to coal + # + # > Current coal + set 1st line of lore of {_storageitem} to "5" + # + # > Maximum coal + set 2nd line of lore of {_storageitem} to "10" + set {_part} to vehicesCreateVehiclePart(air,air,{_item},{_storageitem}) + set {_bar} to mgTrainmastersCreateStatusBar(10,5,"&0&l","&7&l","|") + set {_part} to vehiclesSetVehiclePartSetting({_part},"name","&7[%{_bar}%&7]") + set {_part} to vehiclesSetVehiclePartSetting({_part},"namevisible",true) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-0.5,0.2,0) + set {_uuid} to vehiclesSpawnVehicle({_vehicle},{_loc}) + wait 2 ticks + mgTrainmastersHandleTrain({_uuid},"other",0.5) + if {_type} is "water": + set {_x} to -0.8 + # + # > Floor + loop 3 times: + add 0.62 to {_x} + set {_y} to -0.4 + loop 2 times: + set {_part} to vehicesCreateVehiclePart(light blue concrete,air,{_item}) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x}-1,{_y},-0.31) + set {_part} to vehicesCreateVehiclePart(light blue concrete,air,{_item}) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x}-1,{_y},0.31) + add 0.62 to {_y} + + # + # > Wagon information + set {_storageitem} to water bucket + # + # > Current water + set 1st line of lore of {_storageitem} to "5" + # + # > Maximum water + set 2nd line of lore of {_storageitem} to "10" + set {_part} to vehicesCreateVehiclePart(air,air,{_item},{_storageitem}) + set {_bar} to mgTrainmastersCreateStatusBar(10,5,"&b&l","&7&l","|") + set {_part} to vehiclesSetVehiclePartSetting({_part},"name","&7[%{_bar}%&7]") + set {_part} to vehiclesSetVehiclePartSetting({_part},"namevisible",true) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-0.5,0.2,0) + + set {_uuid} to vehiclesSpawnVehicle({_vehicle},{_loc}) + wait 2 ticks + mgTrainmastersHandleTrain({_uuid},"other",0.5) + # + # > Storage wagon + if {_type} is "storage": + + set {_item} to barrier named "clickevent" + set 1st line of lore of {_item} to "storage" + + # + # > Floor + loop 3 times: + add 0.62 to {_x} + + set {_part} to vehicesCreateVehiclePart(black carpet,air,{_item}) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x}-1,-0.4,-0.31) + set {_part} to vehicesCreateVehiclePart(black carpet,air,{_item}) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x}-1,-0.4,0.31) + + # + # > Fences + set {_x} to -1.1 + loop 3 times: + set {_part} to vehicesCreateVehiclePart(oak fence,air,{_item}) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,1.58,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x},0.3,0.55) + + set {_part} to vehicesCreateVehiclePart(oak fence,air,{_item}) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,1.58,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x},0.3,-0.55) + + add 0.545 to {_x} + + set {_x} to -1.4 + loop 2 times: + set {_part} to vehicesCreateVehiclePart(oak fence,air,{_item}) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x},0.3,-0.274) + + set {_part} to vehicesCreateVehiclePart(oak fence,air,{_item}) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x},0.3,0.274) + add 1.7 to {_x} + + # + # > Storage slots + + # + # > Log storage + set {_y} to 0 + set {_storageitem} to oak log + loop 5 times: + set 1st line of lore of {_storageitem} to "%loop-number%" + set {_part} to vehicesCreateVehiclePart(air,barrier,{_item},{_storageitem}) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(1.58,0,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-0.2,{_y},-0.25) + add 0.62 to {_y} + + # + # > Iron ore storage + set {_y} to -0.25 + set {_storageitem} to iron ore + loop 5 times: + set 1st line of lore of {_storageitem} to "%loop-number%" + set {_part} to vehicesCreateVehiclePart(air,barrier,{_item},{_storageitem}) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-0.9,{_y},0) + add 0.62 to {_y} + + set {_uuid} to vehiclesSpawnVehicle({_vehicle},{_loc}) + wait 2 ticks + mgTrainmastersHandleTrain({_uuid},"other",0.5) + + +function mgTrainmastersSummonTrain(): + vehiclesKillAllVehicles() + set {_loc} to {@trainloc} + remove 2 from x-coord of {_loc} + mgTrainmastersSummonWagon("coal",{_loc}.clone()) + wait 1 tick + remove 2 from x-coord of {_loc} + mgTrainmastersSummonWagon("water",{_loc}.clone()) + wait 1 tick + remove 2 from x-coord of {_loc} + mgTrainmastersSummonWagon("storage",{_loc}.clone()) + wait 1 tick + remove 2 from x-coord of {_loc} + mgTrainmastersSummonWagon("producer",{_loc}.clone()) + wait 1 tick + add 8 to x-coord of {_loc} + wait 1 tick + set {_vehicle} to vehiclesCreateVehicle() + loop 2 times: + add 0.62 to {_x} + # + # > Floor + set {_part} to vehicesCreateVehiclePart(black carpet) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x}-1,-0.4,-0.31) + set {_part} to vehicesCreateVehiclePart(black carpet) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x}-1,-0.4,0.31) + + # + # > Engine part + set {_part} to vehicesCreateVehiclePart(black concrete) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x} - 1.3,-0.7,0) + set {_part} to vehicesCreateVehiclePart(black concrete) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x} - 1.3,-0.2,0) + + set {_y} to -0.6 + loop 3 times: + set {_part} to vehicesCreateVehiclePart(black concrete) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-1.001,{_y},-0.31) + set {_part} to vehicesCreateVehiclePart(black concrete) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-1.001,{_y},0.31) + + add 0.5 to {_y} + + # + # > Tires + set {_part} to vehicesCreateVehiclePart(stone button) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-0.1,-1.05,-0.3) + set {_part} to vehicesCreateVehiclePart(stone button) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-1,-1.05,-0.3) + set {_part} to vehicesCreateVehiclePart(stone button) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-0.1,-1.05,0.3) + set {_part} to vehicesCreateVehiclePart(stone button) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,0,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-1,-1.05,0.3) + + # + # > Window front + set {_part} to vehicesCreateVehiclePart(glass pane) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,1.58,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-0.87,0.84,0.28) + set {_part} to vehicesCreateVehiclePart(glass pane) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,1.58,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-0.87,0.84,-0.28) + # + # > Window behind + set {_part} to vehicesCreateVehiclePart(glass pane) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,1.58,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-1.52,0.84,0.28) + set {_part} to vehicesCreateVehiclePart(glass pane) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(0,1.58,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-1.52,0.84,-0.28) + + # + # > Chimney + set {_part} to vehicesCreateVehiclePart(black concrete) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},{_x} - 1.3,1,0) + + # + # > Iron backplate + set {_part} to vehicesCreateVehiclePart(heavy weighted pressure plate) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(1.58,1.58,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-1.35,0.4,-0.31) + set {_part} to vehicesCreateVehiclePart(heavy weighted pressure plate) + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_part} to vehiclesSetVehiclePartPose({_part},"head",vector(1.58,1.58,0)) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-1.35,0.4,0.31) + + set {_part} to vehicesCreateVehiclePart(air, barrier named "wagoncontrol") + set {_part} to vehiclesSetVehiclePartSetting({_part},"small",true) + set {_vehicle} to vehiclesAddVehiclePart({_vehicle},{_part},-0.5,0.5,0) + + set {_uuid} to vehiclesSpawnVehicle({_vehicle},{_loc}) + remove 2 from x-coord of {_loc} + wait 2 ticks + mgTrainmastersHandleTrain({_uuid},"locomotive",0.5) + + +function mgTrainmastersHandleSetBorderTrain(borderfollow:entity): + if mgGetTemporaryGameData("worldborder") is not set: + set {_world} to {_borderfollow}'s world + set {_worldborder} to {_world}.getWorldBorder() + mgSetTemporaryGameData("worldborder",{_worldborder}) + {_worldborder}.setSize(30.00) + {_worldborder}.setWarningDistance(0) + {_worldborder}.setWarningTime(1) + {_worldborder}.setDamageBuffer(0) + while {_borderfollow} is alive: + wait 1 tick + {_worldborder}.setCenter(x-coord of {_borderfollow}, 0) + +function mgTrainmastersGiveScores(): + set {_score} to mgGetTemporaryGameData("traindistance") + set {_score} to round({_score}) + loop all players: + mgAddPlayerToplistScore("Trainmasters",loop-player,{_score}) + set {_uuid} to uuid of loop-player + add {_score} to {cobble::%{_uuid}%} + +function mgTrainmastersHandleTrain(uuid:text,trainpart:text="other",speed:number=1): + + set {_wagonfront} to metadata value "lastwagonfront" of getMetadataBlock() + mgTrainmastersHandleSetBorderTrain({_wagonfront}) + + while mgGetTemporaryGameData("status") is "ingame": + if {_trainpart} is "locomotive": + mgSetTemporaryGameData("locomotive",{_wagonfront}) + mgTrainmastersUseCoal() + set block 1 below {_wagonfront} to iron block + mgTrainmastersUseWater() + mgTrainmastersCreateResources() + mgSetTemporaryGameData("respawnloc",{_wagonfront}.getLocation().clone()) + + mgSetTemporaryGameData("traindistance",x-coord of {_wagonfront}) + set {_center} to vehiclesGetTmpData("vehicles.sk|center|%{_uuid}%") + add 0.5 to y-coord of {_center} + set {_block} to block at {_wagonfront}.getLocation() + if {_block} is not rail: + vehiclesKillVehicle("%{_uuid}%") + play 20 explosion at {_wagonfront}.getLocation() + play sound "entity.generic.explode" with volume 0.5 with pitch 0.7 at {_wagonfront}.getLocation() for all players + set {_endit} to true + mgTrainmastersGiveScores() + mgTrainmastersHandler("stop") + stop + + set {_railshape} to "%{_block}.getBlockData().getShape()%" + loop 20 times: + + # + # ADD Fix for locations on after an curve: + # rotate the cart to the nearest correct yaw location. + # e.g. cart is at yaw 177, teleport it to + # have a yaw of 180 for proper steering. + # > add function called mgTrainmastersSteeringFix() + # to do that job seperatly and instantly. + set {_block} to block at {_wagonfront}.getLocation() + if {_block} is not rail: + vehiclesKillVehicle("%{_uuid}%") + play 20 huge explosion at {_wagonfront}.getLocation() + play sound "entity.generic.explode" with volume 0.5 with pitch 0.7 at {_wagonfront}.getLocation() for all players + set {_endit} to true + mgTrainmastersGiveScores() + mgTrainmastersHandler("stop") + stop + add 1 to {_i} + set {_railshape} to "%{_block}.getBlockData().getShape()%" + if "%{_railshape}%" contains "ascending": + set block at {_wagonfront}.getLocation() to air + if "%{_railshape}%" is "EAST_WEST": + + if {_wagonfront}.getLocation().getYaw() <= 0: + vehiclesTeleportVehicleRelative({_uuid},vector(0.02,0,0)) + else: + vehiclesTeleportVehicleRelative({_uuid},vector(-0.02,0,0)) + + if "%{_railshape}%" is "SOUTH_WEST": + if {_swmode} is not set: + if {_wagonfront}.getLocation().getYaw() is between 265 and 275: + set {_swmode} to "backwards" + else: + set {_swmode} to "forwards" + if {_swmode} is "forwards": + if {_wagonfront}.getLocation().getYaw() is not 90: + vehiclesRotateVehicle({_uuid},1.5) + vehiclesTeleportVehicleRelative({_uuid},vector(0,0,0.0168)) + else: + if {_wagonfront}.getLocation().getYaw() is not 180: + vehiclesRotateVehicle({_uuid},-1.5) + vehiclesTeleportVehicleRelative({_uuid},vector(-0.0168,0,0)) + else: + if {_swmode} is set: + + add 1 to {_swcounter} + if {_swcounter} is 5: + delete {_swmode} + delete {_swcounter} + + if "%{_railshape}%" is "NORTH_SOUTH": + + if {_wagonfront}.getLocation().getYaw() is between 265 and 275: + vehiclesTeleportVehicleRelative({_uuid},vector(0,0,-0.02)) + else: + vehiclesTeleportVehicleRelative({_uuid},vector(0,0,0.02)) + + if "%{_railshape}%" is "NORTH_EAST": + if {_nemode} is not set: + if {_wagonfront}.getLocation().getYaw() is between 175 and 185: + set {_nemode} to "backwards" + else: + set {_nemode} to "forwards" + if {_nemode} is "forwards": + if {_wagonfront}.getLocation().getYaw() is not 0: + vehiclesRotateVehicle({_uuid},-1.5) + vehiclesTeleportVehicleRelative({_uuid},vector(0.0168,0,0)) + else: + if {_wagonfront}.getLocation().getYaw() is not 270: + vehiclesRotateVehicle({_uuid},1.5) + vehiclesTeleportVehicleRelative({_uuid},vector(0,0,-0.0168)) + else: + if {_nemode} is set: + + delete {_nemode} + + + if "%{_railshape}%" is "NORTH_WEST": + if {_nwmode} is not set: + if {_wagonfront}.getLocation().getYaw() is between 85 and 95: + set {_nwmode} to "backwards" + else: + set {_nwmode} to "forwards" + if {_nwmode} is "forwards": + if {_wagonfront}.getLocation().getYaw() is not 270: + vehiclesRotateVehicle({_uuid},-1.5) + vehiclesTeleportVehicleRelative({_uuid},vector(0,0,-0.0168)) + else: + if {_wagonfront}.getLocation().getYaw() is not 180: + vehiclesRotateVehicle({_uuid},1.5) + vehiclesTeleportVehicleRelative({_uuid},vector(-0.0168,0,0)) + else: + if {_nwmode} is set: + + delete {_nwmode} + + + if "%{_railshape}%" is "SOUTH_EAST": + if {_semode} is not set: + if {_wagonfront}.getLocation().getYaw() is between 175 and 185: + set {_semode} to "backwards" + else: + set {_semode} to "forwards" + if {_semode} is "forwards": + if {_wagonfront}.getLocation().getYaw() is not 0: + vehiclesRotateVehicle({_uuid},1.5) + vehiclesTeleportVehicleRelative({_uuid},vector(0.0168,0,0)) + else: + if {_wagonfront}.getLocation().getYaw() is not 90: + vehiclesRotateVehicle({_uuid},-1.5) + vehiclesTeleportVehicleRelative({_uuid},vector(0,0,0.0168)) + else: + if {_semode} is set: + + delete {_semode} + + + add 1 to {_wait} + if {_wait} >= {_speed}: + delete {_wait} + if {_speed} is 0.5: + set {_timespan} to "2 ticks" parsed as timespan + wait {_timespan} + else: + wait 1 tick diff --git a/MINIGAMES.SK/games/Trainmasters/vehicles.sk b/MINIGAMES.SK/games/Trainmasters/vehicles.sk new file mode 100644 index 0000000..e53a125 --- /dev/null +++ b/MINIGAMES.SK/games/Trainmasters/vehicles.sk @@ -0,0 +1,404 @@ + + +import: + java.util.HashMap + java.util.ArrayList + java.lang.Math + java.util.UUID + org.bukkit.util.EulerAngle + + +function vehiclesSaveTmpData(key:text,value:object): + if metadata value "vehiclesTmpData" of getMetadataBlock() is set: + (metadata value "vehiclesTmpData" of getMetadataBlock()).put({_key},{_value}) + else: + set metadata value "vehiclesTmpData" of getMetadataBlock() to new HashMap() + (metadata value "vehiclesTmpData" of getMetadataBlock()).put({_key},{_value}) + +function vehiclesGetTmpData(key:text) :: object: + if metadata value "vehiclesTmpData" of getMetadataBlock() is set: + return (metadata value "vehiclesTmpData" of getMetadataBlock()).get({_key}) + +function vehiclesRemoveTmpData(key:text): + if metadata value "vehiclesTmpData" of getMetadataBlock() is set: + try (metadata value "vehiclesTmpData" of getMetadataBlock()).remove({_key}) + +# +# > Function - getMetadataBlock +# > Actions: +# > Returns a block as a dummy for metadata storage. +function getMetadataBlock() :: block: + if {vehiclesmetadatablock} is not a block: + add all worlds to {_worlds::*} + set {vehiclesmetadatablock} to block at location at 0.0, 0.0, 0.0 in {_worlds::1} + return {vehiclesmetadatablock} + + +function vehicesCreateVehiclePart(head:item=air,boots:item=air,chestplate:item=air,leggings:item=air,righthand:item=air,lefthand:item=air,uuid:text="none") :: object: + set {_part} to new HashMap() + set {_equipment} to new HashMap() + set {_poses} to new HashMap() + set {_settings} to new HashMap() + {_equipment}.put("head",{_head}) + {_equipment}.put("boots",{_boots}) + {_equipment}.put("chestplate",{_chestplate}) + {_equipment}.put("righthand",{_righthand}) + {_equipment}.put("lefthand",{_lefthand}) + {_equipment}.put("leggings",{_leggings}) + if {_uuid} is "none": + set {_uuid} to UUID.randomUUID().toString() + {_part}.put("uuid",{_uuid}) + {_part}.put("poses",{_poses}) + {_part}.put("equipment", {_equipment}) + {_part}.put("settings",{_settings}) + return {_part} + +function vehiclesSetVehiclePartPose(part:object,pose:text,angle:object) :: object: + set {_poses} to {_part}.get("poses") + set {_EulerAngle} to new EulerAngle({_angle}.getX(), {_angle}.getY(), {_angle}.getZ()) + if {_EulerAngle} is instance of EulerAngle: + {_poses}.put({_pose},{_EulerAngle}) + {_part}.put("poses",{_poses}) + return {_part} + +function vehiclesSetVehiclePartSetting(part:object,setting:text,value:object) :: object: + set {_settings} to {_part}.get("settings") + {_settings}.put({_setting},{_value}) + {_part}.put("settings",{_settings}) + return {_part} + +function vehiclesCreateVehicle() :: object: + set {_vehicle} to new HashMap() + {_vehicle}.put("uuid",UUID.randomUUID().toString()) + {_vehicle}.put("parts",new HashMap()) + return {_vehicle} + +function vehiclesKillVehiclePartFromLivingVehicle(vehicleuuid:text,partuuid:text): + set {_alivevehicles} to vehiclesGetTmpData("alivevehicles") + + loop {_alivevehicles}.get({_vehicleuuid}).get("parts").size! times: + if {_alivevehicles}.get({_vehicleuuid}).get("parts").get(loop-number - 1).get("uuid") is {_partuuid}: + set {_part} to {_alivevehicles}.get({_vehicleuuid}).get("parts").get(loop-number - 1) + {_alivevehicles}.get({_vehicleuuid}).get("parts").remove({_part}) + set {_part} to {_part}.get("part") + + delete metadata value "vehicles.sk|vehicleuuid" of {_part} + kill {_part} + {_alivevehicles}.get({_vehicleuuid}).get("parts").remove({_partuuid}) + vehiclesSaveTmpData("alivevehicles",{_alivevehicles}) + +function vehiclesApplyEntitySettings(entity:entity,partdata:object): + + if {_partdata}.get("settings").get("arms") is set: + set {_arms} to {_partdata}.get("settings").get("arms") + else: + set {_arms} to false + {_entity}.setArms({_arms}) + + if {_partdata}.get("settings").get("baseplate") is set: + set {_baseplate} to {_partdata}.get("settings").get("baseplate") + else: + set {_baseplate} to false + {_entity}.setBasePlate({_baseplate}) + + if {_partdata}.get("settings").get("small") is set: + set {_small} to {_partdata}.get("settings").get("small") + else: + set {_small} to false + {_entity}.setSmall({_small}) + + if {_partdata}.get("settings").get("visible") is set: + set {_visible} to {_partdata}.get("settings").get("visible") + else: + set {_visible} to false + {_entity}.setVisible({_visible}) + + if {_partdata}.get("settings").get("name") is set: + set {_name} to {_partdata}.get("settings").get("name") + else: + set {_name} to "" + {_entity}.setCustomName("%{_name}%") + + if {_partdata}.get("settings").get("namevisible") is set: + set {_namevisible} to {_partdata}.get("settings").get("namevisible") + else: + set {_namevisible} to false + {_entity}.setCustomNameVisible({_namevisible}) + + if {_partdata}.get("settings").get("gravity") is set: + set {_gravity} to {_partdata}.get("settings").get("gravity") + else: + set {_gravity} to false + {_entity}.setGravity({_gravity}) + +function vehiclesAddVehiclePartToLivingVehicle(vehicleuuid:text,part:object,relx:number=0,rely:number=0,relz:number=0): + + set {_center} to vehiclesGetTmpData("vehicles.sk|center|%{_vehicleuuid}%") + set {_partloc} to {_center}.clone() + + set {_uuid} to {_part}.get("uuid") + + add {_relx} to x-coord of {_partloc} + + add {_rely} to y-coord of {_partloc} + + add {_relz} to z-coord of {_partloc} + + spawn 1 armor stand at {_partloc} + set {_vehiclepart} to last spawned entity + + vehiclesApplyEntitySettings({_vehiclepart},{_part}) + + + + # + # > Equip armor and tools. + {_vehiclepart}.setBoots({_part}.get("equipment").get("boots")) + {_vehiclepart}.setChestplate({_part}.get("equipment").get("chestplate")) + {_vehiclepart}.setHelmet({_part}.get("equipment").get("head")) + {_vehiclepart}.setItemInHand({_part}.get("equipment").get("righthand")) + set {_vehiclepart}'s offhand tool to {_part}.get("equipment").get("lefthand") + {_vehiclepart}.setLeggings({_part}.get("equipment").get("leggings")) + + # + # > Set poses of the armor stand to the predefined settings. + if {_part}.get("poses").get("body") is set: + {_vehiclepart}.setBodyPose({_part}.get("poses").get("body")) + + if {_part}.get("poses").get("head") is set: + {_vehiclepart}.setHeadPose({_part}.get("poses").get("head")) + + if {_part}.get("poses").get("leftarm") is set: + {_vehiclepart}.setLeftArmPose({_part}.get("poses").get("leftarm")) + + if {_part}.get("poses").get("leftleg") is set: + {_vehiclepart}.setLeftLegPose({_part}.get("poses").get("leftleg")) + + if {_part}.get("poses").get("rightarm") is set: + {_vehiclepart}.setRightArmPose({_part}.get("poses").get("rightarm")) + + if {_part}.get("poses").get("rightleg") is set: + {_vehiclepart}.setRightLegPose({_part}.get("poses").get("rightleg")) + set {_alivepart} to new HashMap() + {_alivepart}.put("part",{_vehiclepart}) + {_alivepart}.put("uuid",{_uuid}) + {_alivepart}.put("relativeX",{_relativeX}) + {_alivepart}.put("relativeY",{_relativeY}) + {_alivepart}.put("relativeZ",{_relativeZ}) + + set metadata value "vehicles.sk|vehicleuuid" of {_vehiclepart} to {_vehicleuuid} + + set {_alivevehicles} to vehiclesGetTmpData("alivevehicles") + + {_alivevehicles}.get({_vehicleuuid}).get("parts").add({_alivepart}) + + vehiclesSaveTmpData("alivevehicles",{_alivevehicles}) + + + +function vehiclesAddVehiclePart(vehicle:object,part:object,relx:number=0,rely:number=0,relz:number=0) :: object: + set {_parts} to {_vehicle}.get("parts") + set {_uuid} to {_part}.get("uuid") + set {_partdata} to new HashMap() + {_partdata}.put("part",{_part}) + {_partdata}.put("relativeX",{_relx}) + {_partdata}.put("relativeY",{_rely}) + {_partdata}.put("relativeZ",{_relz}) + + {_parts}.put({_uuid},{_partdata}) + {_vehicle}.put("parts",{_parts}) + return {_vehicle} + +function vehiclesSpawnVehicle(vehicle:object,loc:location) :: text: + set {_parts} to {_vehicle}.get("parts") + set {_vehicleuuid} to {_vehicle}.get("uuid") + + set {_aliveparts} to new ArrayList() + loop ...{_parts}.keySet(): + set {_partloc} to {_loc}.clone() + set {_uuid} to loop-value + + set {_relativeX} to {_parts}.get({_uuid}).get("relativeX") + add {_relativeX} to x-coord of {_partloc} + + set {_relativeY} to {_parts}.get({_uuid}).get("relativeY") + add {_relativeY} to y-coord of {_partloc} + + set {_relativeZ} to {_parts}.get({_uuid}).get("relativeZ") + add {_relativeZ} to z-coord of {_partloc} + + spawn 1 armor stand at {_partloc} + set {_part} to last spawned entity + vehiclesApplyEntitySettings({_part},{_parts}.get({_uuid}).get("part")) + + + # + # > Equip armor and tools. + {_part}.setBoots({_parts}.get({_uuid}).get("part").get("equipment").get("boots")) + {_part}.setChestplate({_parts}.get({_uuid}).get("part").get("equipment").get("chestplate")) + {_part}.setHelmet({_parts}.get({_uuid}).get("part").get("equipment").get("head")) + {_part}.setItemInHand({_parts}.get({_uuid}).get("part").get("equipment").get("righthand")) + set {_part}'s offhand tool to {_parts}.get({_uuid}).get("part").get("equipment").get("lefthand") + {_part}.setLeggings({_parts}.get({_uuid}).get("part").get("equipment").get("leggings")) + + # + # > Set poses of the armor stand to the predefined settings. + if {_parts}.get({_uuid}).get("part").get("poses").get("body") is set: + {_part}.setBodyPose({_parts}.get({_uuid}).get("part").get("poses").get("body")) + + if {_parts}.get({_uuid}).get("part").get("poses").get("head") is set: + {_part}.setHeadPose({_parts}.get({_uuid}).get("part").get("poses").get("head")) + + if {_parts}.get({_uuid}).get("part").get("poses").get("leftarm") is set: + {_part}.setLeftArmPose({_parts}.get({_uuid}).get("part").get("poses").get("leftarm")) + + if {_parts}.get({_uuid}).get("part").get("poses").get("leftleg") is set: + {_part}.setLeftLegPose({_parts}.get({_uuid}).get("part").get("poses").get("leftleg")) + + if {_parts}.get({_uuid}).get("part").get("poses").get("rightarm") is set: + {_part}.setRightArmPose({_parts}.get({_uuid}).get("part").get("poses").get("rightarm")) + + if {_parts}.get({_uuid}).get("part").get("poses").get("rightleg") is set: + {_part}.setRightLegPose({_parts}.get({_uuid}).get("part").get("poses").get("rightleg")) + set {_alivepart} to new HashMap() + {_alivepart}.put("part",{_part}) + {_alivepart}.put("uuid",{_uuid}) + {_alivepart}.put("relativeX",{_relativeX}) + {_alivepart}.put("relativeY",{_relativeY}) + {_alivepart}.put("relativeZ",{_relativeZ}) + + {_aliveparts}.add({_alivepart}) + set metadata value "vehicles.sk|vehicleuuid" of {_part} to {_vehicleuuid} + + set {_alivevehicle} to new HashMap() + {_alivevehicle}.put("parts",{_aliveparts}) + {_alivevehicle}.put("uuid",{_vehicleuuid}) + {_alivevehicle}.put("centerloc",{_loc}.clone()) + + set {_alivevehicles} to vehiclesGetTmpData("alivevehicles") + if {_alivevehicles} is not set: + set {_alivevehicles} to new HashMap() + {_alivevehicles}.put({_vehicleuuid},{_alivevehicle}) + vehiclesSaveTmpData("alivevehicles",{_alivevehicles}) + vehiclesSaveTmpData("vehicles.sk|center|%{_vehicleuuid}%",{_loc}.clone()) + vehiclesSaveTmpData("vehicles.sk|rotation|%{_vehicleuuid}%",0) + + return {_vehicleuuid} + +on death of armor stand: + if metadata value "vehicles.sk|vehicleuuid" of victim is set: + set {_uuid} to metadata value "vehicles.sk|vehicleuuid" of victim + set {_alivevehicles} to vehiclesGetTmpData("alivevehicles") + set {_vehicle} to {_alivevehicles}.get({_uuid}) + set {_parts} to {_vehicle}.get("parts") + loop ...{_parts}: + kill loop-value.get("part") + + {_alivevehicles}.remove({_uuid}) + vehiclesSaveTmpData("alivevehicles",{_alivevehicles}) + + +function vehiclesKillAllVehicles(): + set {_alivevehicles} to vehiclesGetTmpData("alivevehicles") + loop ...{_alivevehicles}.keySet(): + vehiclesKillVehicle("%loop-value%") + +function vehiclesKillVehicle(uuid:text): + set {_alivevehicles} to vehiclesGetTmpData("alivevehicles") + set {_vehicle} to {_alivevehicles}.get({_uuid}) + set {_parts} to {_vehicle}.get("parts") + loop ...{_parts}: + kill loop-value.get("part") + {_alivevehicles}.remove({_uuid}) + vehiclesSaveTmpData("alivevehicles",{_alivevehicles}) + vehiclesRemoveTmpData("vehicles.sk|center|%{_uuid}%") + +function vehiclesTeleportVehicle(uuid:text,loc:location): + set {_loc} to {_loc}.clone() + + set {_alivevehicles} to vehiclesGetTmpData("alivevehicles") + set {_vehicle} to {_alivevehicles}.get("%{_uuid}%") + if {_vehicle} is set: + set {_parts} to {_vehicle}.get("parts") + vehiclesSaveTmpData("vehicles.sk|center|%{_uuid}%",{_loc}) + + loop ...{_parts}: + set {_part} to loop-value.get("part") + set {_relx} to loop-value.get("relativeX") + set {_rely} to loop-value.get("relativeY") + set {_relz} to loop-value.get("relativeZ") + + set {_tplocation} to {_loc}.clone() + add {_relx} to x-coord of {_tplocation} + add {_rely} to y-coord of {_tplocation} + add {_relz} to z-coord of {_tplocation} + + if {_tplocation} is set: + {_part}.teleport({_tplocation}) + +function vehiclesTeleportVehicleRelative(uuid:text,vector:object): + set {_alivevehicles} to vehiclesGetTmpData("alivevehicles") + set {_vehicle} to {_alivevehicles}.get("%{_uuid}%") + if {_vehicle} is set: + set {_parts} to {_vehicle}.get("parts") + set {_loc} to vehiclesGetTmpData("vehicles.sk|center|%{_uuid}%") + + add {_vector}.getX() to x-coord of {_loc} + add {_vector}.getY() to y-coord of {_loc} + add {_vector}.getZ() to z-coord of {_loc} + + vehiclesSaveTmpData("vehicles.sk|center|%{_uuid}%",{_loc}) + + loop ...{_parts}: + set {_part} to loop-value.get("part") + + set {_loc} to {_part}'s location + + set {_tplocation} to {_loc}.clone() + add {_vector}.getX() to x-coord of {_tplocation} + add {_vector}.getY() to y-coord of {_tplocation} + add {_vector}.getZ() to z-coord of {_tplocation} + + if {_tplocation} is set: + try {_part}.teleport({_tplocation}) + +function vehiclesRotateVehicle(uuid:text,degrees:number): + set {_alivevehicles} to vehiclesGetTmpData("alivevehicles") + set {_vehicle} to {_alivevehicles}.get("%{_uuid}%") + + if {_vehicle} is set: + set {_parts} to {_vehicle}.get("parts") + + set {_center} to vehiclesGetTmpData("vehicles.sk|center|%{_uuid}%") + + set {_rotation} to vehiclesGetTmpData("vehicles.sk|rotation|%{_uuid}%") + vehiclesSaveTmpData("vehicles.sk|rotation|%{_uuid}%",{_rotation} + {_degrees}) + + loop ...{_parts}: + set {_part} to loop-value.get("part") + set {_tplocation} to vehiclesCalculateRotation({_center}.clone(), {_part}.getLocation().clone(), {_degrees}) + + if {_tplocation} is not null: + try {_part}.teleport({_tplocation}) + + +function vehiclesCalculateRotation(center:location,partloc:location,degrees:number) :: object: + {_center}.setY({_partloc}.getY()) + set {_oldyaw} to {_partloc}'s yaw + set {_oldyaw} to mod({_oldyaw}, 360.0F) + set {_distance} to {_center}.distance({_partloc}) + set {_angle} to Math.acos((x-coord of {_partloc} - x-coord of {_center})/{_distance}) + + if {_partloc}.getZ() < {_center}.getZ(): + set {_newangle} to 2 * Math.PI! - {_angle} + ({_degrees} * Math.PI! / 180) + else: + set {_newangle} to {_angle} + ({_degrees} * Math.PI! / 180) + + set {_newx} to Math.cos({_newangle}) * {_distance} + set {_newz} to Math.sin({_newangle}) * {_distance} + set {_partloc} to {_center}.clone().add({_newx}, 0, {_newz}) + set {_newyaw} to {_oldyaw} + {_degrees} + set {_newyaw} to mod({_newyaw}, 360.0F) + set {_newloc} to {_partloc}.clone() + {_newloc}.setYaw({_newyaw}) + return {_newloc}