Skip to content

Commit

Permalink
ability mod + npc spawner changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverSokolova committed Feb 22, 2024
1 parent 9fddc47 commit 094d4ab
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 100 deletions.
2 changes: 1 addition & 1 deletion _metadata
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"name": "XRC_BETA_STARBOUND",
"steamContentId": "2010607826",
"tags": "Crafting and Building|Miscellaneous|Planets and Environments|Musical Instruments and Songs|NPCs and Creatures|Weapons|Quests|Dungeons|Ships|User Interface|Furniture and Objects|Character Improvements|Food and Farming|In-Game Tools|Mechanics|Vehicles and Mounts|Armor and Clothes",
"version": "0.12"
"version": "0.12b"
}
2 changes: 1 addition & 1 deletion items/buildscripts/starbound/buildabilitymod.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function build(directory, config, parameters)
end
config.acceptedElements = acceptedElements
end
config.shortdescription = string.gsub((config.rarity ~= "common" and "^yellow;" or "")..(not config.weaponTypes and "^green;" or "")..abilityData.name.."^reset;", "<elementalName>", config.elementalNameDescription)
config.shortdescription = string.gsub((config.rarity ~= "common" and "^yellow;" or "")..abilityData.name.."^reset;", "<elementalName>", config.elementalNameDescription)
config.description = string.format(config.description, config[(config.slot and "primary" or "alt").."Description"])

config.tooltipFields = parameters.tooltipFields or config.tooltipFields or {}
Expand Down
4 changes: 4 additions & 0 deletions npcs/merchant.npctype.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
[{"op":"test","path":"/scripts/0","value":"/npcs/bmain.lua"},
{"op":"add","path":"/scripts/-","value":"/npcs/sb_outpostcivilian.lua"}]
]
6 changes: 6 additions & 0 deletions npcs/sb_outpostcivilian.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ function init() ini()
local quests = {config.getParameter("sb_offeredQuests"),config.getParameter("sb_turnInQuests")}
if quests[1] then npc.setOfferedQuests(sb_mergeQuests(quests[1],config.getParameter("offeredQuests",{}))) end
if quests[2] then npc.setTurnInQuests(sb_mergeQuests(quests[2],config.getParameter("turnInQuests",{}))) end --though it'd be cool to just use [1] if [2] is a number, that'd screw over people trying to add quests since it wouldn't add ours

sb_beamIn = config.getParameter("sb_beamIn") and not status.statusProperty("sb_beamedIn")
if sb_beamIn then
status.setStatusProperty("sb_beamedIn", 1)
status.addEphemeralEffect("beamin")
end
end

function update(...) updat(...)
Expand Down
28 changes: 22 additions & 6 deletions objects/spawner/spawners/sb_spawner.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
local ini = init or function() end
local onInteractio = onInteraction or function() end
local sb_onInteraction = onInteraction or function() end

function init() ini()
script.setUpdateDelta(0)
object.setInteractive(true)
smas = object.smash
toAbsolutePositio = object.toAbsolutePosition
object.smash = function() smas(true) end
object.toAbsolutePosition = function(z) return toAbsolutePositio{z[1],z[2]+1} end
sb_scriptConfig = config.getParameter("spawner.sb_scriptConfig")

sb_smash = object.smash
object.smash = function() sb_smash(true) end

sb_toAbsolutePosition = object.toAbsolutePosition
object.toAbsolutePosition = function(z) return sb_toAbsolutePosition{z[1],z[2]+1} end

world.isVisibleToPlayer = function() return false end

sb_spawnNpc = world.spawnNpc
world.spawnNpc = function(position, species, npcType, level, seed, parameters)
if parameters and sb_scriptConfig then
parameters.scriptConfig = sb.jsonMerge(sb_scriptConfig, parameters.scriptConfig)
end
parameters.scriptConfig.sb_beamIn = true
return sb_spawnNpc(position, species, npcType, level, seed, parameters)
end
end

