Skip to content

Commit

Permalink
Added media lookup for lamp
Browse files Browse the repository at this point in the history
  • Loading branch information
miyucomics committed Mar 12, 2024
1 parent 1c97525 commit e113585
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class NeedsLampMishap : Mishap() {
override fun errorMessage(ctx: CastingContext, errorCtx: Context): Text = error(Hexical.MOD_ID + ":needs_lamp")

override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
yeetHeldItem(ctx, Hand.MAIN_HAND)
yeetHeldItem(ctx, Hand.OFF_HAND)
yeetHeldItem(ctx, ctx.castingHand)
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package miyucomics.hexical.casting.operators.lamp

import at.petrak.hexcasting.api.misc.MediaConstants
import at.petrak.hexcasting.api.spell.ConstMediaAction
import at.petrak.hexcasting.api.spell.casting.CastingContext
import at.petrak.hexcasting.api.spell.iota.DoubleIota
import at.petrak.hexcasting.api.spell.iota.Iota
import at.petrak.hexcasting.api.spell.iota.NullIota
import at.petrak.hexcasting.api.spell.iota.Vec3Iota
import at.petrak.hexcasting.api.utils.vecFromNBT
import at.petrak.hexcasting.common.items.magic.ItemPackagedHex
import at.petrak.paucal.xplat.IXplatAbstractions
import miyucomics.hexical.casting.mishaps.NeedsLampMishap
import miyucomics.hexical.items.LampItem
import miyucomics.hexical.registry.HexicalItems

class OpGetLampData(private val mode: Int) : ConstMediaAction {
Expand All @@ -21,6 +25,7 @@ class OpGetLampData(private val mode: Int) : ConstMediaAction {
1 -> return listOf(Vec3Iota(vecFromNBT(nbt.getLongArray("rotation"))))
2 -> return listOf(Vec3Iota(vecFromNBT(nbt.getLongArray("velocity"))))
3 -> return listOf(DoubleIota(ctx.world.time - nbt.getDouble("start_time")))
4 -> return listOf(DoubleIota((ctx.caster.activeItem.item as LampItem).getMedia(ctx.caster.activeItem).toDouble() / MediaConstants.DUST_UNIT))
}
return listOf(NullIota())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ object HexicalPatterns {
val LAMP_ROTATION: HexPattern = register(HexPattern.fromAngles("qwddedadw", HexDir.SOUTH_WEST), "get_lamp_rotation", OpGetLampData(1))
val LAMP_VELOCITY: HexPattern = register(HexPattern.fromAngles("qwddedqew", HexDir.SOUTH_WEST), "get_lamp_velocity", OpGetLampData(2))
val LAMP_USE_TIME: HexPattern = register(HexPattern.fromAngles("qwddedqwddwa", HexDir.SOUTH_WEST), "get_lamp_use_time", OpGetLampData(3))
val LAMP_MEDIA: HexPattern = register(HexPattern.fromAngles("qwddedqwwaqqqqqeaqeaeqqqeaeq", HexDir.SOUTH_WEST), "get_lamp_media", OpGetLampData(4))
val ARCH_LAMP_POSITION: HexPattern = register(HexPattern.fromAngles("qaqwddedqdd", HexDir.NORTH_EAST), "get_arch_lamp_position", OpGetArchLampData(0))
val ARCH_LAMP_ROTATION: HexPattern = register(HexPattern.fromAngles("qaqwddedadw", HexDir.NORTH_EAST), "get_arch_lamp_rotation", OpGetArchLampData(1))
val ARCH_LAMP_VELOCITY: HexPattern = register(HexPattern.fromAngles("qaqwddedqew", HexDir.NORTH_EAST), "get_arch_lamp_velocity", OpGetArchLampData(2))
Expand Down
21 changes: 11 additions & 10 deletions common/src/main/resources/assets/hexical/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"hexcasting.spell.hexical:get_lamp_rotation": "Genie Refl.: Rotational",
"hexcasting.spell.hexical:get_lamp_velocity": "Genie Refl.: Kinetic",
"hexcasting.spell.hexical:get_lamp_use_time": "Genie Refl.: Temporal",
"hexcasting.spell.hexical:get_lamp_media": "Genie Refl.: Media",
"hexcasting.spell.hexical:get_arch_lamp_position": "Archgenie Refl.: Spatial",
"hexcasting.spell.hexical:get_arch_lamp_rotation": "Archgenie Refl.: Rotational",
"hexcasting.spell.hexical:get_arch_lamp_velocity": "Archgenie Refl.: Kinetic",
Expand Down Expand Up @@ -74,27 +75,27 @@

"hexical.page.new_possibilities.title": "New Possibilities",
"hexical.page.new_possibilities.0": "It casts $(o)$(l)EVERY INSTANT$(). After writing a spell into it, I was treated to a splendid gush of media. I estimate the casting speed must be around twenty times every second. The presence inside the lamp performs the casting on my behalf with extraordinary efficiency, not producing the sound and particles that accompany other casting methods.",
"hexical.page.new_possibilities.1": "I have developed some useful patterns for use with the lamp, documented on the next few pages.",
"hexical.page.new_possibilities.1": "I have developed some useful patterns for use with the lamp, documented on the next few pages. These patterns should only be cast from within the lamp, lest I succumb to the Missing Genie mishap, which emits red sparks and flings my casting item from my hand.",
"hexical.page.get_lamp_position": "Pushes the original position of the caster when the lamp started casting.",
"hexical.page.get_lamp_rotation": "Pushes the original rotation of the caster when the lamp started casting.",
"hexical.page.get_lamp_velocity": "Pushes the original velocity of the caster when the lamp started casting.",
"hexical.page.get_lamp_use_time": "Pushes how many times the lamp has casted. Divided by 20, it returns how many times in seconds the lamp has been in use.",
"hexical.page.get_lamp_media": "Pushes the remaining media of the lamp in dust.",

"hexical.page.replacement_mind.title": "Replacement Mind",
"hexical.page.replacement_mind.0": "Hex casting burns out the mind from the energy of thought, flooding the consciousness, inundating every neuron... it's euphoric. For staffs, casting devices, and spell circles, the rate of casting is slow enough that a mind can recuperate; I will never need to replace my mind or an impetus. With the speeds this lamp operates at, though, even an optimized mind can only bear the burden for so long. Luckily, the lamp is able to somehow support the mind until its media battery runs out, where the genie finally perishes and the lamp visibly tarnishes. In these cases, the genie must be... replaced.",
"hexical.page.replacement_mind.1": "Basing off the shape of the other genie patterns and the $(o)feeling$() of the media, I have developed this highly specialized pattern that extracts the mind of a villager and transforms it into a genie. The stress of nonstop casting requires highly trained villagers, I estimate of Journeyman-class or greater. The lamp may not be recharged without sacrificing a new mind, discarding the previous genie in the process, so I should aim to gather as much media as I can before casting.",

"hexical.page.arch_lamps.title": "Archgenie Lamps",
"hexical.page.arch_lamps.0": "Because a separate mind casts my spells, a lamp should be able to cast even without me holding it. I estimate any villager short of a complete master of its field would be unable to cast so often unassisted though. These $(o)archgenie lamps$() are activated and deactivated rather than used and while active in my inventory, they cast every moment even without my input.",
"hexical.page.arch_lamps.title": "Arch Lamps",
"hexical.page.arch_lamps.0": "Because a separate mind casts my spells, a lamp should be able to cast even without me holding it. I estimate any villager short of a complete master of its field would be unable to cast so often unassisted though. These $(o)arch lamps$() are activated and deactivated rather than used and while active in my inventory, they cast every moment even without my input.",
"hexical.page.arch_lamps.1": "The output of an arch lamp is so grand that it saturates the air around me with media... it's incredible. Unfortunately, if two lamps are active at once within my inventory, the resonances clash and deactivate both lamps, as well as rendering every arch lamp in my inventory useless for a few seconds. I should only have one archgenie lamp active at once, although I can still simutaneously use a regular lamp.",

"hexical.page.get_lamp_position": "Pushes the original position of the caster when the lamp started casting.",
"hexical.page.get_lamp_rotation": "Pushes the original rotation of the caster when the lamp started casting.",
"hexical.page.get_lamp_velocity": "Pushes the original velocity of the caster when the lamp started casting.",
"hexical.page.get_lamp_use_time": "Pushes how many times the lamp has casted. Divided by 20, it returns how many times in seconds the lamp has been in use.",

"hexical.page.get_arch_lamp_position": "Pushes the original position of the caster when the arch lamp started casting. Can be cast by casting items or staff.",
"hexical.page.get_arch_lamp_rotation": "Pushes the original rotation of the caster when the arch lamp started casting. Can be cast by casting items or staff.",
"hexical.page.get_arch_lamp_velocity": "Pushes the original velocity of the caster when the arch lamp started casting. Can be cast by casting items or staff.",
"hexical.page.get_arch_lamp_use_time": "Pushes how many times the lamp has casted. Divided by 20, it returns how many times in seconds the lamp has been in use. Can be cast by casting items or staff.",
"hexical.page.is_using_lamp": "Takes a player and pushes whether they currently have an active arch lamp.",
"hexical.page.terminate_arch_lamp": "Casted by a casting device, staff, or within the arch lamp, deactivates the lamp's operation. Similar to Charon's.",
"hexical.page.is_using_lamp": "Pushes whether a player currently has an active arch lamp.",
"hexical.page.terminate_arch_lamp": "Can be casted by a casting device, staff, or within the arch lamp itself. Deactivates the lamp's operation, similar to Charon's.",

"hexical.page.arch_lamp_storage.title": "Archgenie Lamp Storage",
"hexical.page.arch_lamp_storage": "The arch lamp continues to impress me with its capabilities! It supports an iota storage similar to the Ravenmind, persisting between ticks. If I need to remember any important information between casts of the lamp, I can stash it in here. The two patterns responsible can also be cast by a staff or casting device if an arch lamp is active.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@
"input": "",
"output": "number",
"text": "hexical.page.get_lamp_use_time"
},
{
"type": "hexcasting:pattern",
"op_id": "hexical:get_lamp_media",
"anchor": "hexical:get_lamp_media",
"input": "",
"output": "number",
"text": "hexical.page.get_lamp_media"
}
]
}

0 comments on commit e113585

Please sign in to comment.