mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 20:45:28 +01:00
Add admin tool for adding specific fantasy affixes (#58884)
A new option when using VV on atom movables is to add a custom fantasy "affixes".
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
var/static/list/affixListing
|
||||
|
||||
///affixes expects an initialized list
|
||||
/datum/component/fantasy/Initialize(quality, list/affixes = list(), canFail=FALSE, announce=FALSE)
|
||||
if(!isitem(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
@@ -22,7 +23,10 @@
|
||||
|
||||
src.affixes = affixes
|
||||
appliedComponents = list()
|
||||
randomAffixes()
|
||||
if(affixes && affixes.len)
|
||||
setAffixes()
|
||||
else
|
||||
randomAffixes()
|
||||
|
||||
/datum/component/fantasy/Destroy()
|
||||
unmodify()
|
||||
@@ -55,6 +59,7 @@
|
||||
quality = -quality
|
||||
return quality
|
||||
|
||||
///proc on creation for random affixes
|
||||
/datum/component/fantasy/proc/randomAffixes(force)
|
||||
if(!affixListing)
|
||||
affixListing = list()
|
||||
@@ -80,11 +85,20 @@
|
||||
continue
|
||||
if(!(affix.alignment & alignment))
|
||||
continue
|
||||
if(!affix.validate(src))
|
||||
if(!affix.validate(parent))
|
||||
continue
|
||||
affixes += affix
|
||||
usedSlots |= affix.placement
|
||||
|
||||
///proc on creation for specific affixes given to the fantasy component
|
||||
/datum/component/fantasy/proc/setAffixes(force)
|
||||
var/usedSlots = NONE
|
||||
for(var/datum/fantasy_affix/affix in affixes) // We want at least 1 affix applied
|
||||
if((affix.placement & usedSlots) || (!affix.validate(parent)))
|
||||
affixes.Remove(affix) //bad affix (can't be added to this item)
|
||||
continue
|
||||
usedSlots |= affix.placement
|
||||
|
||||
/datum/component/fantasy/proc/modify()
|
||||
var/obj/item/master = parent
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
/datum/fantasy_affix
|
||||
///only used for admins adding the affix, this is not what players will see.
|
||||
var/name = "SOMEONE DIDN'T SET AN ADMIN NAME FOR THIS"
|
||||
var/placement // A bitflag of "slots" this affix takes up, for example pre/suffix
|
||||
var/alignment
|
||||
var/weight = 10
|
||||
|
||||
// For those occasional affixes which only make sense in certain circumstances
|
||||
/datum/fantasy_affix/proc/validate(datum/component/fantasy/comp)
|
||||
/datum/fantasy_affix/proc/validate(obj/item/attached)
|
||||
return TRUE
|
||||
|
||||
/datum/fantasy_affix/proc/apply(datum/component/fantasy/comp, newName)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/datum/fantasy_affix/cosmetic_prefixes
|
||||
name = "purely cosmetic prefix"
|
||||
placement = AFFIX_PREFIX
|
||||
alignment = AFFIX_GOOD | AFFIX_EVIL
|
||||
|
||||
@@ -39,6 +40,7 @@
|
||||
return "[pick(badPrefixes)] [newName]"
|
||||
|
||||
/datum/fantasy_affix/tactical
|
||||
name = "tactical"
|
||||
placement = AFFIX_PREFIX
|
||||
alignment = AFFIX_GOOD
|
||||
weight = 1 // Very powerful, no one should have such power
|
||||
@@ -49,6 +51,7 @@
|
||||
return "tactical [newName]"
|
||||
|
||||
/datum/fantasy_affix/pyromantic
|
||||
name = "pyromantic"
|
||||
placement = AFFIX_PREFIX
|
||||
alignment = AFFIX_GOOD
|
||||
|
||||
@@ -58,6 +61,7 @@
|
||||
return "pyromantic [newName]"
|
||||
|
||||
/datum/fantasy_affix/vampiric
|
||||
name = "vampiric"
|
||||
placement = AFFIX_PREFIX
|
||||
alignment = AFFIX_GOOD
|
||||
weight = 5
|
||||
@@ -68,6 +72,7 @@
|
||||
return "vampiric [newName]"
|
||||
|
||||
/datum/fantasy_affix/beautiful
|
||||
name = "beautiful"
|
||||
placement = AFFIX_PREFIX
|
||||
alignment = AFFIX_GOOD
|
||||
|
||||
@@ -81,6 +86,7 @@
|
||||
master.RemoveElement(/datum/element/beauty, max(comp.quality, 1) * 250)
|
||||
|
||||
/datum/fantasy_affix/ugly
|
||||
name = "ugly"
|
||||
placement = AFFIX_PREFIX
|
||||
alignment = AFFIX_EVIL
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/datum/fantasy_affix/cosmetic_suffixes
|
||||
name = "purely cosmetic suffix"
|
||||
placement = AFFIX_SUFFIX
|
||||
alignment = AFFIX_GOOD | AFFIX_EVIL
|
||||
|
||||
@@ -47,6 +48,7 @@
|
||||
|
||||
//////////// Good suffixes
|
||||
/datum/fantasy_affix/bane
|
||||
name = "of <mobtype> slaying (random species, carbon or simple animal)"
|
||||
placement = AFFIX_SUFFIX
|
||||
alignment = AFFIX_GOOD
|
||||
|
||||
@@ -78,6 +80,7 @@
|
||||
return "[newName] of [initial(picked_mobtype.name)] slaying"
|
||||
|
||||
/datum/fantasy_affix/summoning
|
||||
name = "of <mobtype> summoning (dangerous, can pick all but megafauna tier stuff)"
|
||||
placement = AFFIX_SUFFIX
|
||||
alignment = AFFIX_GOOD
|
||||
weight = 5
|
||||
@@ -115,11 +118,12 @@
|
||||
return "[newName] of [initial(picked_mobtype.name)] summoning"
|
||||
|
||||
/datum/fantasy_affix/shrapnel
|
||||
name = "shrapnel"
|
||||
placement = AFFIX_SUFFIX
|
||||
alignment = AFFIX_GOOD
|
||||
|
||||
/datum/fantasy_affix/shrapnel/validate(datum/component/fantasy/comp)
|
||||
if(isgun(comp.parent))
|
||||
/datum/fantasy_affix/shrapnel/validate(obj/item/attached)
|
||||
if(isgun(attached))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
@@ -149,6 +153,7 @@
|
||||
return "[newName] of [initial(picked_projectiletype.name)] shrapnel"
|
||||
|
||||
/datum/fantasy_affix/strength
|
||||
name = "of strength (knockback)"
|
||||
placement = AFFIX_SUFFIX
|
||||
alignment = AFFIX_GOOD
|
||||
|
||||
@@ -161,6 +166,7 @@
|
||||
//////////// Bad suffixes
|
||||
|
||||
/datum/fantasy_affix/fool
|
||||
name = "of the fool (honking)"
|
||||
placement = AFFIX_SUFFIX
|
||||
alignment = AFFIX_EVIL
|
||||
|
||||
|
||||
Reference in New Issue
Block a user