function onInteraction(args) onInteractio(args) update() end
function onInteraction(args)
sb_onInteraction(args)
update()
end
72 changes: 0 additions & 72 deletions sb_abilitymods.config
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
/*
836238594
club
greataxe
greatsword
greatmace
quarterstaff
spellbook

1632807184
katana

1967748482
stolte_smg
stolte_pulserifle
stolte_machinegun
stolte_leveractionrifle
stolte_handcannon
grenadeLauncher
stolte_autoshotgun
stolte_bullpup
*/
{
"weaponNames": {
"assaultrifle": "A. Rifle",
Expand All @@ -31,223 +10,172 @@
"abilities": {
//Melee
"bladecharge": {
"weaponTypes": ["broadsword", "longsword", "club", "greatsword"],
"weaponName": "sword"
},
"downstab": {
"weaponTypes": ["broadsword", "longsword", "katana", "club", "greatsword"],
"weaponName": "sword"
},
"parry": {
"weaponTypes": ["broadsword", "longsword", "club", "greatsword"],
"weaponName": "sword"
},
"risingslash": {
"weaponTypes": ["broadsword", "longsword", "club", "greatsword"],
"weaponName": "sword"
},
"spinslash": {
"weaponTypes": ["broadsword", "longsword", "katana", "club", "greatsword"],
"weaponName": "sword"
},
"superspinslash": {
"icon": "spinslash.png",
"weaponTypes": ["broadsword", "longsword", "katana", "club", "greatsword"],
"weaponName": "sword"
},
"giantsword": {
"weaponTypes": ["broadsword", "longsword", "katana", "club", "greatsword"],
"weaponName": "sword"
},
"travelingslash": {
"weaponTypes": ["broadsword", "longsword", "katana", "club", "greatsword"],
"weaponName": "sword"
},
"blinkexplosion": {
"weaponTypes": ["broadsword", "hammer", "spear", "longsword", "quarterstaff", "greataxe", "club", "greatsword", "greatmace"],
"weaponName": "melee"
},
"blinkslash": {
"weaponTypes": ["broadsword", "longsword", "club", "greatsword"],
"weaponName": "sword"
},
"traildash": {
"weaponTypes": ["broadsword", "longsword", "club", "greatsword"],
"weaponName": "sword"
},
"uppercut": {
"weaponTypes": ["hammer", "quarterstaff", "greataxe", "greatmace"],
"weaponName": "hammer"
},
"physicalshockwave": {
"weaponTypes": ["hammer", "quarterstaff", "greataxe", "greatmace"],
"acceptedElements": ["physical"], //this ability only works on physical weapons
"weaponName": "hammer"
},
"shockwave": {
"weaponTypes": ["hammer", "quarterstaff", "greataxe", "greatmace"],
"weaponName": "hammer"
},
"groundslam": {
"weaponTypes": ["hammer", "quarterstaff", "greataxe", "greatmace"],
"weaponName": "hammer"
},
"elementalaura": {
"weaponTypes": ["hammer", "quarterstaff", "greataxe", "greatmace"],
"weaponName": "hammer"
},
"elementalpillar": {
"weaponTypes": ["hammer", "quarterstaff", "greataxe", "greatmace"],
"weaponName": "hammer"
},
"flurry": {
"weaponTypes": ["spear", "quarterstaff"],
"weaponName": "spear"
},
"spearspin": {
"weaponTypes": ["spear", "quarterstaff"],
"weaponName": "spear"
},
"elementalspin": {
"weaponTypes": ["spear", "quarterstaff"],
"weaponName": "spear"
},
"barrier": {
"weaponTypes": ["spear", "quarterstaff"],
"weaponName": "spear"
},
"rocketspear": {
"weaponTypes": ["spear", "quarterstaff"],
"weaponName": "spear"
},

//Guns
"explosiveshot": {
"weaponTypes": ["assaultrifle", "battlerifle", "sniperrifle", "stolte_smg", "stolte_pulserifle", "stolte_machinegun", "stolte_leveractionrifle", "stolte_bullpup"],
"weaponName": "rifle"
},
"bouncingshot": {
"weaponTypes": ["assaultrifle", "battlerifle", "sniperrifle", "stolte_smg", "stolte_leveractionrifle", "stolte_handcannon", "stolte_autoshotgun", "stolte_bullpup"],
"weaponName": "rifle"
},
"flashlight": {
"weaponTypes": ["assaultrifle", "shotgun", "sniperrifle", "battlerifle", "stolte_smg", "stolte_pulserifle", "stolte_handcannon", "stolte_bullpup"],
"weaponName": "firearm"
},
"grenadelauncher": {
"weaponTypes": ["assaultrifle", "shotgun", "sniperrifle", "battlerifle", "stolte_pulserifle", "stolte_autoshotgun", "stolte_bullpup"],
"weaponName": "firearm"
},
"spray": {
"weaponTypes": ["assaultrifle", "battlerifle", "stolte_smg", "stolte_pulserifle", "stolte_bullpup"],
"icon": "sb_spring.png",
"weaponName": "assaultrifle"
},
"sb_physicallance": {
"weaponTypes": ["assaultrifle", "battlerifle", "stolte_pulserifle", "stolte_machinegun", "stolte_leveractionrifle", "stolte_handcannon", "stolte_autoshotgun", "stolte_bullpup"],
"acceptedElements": ["physical"], //this ability only works on physical weapons
"weaponName": "assaultrifle"
},
"lance": {
"weaponTypes": ["assaultrifle", "battlerifle", "stolte_pulserifle", "stolte_machinegun", "stolte_leveractionrifle", "stolte_handcannon", "stolte_autoshotgun", "stolte_bullpup"],
"weaponName": "assaultrifle"
},
"explosiveburst": {
"weaponTypes": ["assaultrifle", "stolte_pulserifle", "stolte_machinegun", "stolte_handcannon", "grenadeLauncher", "stolte_autoshotgun", "stolte_bullpup"],
"weaponName": "assaultrifle"
},
"homingrocket": {
"weaponTypes": ["rocketlauncher"],
"icon": "/items/active/weapons/ranged/abilities/markedshot/targetoverlay.png",
"weaponName": "rocketlauncher"
},
"guidedrocket": {
"weaponTypes": ["rocketlauncher"],
"weaponName": "rocketlauncher"
},
"rocketburst": {
"weaponTypes": ["rocketlauncher"],
"weaponName": "rocketlauncher"
},
"shrapnelbomb": {
"weaponTypes": ["shotgun", "grenadeLauncher"],
"weaponName": "shotgun"
},
"burstshot": {
"weaponTypes": ["shotgun", "stolte_pulserifle", "stolte_handcannon", "stolte_autoshotgun"],
"weaponName": "shotgun"
},
"stickyshot": {
"weaponTypes": ["shotgun", "grenadeLauncher"],
"weaponName": "shotgun"
},
"piercingshot": {
"weaponTypes": ["sniperrifle", "stolte_pulserifle", "stolte_machinegun", "stolte_leveractionrifle", "stolte_handcannon", "stolte_bullpup"],
"weaponName": "sniperrifle"
},
"markedshot": {
"weaponTypes": ["sniperrifle", "stolte_leveractionrifle"],
"icon": "/items/active/weapons/ranged/abilities/markedshot/targetoverlay.png",
"weaponName": "sniperrifle"
},
"deathbomb": {
"weaponTypes": ["sniperrifle"],
"weaponName": "sniperrifle"
},

//staves
"elementbouncer": {
"weaponTypes": ["staff", "wand", "spellbook"],
"slot": "primary",
"weaponName": "wand"
},
"elementorb": {
"weaponTypes": ["staff", "wand", "spellbook"],
"slot": "primary",
"weaponName": "wand"
},
"elementportal": {
"weaponTypes": ["staff", "wand", "spellbook"],
"slot": "primary",
"weaponName": "wand"
},
"elementrain": {
"weaponTypes": ["staff", "wand", "spellbook"],
"slot": "primary",
"icon": "/interface/cockpit/weather/rain.png",
"weaponName": "wand"
},
"elementswarm": {
"weaponTypes": ["staff", "wand", "spellbook"],
"slot": "primary",
"weaponName": "wand"
},
"energyzone": {
"weaponTypes": ["staff", "spellbook"],
"weaponName": "staff"
},
"forcecage": {
"weaponTypes": ["staff", "spellbook"],
"weaponName": "staff"
},
"healingzone": {
"weaponTypes": ["staff", "spellbook"],
"weaponName": "staff"
},
"lowgravzone": {
"weaponTypes": ["staff", "spellbook"],
"weaponName": "staff"
},
"pullzone": {
"weaponTypes": ["staff", "spellbook"],
"weaponName": "staff"
},
"pushzone": {
"weaponTypes": ["staff", "spellbook"],
"weaponName": "staff"
},
"slowzone": {
"weaponTypes": ["staff", "spellbook"],
"weaponName": "staff"
}
}
Expand Down
39 changes: 31 additions & 8 deletions scripts/augments/sb_ability.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,23 @@ function apply(input)
or string.find(output:instanceValue("tooltipKind", "base"), "sup") --Supper's Combat Overhaul weapons tend to just eat the ability items. Possibly for the same reason as the Thorny Needler...?
then return output:descriptor(), 0 end
local slot = config.getParameter("slot", "alt").."AbilityType"
local newAbility = config.getParameter("ability", "0")
local currentAbility = output:instanceValue(slot, "1")
local valid = false
local category = string.gsub(output:instanceValue("category",""):lower(), " ", "")
newAbility = config.getParameter("ability", "0")
valid = false

local weaponTypes = config.getParameter("weaponTypes", {category})
for i = 1, #weaponTypes do
--if string.find(name, weaponTypes[i]) or category == weaponTypes[i] then
if string.find(category, weaponTypes[i]) then
valid = true
local rarities = {"common", "uncommon", "rare", "legendary", "essential"}
local itemName = output:instanceValue("itemName")
for i = 1, #rarities do
if itemName:find(rarities[i]) then
currentRarity = i
end
end

for i = 1, currentRarity and #rarities or 1 do
if valid then
break
end
checkPossibleAbilities(currentRarity and itemName:gsub(rarities[currentRarity], rarities[i]) or itemName)
end

local acceptedElements = config.getParameter("acceptedElements")
Expand All @@ -41,4 +46,22 @@ function apply(input)
-- end
return output:descriptor(), 1
end
end

function checkPossibleAbilities(itemName)
local builderConfig = root.itemConfig(itemName)
builderConfig = builderConfig and builderConfig.config.builderConfig or nil
if builderConfig then
for i = 1, #builderConfig do
local possibleAbilities = builderConfig[i].altAbilities
if possibleAbilities then
for j = 1, #possibleAbilities do
if possibleAbilities[j] == newAbility then
valid = true
break
end
end
end
end
end
end
3 changes: 2 additions & 1 deletion xrc/deployment/versioning/0018z.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
local ini = init or function() end
function init() ini()
local currentVersion = 29
local currentVersion = 30
if player.introComplete() then
if status.statusProperty("xrc_0018z") == nil then status.setStatusProperty("xrc_0018z",0) end
local yv = status.statusProperty("xrc_0018z")
if yv < currentVersion then
sb.logInfo(string.format("[Betabound] Updating this character from %s to %s!", yv, currentVersion))
require("/xrc/deployment/versioning/0018z_2.lua")
status.setStatusProperty("xrc_0018z",currentVersion)
xrc0018z_2(currentVersion,yv)
Expand Down
Loading

0 comments on commit 094d4ab

Please sign in to comment.