refactor: text

This commit is contained in:
cha0s 2021-02-15 16:42:19 -06:00
parent c0d6a53825
commit e20728a9d6

View File

@ -262,20 +262,21 @@ export default (latus) => class Vulnerable extends Trait {
acceptedHarm: (harm) => {
const {amount, isDamage} = harm;
const fontSize = this.constructor.harmTextSize(amount);
this.entity.emitParticle('harm', {
traits: {
Colored: {
Colorized: {
state: {
red: isDamage ? 255 : 0,
green: isDamage ? 0 : 255,
blue: isDamage ? 0 : 128,
},
},
DomText: {
DomNode: {
params: {
textStyle: {
style: {
fontFamily: 'joystix',
fontSize: `${this.constructor.harmTextSize(amount)}px`,
position: 'absolute',
textShadow: [
'-2px 2px 0 #000',
'2px 2px 0 #000',
@ -285,6 +286,11 @@ export default (latus) => class Vulnerable extends Trait {
},
},
},
DomText: {
params: {
fontSize,
},
},
Textual: {
state: {
text: amount,