mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 19:44:05 +09:00
throwable cherry bomb (no explosion yet)
This commit is contained in:
@@ -27,7 +27,7 @@ abstract class Actor : Comparable<Actor>, Runnable {
|
||||
* Valid RefID is equal to or greater than 16777216.
|
||||
* @return Reference ID. (16777216-0x7FFF_FFFF)
|
||||
*/
|
||||
open var referenceID: ActorID = 0 // in old time this was nullable without initialiser. If you're going to revert to that, add the reason why this should be nullable.
|
||||
open var referenceID: ActorID = Terrarum.generateUniqueReferenceID() // in old time this was nullable without initialiser. If you're going to revert to that, add the reason why this should be nullable.
|
||||
|
||||
/**
|
||||
* RenderOrder does not affect ReferenceID "too much" (ID generation will still depend on it, but it's just because of ye olde tradition by now)
|
||||
@@ -40,7 +40,8 @@ abstract class Actor : Comparable<Actor>, Runnable {
|
||||
|
||||
// needs zero-arg constructor for serialiser to work
|
||||
constructor(renderOrder: RenderOrder, id: ActorID?) : this() {
|
||||
referenceID = id ?: Terrarum.generateUniqueReferenceID(renderOrder)
|
||||
if (id != null) referenceID = id
|
||||
this.renderOrder = renderOrder
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ open class ActorMovingPlatform() : ActorWithBody() {
|
||||
@Transient protected val actorsRiding = ArrayList<ActorID>() // saving actorID due to serialisation issues
|
||||
|
||||
init {
|
||||
physProp = PhysProperties.PHYSICS_OBJECT
|
||||
physProp = PhysProperties.PHYSICS_OBJECT()
|
||||
|
||||
setHitboxDimension(TILE_SIZE * tilewiseWidth, TILE_SIZE, 0, 0)
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ import kotlin.math.*
|
||||
*/
|
||||
open class ActorWithBody : Actor {
|
||||
|
||||
var physProp = PhysProperties.HUMANOID_DEFAULT
|
||||
var physProp = PhysProperties.HUMANOID_DEFAULT()
|
||||
|
||||
// copied from old interface Luminous
|
||||
/**
|
||||
@@ -1460,7 +1460,7 @@ open class ActorWithBody : Actor {
|
||||
externalV.y + (controllerV?.y ?: 0.0) >= 0.0 &&
|
||||
this.downButtonHeld == 0 && this.axisY <= 0f) ||
|
||||
// platforms, moving downward, for the case of NOT ActorHumanoid
|
||||
(this !is ActorHumanoid && BlockCodex[tile].isPlatform &&
|
||||
(this !is ActorHumanoid && !physProp.ignorePlatform && BlockCodex[tile].isPlatform &&
|
||||
externalV.y + (controllerV?.y ?: 0.0) >= 0.0)
|
||||
// TODO: as for the platform, only apply it when it's a feet tile
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import kotlin.math.floor
|
||||
*
|
||||
* MarkerMode must be set manually after calling `setGhost` -- the `unsetGhost` will not reset the field.
|
||||
*/
|
||||
class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = PhysProperties.MOBILE_OBJECT), NoSerialise {
|
||||
class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = PhysProperties.MOBILE_OBJECT()), NoSerialise {
|
||||
|
||||
enum class MarkerMode {
|
||||
FIXTURE_GHOST, BLOCK_MARKER
|
||||
|
||||
@@ -1,33 +1,35 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
data class PhysProperties(
|
||||
val immobileBody: Boolean = false,
|
||||
var usePhysics: Boolean = true,
|
||||
val useStairs: Boolean = false
|
||||
val immobileBody: Boolean = false,
|
||||
var usePhysics: Boolean = true,
|
||||
val useStairs: Boolean = false,
|
||||
val ignorePlatform: Boolean = true
|
||||
) {
|
||||
companion object {
|
||||
val HUMANOID_DEFAULT = PhysProperties(
|
||||
immobileBody = false,
|
||||
usePhysics = true,
|
||||
useStairs = true
|
||||
fun HUMANOID_DEFAULT() = PhysProperties(
|
||||
immobileBody = false,
|
||||
usePhysics = true,
|
||||
useStairs = true,
|
||||
ignorePlatform = false,
|
||||
)
|
||||
/** e.g. dropped items, balls */
|
||||
val PHYSICS_OBJECT = PhysProperties(
|
||||
immobileBody = false,
|
||||
usePhysics = true,
|
||||
useStairs = false
|
||||
fun PHYSICS_OBJECT() = PhysProperties(
|
||||
immobileBody = false,
|
||||
usePhysics = true,
|
||||
useStairs = false,
|
||||
)
|
||||
/** e.g. voice maker */
|
||||
val IMMOBILE = PhysProperties(
|
||||
immobileBody = true,
|
||||
usePhysics = false,
|
||||
useStairs = false
|
||||
fun IMMOBILE() = PhysProperties(
|
||||
immobileBody = true,
|
||||
usePhysics = false,
|
||||
useStairs = false,
|
||||
)
|
||||
/** e.g. camera */
|
||||
val MOBILE_OBJECT = PhysProperties(
|
||||
immobileBody = false,
|
||||
usePhysics = false,
|
||||
useStairs = false
|
||||
fun MOBILE_OBJECT() = PhysProperties(
|
||||
immobileBody = false,
|
||||
usePhysics = false,
|
||||
useStairs = false,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ class WireActor : ActorWithBody, NoSerialise {
|
||||
|
||||
private constructor()
|
||||
|
||||
constructor(id: ActorID) : super(RenderOrder.OVERLAY, PhysProperties.IMMOBILE, id)
|
||||
constructor(id: ActorID) : super(RenderOrder.OVERLAY, PhysProperties.IMMOBILE(), id)
|
||||
|
||||
init {
|
||||
setHitboxDimension(TILE_SIZE, TILE_SIZE, 0, 0)
|
||||
|
||||
Reference in New Issue
Block a user